Skip to contentSkip to conversation

- Linux 2.4.5; devfs support for /dev/raw

PATCH New Chris Rankin 1 participant 1 message Jun 20, 2001 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - Linux 2.4.5; devfs support for /dev/raw

Hi,

I have written this patch so that /dev/raw now appears in a devfs filesystem. I haven't tried to support the /dev/rawN devices because I'm not sure that it would be worthwhile. (Seeing as you need to bind them by hand manually anyway.)

Cheers,
Chris

drivers/char/raw.c renamed from drivers/char/raw.c.orig +7 -1
@@ -15,6 +15,7 @@
 #include <linux/raw.h>
 #include <linux/capability.h>
 #include <linux/smp_lock.h>
+#include <linux/devfs_fs_kernel.h>
 #include <asm/uaccess.h>
 
 #define dprintk(x...) 
@@ -28,6 +29,7 @@
 } raw_device_data_t;
 
 static raw_device_data_t raw_devices[256];
+static const char RAW_DEVICE_NAME[] = "raw";
 
 static ssize_t rw_raw_dev(int rw, struct file *, char *, size_t, loff_t *);
 
@@ -53,7 +55,11 @@
 static int __init raw_init(void)
 {
 	int i;
-	register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+	devfs_register_chrdev(RAW_MAJOR, RAW_DEVICE_NAME, &raw_fops);
+	devfs_register(NULL, RAW_DEVICE_NAME, DEVFS_FL_DEFAULT,
+	               RAW_MAJOR, 0,
+	               S_IFCHR | S_IRUSR | S_IWUSR,
+	               &raw_fops, NULL);
 
 	for (i = 0; i < 256; i++)
 		init_MUTEX(&raw_devices[i].mutex);

--AA136AFB19.993012573/zappa.oak.suse.com--