mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessandro Amici <amici@tiscalinet.it>
To: linux-kernel@vger.kernel.org
Cc: alexamici@tiscalinet.it
Subject: [PATCH] devfs support in char/raw.c
Date: Sat, 8 Dec 2001 11:31:35 +0100	[thread overview]
Message-ID: <20011208103135.7DA0EE005@alan.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

[please cc me on reply]

Hi,

the following patch enables devfs support for the raw devices.
It is a blatant cut-and-copy from other drivers, and it passed the
basic tests I could figure out (mainly xine dvd raw access) - with and
without devfs.

Without devfs I find the raw devices under /dev on my Debian box,
but man raw(8) itself introduces the /dev/raw/ directory.
So, the proposed devices naming scheme is:

/dev/raw/rawctl
/dev/raw/raw1
...
/dev/raw/raw64

I would like to submit the patch to the maintainer, but I failed to
find who he is! (Stephen Tweedie?)

Alessandro





[-- Attachment #2: patch-2.4.16-raw_devfs --]
[-- Type: text/x-diff, Size: 1046 bytes --]

--- drivers/char/raw.c-orig	Sun Sep 23 05:35:43 2001
+++ drivers/char/raw.c	Fri Dec  7 19:45:30 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...) 
@@ -51,10 +52,26 @@
 static int __init raw_init(void)
 {
 	int i;
-	register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+	devfs_handle_t devfs_handle;
+	char name_buf[8];
+
+	if (devfs_register_chrdev(RAW_MAJOR, "raw", &raw_fops))
+		printk("unable to get major %d for raw devs\n", RAW_MAJOR);
+
+	devfs_handle = devfs_mk_dir(NULL, "raw", NULL);
+	devfs_register (devfs_handle, "rawctl", DEVFS_FL_DEFAULT,
+			RAW_MAJOR, 0, S_IFCHR | S_IRUGO | S_IWUGO,
+			&raw_fops, NULL);
 
 	for (i = 0; i < 256; i++)
 		init_MUTEX(&raw_devices[i].mutex);
+
+	for (i = 1; i < 64; i++) {
+		sprintf(name_buf, "raw%d", i);
+		devfs_register (devfs_handle, name_buf, DEVFS_FL_DEFAULT,
+				RAW_MAJOR, i, S_IFCHR | S_IRUGO | S_IWUGO,
+				&raw_fops, NULL);
+	}
 
 	return 0;
 }

                 reply	other threads:[~2001-12-08 10:30 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=20011208103135.7DA0EE005@alan.localdomain \
    --to=amici@tiscalinet.it \
    --cc=alexamici@tiscalinet.it \
    --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®