Re: Intent to package: devfsd
On Mon, Jul 19, 1999 at 02:23:06AM +0300, P.A. Knuutila wrote:
> On Sun, Jul 18, 1999 at 03:05:14PM -0400, Elie Rosenblum wrote:
>
> > BTW, I have a fixed patch for for drivers/block/md.c for the md.c
> > from the new RAID driver (if anybody testing devfs is using the
> > new RAID driver, ping me for this patch, since the devfs patch
> > only works with the old RAID driver).
>
> This devfs looks like an interesting idea, i'd be happy to run some
> tests with it and new RAID arrays.
>
> I'm planing on packaging the new RAID drivers as a kernel-patch package,
> once I'll understand how the make-kpkg stuff works. If this md.c patch
> doesn't break the RAID drivers on systems that don't use devfs, it might be
> a good idea to include it.
>
> (I was going to package the drivers as kernel modules, but it seems
> that they don't work with stock kernels)
Apply the new RAID patch first, then apply the devfs patch.
The devfs patch will fail in md.c, and a couple of other files.
The other files are easy to fix based on the .rej files.
Apply this patch to md.c, and you should be good to go (I have not
tested this very much, though - beware).
--- md.c.orig Sun Jul 18 13:59:41 1999
+++ md.c Sun Jul 18 15:07:18 1999
@@ -11,6 +11,7 @@
- kerneld support by Boris Tobotras <boris@xtalk.msk.su>
- kmod support by: Cyrus Durgin
- RAID0 bugfixes: Mark Anthony Lisher <markal@iname.com>
+ - Richard Gooch's devfs support: Elie Rosenblum <fnord@debian.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +25,9 @@
#include <linux/raid/md.h>
#include <linux/raid/xor.h>
+#ifdef CONFIG_DEVFS_FS
+#include <linux/devfs_fs_kernel.h>
+#endif
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -62,6 +66,10 @@ static mdk_thread_t *md_recovery_thread
int md_size[MAX_MD_DEVS] = {0, };
static void md_geninit (struct gendisk *);
+extern struct file_operations md_fops;
+#ifdef CONFIG_DEVFS_FS
+static devfs_handle_t devfs_handle = NULL;
+#endif
static struct gendisk md_gendisk=
{
@@ -75,6 +83,8 @@ static struct gendisk md_gendisk=
md_size,
MAX_MD_DEVS,
NULL,
+ NULL,
+ &md_fops,
NULL
};
@@ -279,7 +289,7 @@ char * partition_name (kdev_t dev)
if (!hd)
sprintf (dname->name, "[dev %s]", kdevname(dev));
else
- disk_name (hd, MINOR(dev), dname->name);
+ disk_name (hd, MINOR(dev), dname->name, 1);
dname->dev = dev;
md_list_add(&dname->list, &device_names);
@@ -3882,6 +3892,11 @@ void raid5_init (void);
md__initfunc(int md_init (void))
{
static char * name = "mdrecoveryd";
+#ifdef CONFIG_DEVFS_FS
+ int i;
+ char d_namestr[16];
+ char symlink[16];
+#endif
printk (KERN_INFO "md driver %d.%d.%d MAX_MD_DEVS=%d, MAX_REAL=%d\n",
MD_MAJOR_VERSION, MD_MINOR_VERSION,
@@ -3892,6 +3907,22 @@ md__initfunc(int md_init (void))
printk (KERN_ALERT "Unable to get major %d for md\n", MD_MAJOR);
return (-1);
}
+#ifdef CONFIG_DEVFS_FS
+ devfs_handle = devfs_mk_dir ("md", 0);
+
+ for (i = 0; i < MAX_MD_DEVS; i++)
+ {
+ sprintf (d_namestr, "md/%d", i);
+ devfs_register (d_namestr, 0, DEVFS_FL_TOLERANT,
+ MAJOR_NR, i,
+ S_IFBLK | S_IRUSR | S_IWUSR, 0, 0,
+ &md_fops, NULL);
+ sprintf (symlink, "md%d", i);
+ devfs_mk_compat (symlink, 0, DEVFS_FL_TOLERANT, d_namestr, 0, MAJOR_NR, i,
+ S_IFBLK | S_IRUSR | S_IWUSR, 0, 0,
+ &md_fops, NULL);
+ }
+#endif
blk_dev[MD_MAJOR].request_fn = DEVICE_REQUEST;
blk_dev[MD_MAJOR].current_request = NULL;
--
Elie Rosenblum That is not dead which can eternal lie,
http://www.cosanostra.net And with strange aeons even death may die.
Admin / Mercenary / System Programmer - _The Necronomicon_
Reply to: