Skip to content

Commit 7e507eb

Browse files
prajnohakergon
authored andcommitted
dm: allow autoloading of dm mod
Add devname:mapper/control and MAPPER_CTRL_MINOR module alias to support dm-mod module autoloading. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Peter Rajnoha <prajnoha@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent 57cba5d commit 7e507eb

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎Documentation/devices.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ Your cooperation is appreciated.
445445
233 = /dev/kmview View-OS A process with a view
446446
234 = /dev/btrfs-control Btrfs control device
447447
235 = /dev/autofs Autofs control device
448+
236 = /dev/mapper/control Device-Mapper control device
448449
240-254 Reserved for local use
449450
255 Reserved for MISC_DYNAMIC_MINOR
450451

‎drivers/md/dm-ioctl.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,12 +1599,15 @@ static const struct file_operations _ctl_fops = {
15991599
};
16001600

16011601
static struct miscdevice _dm_misc = {
1602-
.minor = MISC_DYNAMIC_MINOR,
1602+
.minor = MAPPER_CTRL_MINOR,
16031603
.name = DM_NAME,
1604-
.nodename = "mapper/control",
1604+
.nodename = DM_DIR "/" DM_CONTROL_NODE,
16051605
.fops = &_ctl_fops
16061606
};
16071607

1608+
MODULE_ALIAS_MISCDEV(MAPPER_CTRL_MINOR);
1609+
MODULE_ALIAS("devname:" DM_DIR "/" DM_CONTROL_NODE);
1610+
16081611
/*
16091612
* Create misc character device and link to DM_DIR/control.
16101613
*/

‎include/linux/dm-ioctl.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/types.h>
1212

1313
#define DM_DIR "mapper" /* Slashes not supported */
14+
#define DM_CONTROL_NODE "control"
1415
#define DM_MAX_TYPE_NAME 16
1516
#define DM_NAME_LEN 128
1617
#define DM_UUID_LEN 129

‎include/linux/miscdevice.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define KVM_MINOR 232
3939
#define BTRFS_MINOR 234
4040
#define AUTOFS_MINOR 235
41+
#define MAPPER_CTRL_MINOR 236
4142
#define MISC_DYNAMIC_MINOR 255
4243

4344
struct device;

0 commit comments

Comments
 (0)