Use udev to create /dev/zvol/[dataset_name] links

This commit allows zvols with names longer than 32 characters, which
fixes issue on https://github.com/behlendorf/zfs/issues/#issue/102.

Changes include:
- use /dev/zd* device names for zvol, where * is the device minor
  (include/sys/fs/zfs.h, module/zfs/zvol.c).
- add BLKZNAME ioctl to get dataset name from userland
  (include/sys/fs/zfs.h, module/zfs/zvol.c, cmd/zvol_id).
- add udev rule to create /dev/zvol/[dataset_name] and the legacy
  /dev/[dataset_name] symlink. For partitions on zvol, it will create
  /dev/zvol/[dataset_name]-part* (etc/udev/rules.d/60-zvol.rules,
  cmd/zvol_id).

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Fajar A. Nugraha
2011-02-22 17:58:44 +07:00
committed by Brian Behlendorf
parent 61da501f9d
commit 4c0d8e50b9
10 changed files with 761 additions and 9 deletions
+6
View File
@@ -707,6 +707,7 @@ typedef struct ddt_histogram {
#define ZVOL_MINOR_BITS 4
#define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1)
#define ZVOL_MINORS (1 << 4)
#define ZVOL_DEV_NAME "zd"
#define ZVOL_PROP_NAME "name"
#define ZVOL_DEFAULT_BLOCKSIZE 8192
@@ -781,6 +782,11 @@ typedef enum zfs_ioc {
ZFS_IOC_EVENTS_CLEAR,
} zfs_ioc_t;
/*
* zvol ioctl to get dataset name
*/
#define BLKZNAME _IO(0x12,125)
/*
* Internal SPA load state. Used by FMA diagnosis engine.
*/