lkml.org 
[lkml]   [2006]   [Jun]   [19]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 19 Jun 2006 01:55:37 -0400
From"Will Dyson" <>
SubjectRe: [GIT PATCH] Remove devfs from 2.6.17
On 6/18/06, H. Peter Anvin <hpa@zytor.com> wrote:
> Joshua Hudson wrote:
> > With udev, you could mknod it yourself (in your application), then open it.
> > That would fire up the auto-module-load.
>
> Sure, but it would be even better if pointing udev to a set of modules
> (or perhaps a file generated by depmod) and have it do it all automatically.

Providing the information about what devices a virtual driver will
register when loaded seems like a good idea.

Something like the following occurs to me. But it doesn't deal with
loop's ability to register a different number of minors based on a
module parameter. Not really sure what to do about that.

Going in this direction is also a further impediment to dynamicly
assigned device numbers.

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 9c3b94e..b933f3f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1205,6 +1205,18 @@ static struct block_device_operations lo
 	.ioctl =	lo_ioctl,
 };

+static struct virtual_device_table loop_virt_tbl= {
+	{LOOP_MAJOR, 0, 1},
+	{LOOP_MAJOR, 1, 1},
+	{LOOP_MAJOR, 2, 1},
+	{LOOP_MAJOR, 3, 1},
+	{LOOP_MAJOR, 4, 1},
+	{LOOP_MAJOR, 5, 1},
+	{LOOP_MAJOR, 6, 1},
+	{LOOP_MAJOR, 7, 1},
+	{}
+};
+
 /*
  * And now the modules code and kernel interface.
  */
@@ -1212,6 +1224,7 @@ module_param(max_loop, int, 0);
 MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-256)");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
+MODULE_DEVICE_TABLE (virtual, loop_virt_tbl);

 int loop_register_transfer(struct loop_func_table *funcs)
 {
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f697770..f4a21d0 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -297,4 +297,16 @@ struct input_device_id {
 	kernel_ulong_t driver_info;
 };

+/*
+ * Declare the intention of a driver to register a virtual
+ * device upon loading.
+ */
+struct virtual_device_id {
+	__u32 major;
+	__u32 minor;
+	__u8 type; /* 0 for char, 1 for block */
+
+	kernel_ulong_t driver_info;
+}
+
 #endif /* LINUX_MOD_DEVICETABLE_H */

-- 
Will Dyson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-19 07:58    [from the cache]
©2003-2008