Skip to contentSkip to conversation

cuse: creat 'dead' device node for on-demand module loading

PATCH Superseded Tom Gundersen 2 participants 3 messages Sep 9, 2013 – Sep 20, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cuse: creat 'dead' device node for on-demand module loading

This allows udev (or more recently systemd-tmpfiles) to create /dev/cuse on boot, in the same way as /dev/fuse is currently created, and the corresponding module to be loaded on first access.

The corresponding functionalty was introduced for fuse in commit 578454f.

Cc Kay Sievers <[email protected]>
Cc Miklos Szeredi <[email protected]>
---
 fs/fuse/cuse.c             | 5 ++++-
 include/linux/miscdevice.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
fs/fuse/cuse.c +4 -1
index adbfd66..24da581 100644
@@ -589,11 +589,14 @@ static struct attribute *cuse_class_dev_attrs[] = {
 ATTRIBUTE_GROUPS(cuse_class_dev);
 
 static struct miscdevice cuse_miscdev = {
-	.minor		= MISC_DYNAMIC_MINOR,
+	.minor		= CUSE_MINOR,
 	.name		= "cuse",
 	.fops		= &cuse_channel_fops,
 };
 
+MODULE_ALIAS_MISCDEV(CUSE_MINOR);
+MODULE_ALIAS("devname:cuse");
+
 static int __init cuse_init(void)
 {
 	int i, rc;
include/linux/miscdevice.h +1 -0
index cb35835..65c8619 100644
@@ -39,6 +39,7 @@
 #define MISC_MCELOG_MINOR	227
 #define HPET_MINOR		228
 #define FUSE_MINOR		229
+#define CUSE_MINOR		230
 #define KVM_MINOR		232
 #define BTRFS_MINOR		234
 #define AUTOFS_MINOR		235
Signature · 1 line
1.8.4
#1 lore raw

PATCH v2 1/1 cuse: creat 'dead' device node for on-demand module loading

This allows udev (or more recently systemd-tmpfiles) to create /dev/cuse on boot, in the same way as /dev/fuse is currently created, and the corresponding module to be loaded on first access.

The corresponding functionalty was introduced for fuse in commit 578454f.

Cc Kay Sievers <[email protected]>
Cc Miklos Szeredi <[email protected]>

---

v2: also update Documentation/devices.txt (and pick a minor that is not taken)

 Documentation/devices.txt  | 1 +
 fs/fuse/cuse.c             | 5 ++++-
 include/linux/miscdevice.h | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)
Documentation/devices.txt +1 -0
index 23721d3..80b7241 100644
@@ -414,6 +414,7 @@ Your cooperation is appreciated.
 		200 = /dev/net/tun	TAP/TUN network device
 		201 = /dev/button/gulpb	Transmeta GULP-B buttons
 		202 = /dev/emd/ctl	Enhanced Metadisk RAID (EMD) control
+		203 = /dev/cuse		Cuse (character device in user-space)
 		204 = /dev/video/em8300		EM8300 DVD decoder control
 		205 = /dev/video/em8300_mv	EM8300 DVD decoder video
 		206 = /dev/video/em8300_ma	EM8300 DVD decoder audio
fs/fuse/cuse.c +4 -1
index adbfd66..24da581 100644
@@ -589,11 +589,14 @@ static struct attribute *cuse_class_dev_attrs[] = {
 ATTRIBUTE_GROUPS(cuse_class_dev);
 
 static struct miscdevice cuse_miscdev = {
-	.minor		= MISC_DYNAMIC_MINOR,
+	.minor		= CUSE_MINOR,
 	.name		= "cuse",
 	.fops		= &cuse_channel_fops,
 };
 
+MODULE_ALIAS_MISCDEV(CUSE_MINOR);
+MODULE_ALIAS("devname:cuse");
+
 static int __init cuse_init(void)
 {
 	int i, rc;
include/linux/miscdevice.h +1 -0
index cb35835..f7eaf2d 100644
@@ -31,6 +31,7 @@
 #define I2O_MINOR		166
 #define MICROCODE_MINOR		184
 #define TUN_MINOR		200
+#define CUSE_MINOR		203
 #define MWAVE_MINOR		219	/* ACP/Mwave Modem */
 #define MPT_MINOR		220
 #define MPT2SAS_MINOR		221
Signature · 1 line
1.8.4
maintainer
#2 lore raw
Quoted 3 lines · Tom Gundersen

This allows udev (or more recently systemd-tmpfiles) to create /dev/cuse on boot, in the same way as /dev/fuse is currently created, and the corresponding module to be loaded on first access.

Committed to for-next.

Thanks,
Miklos

Quoted 62 lines

The corresponding functionalty was introduced for fuse in commit 578454f.

Cc Kay Sievers <[email protected]>
Cc Miklos Szeredi <[email protected]>

---

v2: also update Documentation/devices.txt (and pick a minor that is not taken)

 Documentation/devices.txt  | 1 +
 fs/fuse/cuse.c             | 5 ++++-
 include/linux/miscdevice.h | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)
Documentation/devices.txt +1 -0
index 23721d3..80b7241 100644
@@ -414,6 +414,7 @@ Your cooperation is appreciated.
                200 = /dev/net/tun      TAP/TUN network device
                201 = /dev/button/gulpb Transmeta GULP-B buttons
                202 = /dev/emd/ctl      Enhanced Metadisk RAID (EMD) control
+               203 = /dev/cuse         Cuse (character device in user-space)
                204 = /dev/video/em8300         EM8300 DVD decoder control
                205 = /dev/video/em8300_mv      EM8300 DVD decoder video
                206 = /dev/video/em8300_ma      EM8300 DVD decoder audio
fs/fuse/cuse.c +4 -1
index adbfd66..24da581 100644
@@ -589,11 +589,14 @@ static struct attribute *cuse_class_dev_attrs[] = {
 ATTRIBUTE_GROUPS(cuse_class_dev);
 
 static struct miscdevice cuse_miscdev = {
-       .minor          = MISC_DYNAMIC_MINOR,
+       .minor          = CUSE_MINOR,
        .name           = "cuse",
        .fops           = &cuse_channel_fops,
 };
 
+MODULE_ALIAS_MISCDEV(CUSE_MINOR);
+MODULE_ALIAS("devname:cuse");
+
 static int __init cuse_init(void)
 {
        int i, rc;
include/linux/miscdevice.h +1 -1
index cb35835..f7eaf2d 100644
@@ -31,6 +31,7 @@
 #define I2O_MINOR              166
 #define MICROCODE_MINOR                184
 #define TUN_MINOR              200
+#define CUSE_MINOR             203
 #define MWAVE_MINOR            219     /* ACP/Mwave Modem */
 #define MPT_MINOR              220
 #define MPT2SAS_MINOR          221
--

1.8.4