mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
Sync /dev/zfs ioctl ordering
In order to minimize any future disruption caused by the addition and removal /dev/zfs ioctls this patch makes the following changes. 1) Sync ZoL's ioctl ordering such that it matches Illumos. For historic reasons the ZFS_IOC_DESTROY_SNAPS and ZFS_IOC_POOL_REGUID ioctls were out of order. 2) Move Linux and FreeBSD specific ioctls in to their own reserved ranges. This allows us to preserve the existing ordering when new ioctls are added by either Illumos or FreeBSD. When an ioctl is no longer needed it should be retired in place. This change alters the ZFS user/kernel ABI so make sure you rebuild both your user and kernel modules. However, it should allow for a much stabler interface going forward. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ned Bass <bass6@llnl.gov> Closes #1973
This commit is contained in:
parent
ba6a24026c
commit
2e0358cbca
@ -768,6 +768,9 @@ typedef struct ddt_histogram {
|
|||||||
* /dev/zfs ioctl numbers.
|
* /dev/zfs ioctl numbers.
|
||||||
*/
|
*/
|
||||||
typedef enum zfs_ioc {
|
typedef enum zfs_ioc {
|
||||||
|
/*
|
||||||
|
* Illumos - 69/128 numbers reserved.
|
||||||
|
*/
|
||||||
ZFS_IOC_FIRST = ('Z' << 8),
|
ZFS_IOC_FIRST = ('Z' << 8),
|
||||||
ZFS_IOC = ZFS_IOC_FIRST,
|
ZFS_IOC = ZFS_IOC_FIRST,
|
||||||
ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
|
ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
|
||||||
@ -805,7 +808,6 @@ typedef enum zfs_ioc {
|
|||||||
ZFS_IOC_ERROR_LOG,
|
ZFS_IOC_ERROR_LOG,
|
||||||
ZFS_IOC_CLEAR,
|
ZFS_IOC_CLEAR,
|
||||||
ZFS_IOC_PROMOTE,
|
ZFS_IOC_PROMOTE,
|
||||||
ZFS_IOC_DESTROY_SNAPS,
|
|
||||||
ZFS_IOC_SNAPSHOT,
|
ZFS_IOC_SNAPSHOT,
|
||||||
ZFS_IOC_DSOBJ_TO_DSNAME,
|
ZFS_IOC_DSOBJ_TO_DSNAME,
|
||||||
ZFS_IOC_OBJ_TO_PATH,
|
ZFS_IOC_OBJ_TO_PATH,
|
||||||
@ -828,17 +830,29 @@ typedef enum zfs_ioc {
|
|||||||
ZFS_IOC_DIFF,
|
ZFS_IOC_DIFF,
|
||||||
ZFS_IOC_TMP_SNAPSHOT,
|
ZFS_IOC_TMP_SNAPSHOT,
|
||||||
ZFS_IOC_OBJ_TO_STATS,
|
ZFS_IOC_OBJ_TO_STATS,
|
||||||
ZFS_IOC_EVENTS_NEXT,
|
|
||||||
ZFS_IOC_EVENTS_CLEAR,
|
|
||||||
ZFS_IOC_POOL_REGUID,
|
|
||||||
ZFS_IOC_SPACE_WRITTEN,
|
ZFS_IOC_SPACE_WRITTEN,
|
||||||
ZFS_IOC_SPACE_SNAPS,
|
ZFS_IOC_SPACE_SNAPS,
|
||||||
|
ZFS_IOC_DESTROY_SNAPS,
|
||||||
|
ZFS_IOC_POOL_REGUID,
|
||||||
ZFS_IOC_POOL_REOPEN,
|
ZFS_IOC_POOL_REOPEN,
|
||||||
ZFS_IOC_SEND_PROGRESS,
|
ZFS_IOC_SEND_PROGRESS,
|
||||||
ZFS_IOC_LOG_HISTORY,
|
ZFS_IOC_LOG_HISTORY,
|
||||||
ZFS_IOC_SEND_NEW,
|
ZFS_IOC_SEND_NEW,
|
||||||
ZFS_IOC_SEND_SPACE,
|
ZFS_IOC_SEND_SPACE,
|
||||||
ZFS_IOC_CLONE,
|
ZFS_IOC_CLONE,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Linux - 3/64 numbers reserved.
|
||||||
|
*/
|
||||||
|
ZFS_IOC_LINUX = ('Z' << 8) + 0x80,
|
||||||
|
ZFS_IOC_EVENTS_NEXT,
|
||||||
|
ZFS_IOC_EVENTS_CLEAR,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FreeBSD - 1/64 numbers reserved.
|
||||||
|
*/
|
||||||
|
ZFS_IOC_FREEBSD = ('Z' << 8) + 0xC0,
|
||||||
|
|
||||||
ZFS_IOC_LAST
|
ZFS_IOC_LAST
|
||||||
} zfs_ioc_t;
|
} zfs_ioc_t;
|
||||||
|
|
||||||
|
@ -5565,6 +5565,13 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
|
|||||||
return (-SET_ERROR(EINVAL));
|
return (-SET_ERROR(EINVAL));
|
||||||
vec = &zfs_ioc_vec[vecnum];
|
vec = &zfs_ioc_vec[vecnum];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The registered ioctl list may be sparse, verify that either
|
||||||
|
* a normal or legacy handler are registered.
|
||||||
|
*/
|
||||||
|
if (vec->zvec_func == NULL && vec->zvec_legacy_func == NULL)
|
||||||
|
return (-SET_ERROR(EINVAL));
|
||||||
|
|
||||||
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP | KM_NODEBUG);
|
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP | KM_NODEBUG);
|
||||||
saved_poolname = kmem_alloc(MAXNAMELEN, KM_SLEEP);
|
saved_poolname = kmem_alloc(MAXNAMELEN, KM_SLEEP);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user