linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: Basic devfs support for raw IO
@ 2001-09-10  4:04 Chris Rankin
  0 siblings, 0 replies; only message in thread
From: Chris Rankin @ 2001-09-10  4:04 UTC (permalink / raw)
  To: linux-kernel, andre

Hi,
I have written a small patch to create a /dev/rawctl device node and a
/dev/raw directory using devfs. Any feedback would be welcome - it
certainly seems to work on my box.

Cheers,
Chris

--- drivers/char/raw.c.orig	Wed Jun 27 17:10:55 2001
+++ drivers/char/raw.c	Sat Sep  1 14:54:43 2001
@@ -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...) 
@@ -53,7 +54,24 @@
 static int __init raw_init(void)
 {
 	int i;
-	register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+
+	if (devfs_register_chrdev(RAW_MAJOR, "raw", &raw_fops) != 0) {
+		printk(KERN_ERR "Unable to get major device %d for raw block devices",
+		                RAW_MAJOR);
+	} else {
+		/*
+		 * Make a directory for raw devices to go in ...
+		 */
+		devfs_mk_dir(NULL, "raw", NULL);
+
+		/*
+		 * Make the "control" device node for raw devices ...
+		 */
+		devfs_register(NULL, "rawctl", 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-09-10  4:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-10  4:04 PATCH: Basic devfs support for raw IO Chris Rankin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).