On Срд, 2001-12-05 at 10:52, Borsenkow Andrej wrote:
>
> >
> > [root@bononcini guillaume]# /etc/init.d/rawdevices start
> > Affectation des périphériques
> > /dev/raw/raw1 --> /dev/hdc
> > Cannot open master raw device '/dev/rawctl' (No such file or
> directory)
> > fini
> >
>
> No wonder, there is no support for devfs in raw.c
>
O.K., here is a patch that adds support for devfs to raw.c. It
precreates /dev/raw/raw* nodes for all available minors; I do not
particularly like it, but raw command needs existing devices to get
minor number from; also, strictly speaking, all of them do exist as soon
as driver is loaded.
Is it acceptable from devfs point of view? It seems to work here.
Patch is against 2.4.16-4mdk
Guillaume, could you test it?
-andrej
--- raw.c.org Sun Sep 23 07:35:43 2001
+++ raw.c Sun Dec 9 14:44:01 2001
@@ -51,10 +51,25 @@
static int __init raw_init(void)
{
int i;
- register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+ static devfs_handle_t raw_devfs_handle;
+
+ devfs_register_chrdev(RAW_MAJOR, "raw", &raw_fops);
+ raw_devfs_handle = devfs_mk_dir(NULL, "raw", NULL);
+ 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++)
+ for (i = 0; i < 256; i++) {
+ char name[8]; /* this depends on max minor number! */
init_MUTEX(&raw_devices[i].mutex);
+ if (i) {
+ /* skip minor 0 */
+ sprintf(name, "raw%d", i);
+ devfs_register(raw_devfs_handle, name, DEVFS_FL_DEFAULT,
+ RAW_MAJOR, i,
+ S_IFCHR|S_IRUSR|S_IWUSR, &raw_fops, NULL);
+ }
+ }
return 0;
}