Re: add devname module aliases to allow module on-demandauto-loading

From: Ian Kent
Date: Fri May 21 2010 - 07:12:14 EST


On Thu, 2010-05-20 at 18:07 +0200, Kay Sievers wrote:
> From: Kay Sievers <kay.sievers@xxxxxxxx>
> Subject: add devname module aliases to allow module on-demand auto-loading
>
> This adds:
> alias: devname:<name>
> to some common kernel modules, which will allow the on-demand loading
> of the kernel module when the device node is accessed.
>

snip ...

> --- a/fs/autofs4/dev-ioctl.c
> +++ b/fs/autofs4/dev-ioctl.c
> @@ -736,11 +736,14 @@ static const struct file_operations _dev
> };
>
> static struct miscdevice _autofs_dev_ioctl_misc = {
> - .minor = MISC_DYNAMIC_MINOR,
> + .minor = AUTOFS_MINOR,
> .name = AUTOFS_DEVICE_NAME,
> .fops = &_dev_ioctl_fops
> };
>
> +MODULE_ALIAS_MISCDEV(BTRFS_MINOR);

Is this a typo or am I missing something?

Shouldn't it be:
+MODULE_ALIAS_MISCDEV(AUTOFS_MINOR);

> +MODULE_ALIAS("devname:autofs");
> +
> /* Register/deregister misc character device */
> int autofs_dev_ioctl_init(void)
> {
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -832,11 +832,14 @@ static const struct file_operations btrf
> };
>
> static struct miscdevice btrfs_misc = {
> - .minor = MISC_DYNAMIC_MINOR,
> + .minor = BTRFS_MINOR,
> .name = "btrfs-control",
> .fops = &btrfs_ctl_fops
> };
>
> +MODULE_ALIAS_MISCDEV(BTRFS_MINOR);
> +MODULE_ALIAS("devname:btrfs-control");
> +
> static int btrfs_interface_init(void)
> {
> return misc_register(&btrfs_misc);
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -18,6 +18,7 @@
> #include <linux/slab.h>
>
> MODULE_ALIAS_MISCDEV(FUSE_MINOR);
> +MODULE_ALIAS("devname:fuse");
>
> static struct kmem_cache *fuse_req_cachep;
>
> --- a/include/linux/miscdevice.h
> +++ b/include/linux/miscdevice.h
> @@ -31,6 +31,9 @@
> #define FUSE_MINOR 229
> #define KVM_MINOR 232
> #define VHOST_NET_MINOR 233
> +#define BTRFS_MINOR 234
> +#define MAPPER_CTRL_MINOR 235
> +#define AUTOFS_MINOR 236
> #define MISC_DYNAMIC_MINOR 255
>
> struct device;
>
>


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