From: Chris Rankin <rankinc@pacbell.net>
To: linux-kernel@vger.kernel.org, andre@linux-ide.org
Subject: PATCH: Basic devfs support for raw IO
Date: Sun, 09 Sep 2001 21:04:41 -0700 (PDT) [thread overview]
Message-ID: <200109100404.f8A44fi00670@twopit.underworld> (raw)
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);
reply other threads:[~2001-09-10 4:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200109100404.f8A44fi00670@twopit.underworld \
--to=rankinc@pacbell.net \
--cc=andre@linux-ide.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®