Replace BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL

Linux kernel commit v4.18-rc1~37^2~66 introduced FS_IOC_[GS]ETFSLABEL
ioctl constants as generalized copies of BTRFS_IOC_[GS]ET_FSLABEL.

* linux/32/ioctls_inc_align16.h: Replace BTRFS_IOC_[GS]ET_FSLABEL
with FS_IOC_[GS]ETFSLABEL.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* maint/ioctls_sym.sh: Remove BTRFS_IOC_[GS]ET_FSLABEL.
* tests/btrfs.c (FS_IOC_GETFSLABEL, FS_IOC_SETFSLABEL): Add fallback
definitions.
(btrfs_test_label_ioctls, btrfs_test_read_ioctls): Replace
BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL.
This commit is contained in:
Дмитрий Левин 2018-08-12 09:50:33 +00:00
parent 11e24ca2a4
commit 95cf8b343f
7 changed files with 33 additions and 21 deletions

View File

@ -614,7 +614,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_FS_INFO", _IOC_READ, 0x941f, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_DEV_STATS", _IOC_READ|_IOC_WRITE, 0x9434, 0x408 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FEATURES", _IOC_READ, 0x9439, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_SUPPORTED_FEATURES", _IOC_READ, 0x9439, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
@ -636,7 +635,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_SCRUB_PROGRESS", _IOC_READ|_IOC_WRITE, 0x941d, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_SEND", _IOC_WRITE, 0x9426, 0x44 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FEATURES", _IOC_WRITE, 0x9439, 0x30 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_RECEIVED_SUBVOL", _IOC_READ|_IOC_WRITE, 0x9425, 0xc0 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE", _IOC_WRITE, 0x9401, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE_V2", _IOC_WRITE, 0x9417, 0x1000 },
@ -985,10 +983,12 @@
{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
{ "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
{ "linux/fs.h", "FS_IOC_GETFSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
{ "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
{ "linux/fs.h", "FS_IOC_SETFSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
{ "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },

View File

@ -614,7 +614,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_FS_INFO", _IOC_READ, 0x941f, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_DEV_STATS", _IOC_READ|_IOC_WRITE, 0x9434, 0x408 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FEATURES", _IOC_READ, 0x9439, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_SUPPORTED_FEATURES", _IOC_READ, 0x9439, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
@ -636,7 +635,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_SCRUB_PROGRESS", _IOC_READ|_IOC_WRITE, 0x941d, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_SEND", _IOC_WRITE, 0x9426, 0x44 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FEATURES", _IOC_WRITE, 0x9439, 0x30 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_RECEIVED_SUBVOL", _IOC_READ|_IOC_WRITE, 0x9425, 0xc0 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE", _IOC_WRITE, 0x9401, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE_V2", _IOC_WRITE, 0x9417, 0x1000 },
@ -985,10 +983,12 @@
{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
{ "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
{ "linux/fs.h", "FS_IOC_GETFSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
{ "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
{ "linux/fs.h", "FS_IOC_SETFSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
{ "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },

View File

@ -614,7 +614,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_FS_INFO", _IOC_READ, 0x941f, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_DEV_STATS", _IOC_READ|_IOC_WRITE, 0x9434, 0x408 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FEATURES", _IOC_READ, 0x9439, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_SUPPORTED_FEATURES", _IOC_READ, 0x9439, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
@ -636,7 +635,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_SCRUB_PROGRESS", _IOC_READ|_IOC_WRITE, 0x941d, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_SEND", _IOC_WRITE, 0x9426, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FEATURES", _IOC_WRITE, 0x9439, 0x30 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_RECEIVED_SUBVOL", _IOC_READ|_IOC_WRITE, 0x9425, 0xc8 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE", _IOC_WRITE, 0x9401, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE_V2", _IOC_WRITE, 0x9417, 0x1000 },
@ -985,10 +983,12 @@
{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
{ "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
{ "linux/fs.h", "FS_IOC_GETFSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
{ "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
{ "linux/fs.h", "FS_IOC_SETFSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
{ "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },

View File

@ -614,7 +614,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_FS_INFO", _IOC_READ, 0x941f, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_DEV_STATS", _IOC_READ|_IOC_WRITE, 0x9434, 0x408 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FEATURES", _IOC_READ, 0x9439, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_SUPPORTED_FEATURES", _IOC_READ, 0x9439, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
@ -636,7 +635,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_SCRUB_PROGRESS", _IOC_READ|_IOC_WRITE, 0x941d, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_SEND", _IOC_WRITE, 0x9426, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FEATURES", _IOC_WRITE, 0x9439, 0x30 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_RECEIVED_SUBVOL", _IOC_READ|_IOC_WRITE, 0x9425, 0xc8 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE", _IOC_WRITE, 0x9401, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE_V2", _IOC_WRITE, 0x9417, 0x1000 },
@ -985,10 +983,12 @@
{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
{ "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x08 },
{ "linux/fs.h", "FS_IOC_GETFSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x08 },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
{ "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x08 },
{ "linux/fs.h", "FS_IOC_SETFSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x08 },
{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
{ "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },

View File

@ -614,7 +614,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_FS_INFO", _IOC_READ, 0x941f, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_DEV_STATS", _IOC_READ|_IOC_WRITE, 0x9434, 0x408 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FEATURES", _IOC_READ, 0x9439, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_FSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_GET_SUPPORTED_FEATURES", _IOC_READ, 0x9439, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
@ -636,7 +635,6 @@
{ "linux/btrfs.h", "BTRFS_IOC_SCRUB_PROGRESS", _IOC_READ|_IOC_WRITE, 0x941d, 0x400 },
{ "linux/btrfs.h", "BTRFS_IOC_SEND", _IOC_WRITE, 0x9426, 0x48 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FEATURES", _IOC_WRITE, 0x9439, 0x30 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_FSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/btrfs.h", "BTRFS_IOC_SET_RECEIVED_SUBVOL", _IOC_READ|_IOC_WRITE, 0x9425, 0xc8 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE", _IOC_WRITE, 0x9401, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_SNAP_CREATE_V2", _IOC_WRITE, 0x9417, 0x1000 },
@ -985,10 +983,12 @@
{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
{ "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
{ "linux/fs.h", "FS_IOC_GETFSLABEL", _IOC_READ, 0x9431, 0x100 },
{ "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
{ "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
{ "linux/fs.h", "FS_IOC_SETFSLABEL", _IOC_WRITE, 0x9432, 0x100 },
{ "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
{ "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },

View File

@ -393,6 +393,10 @@ s/^\([[:space:]]\+[^),]\+)\),$/\1/' >> "$tmpdir/$f"
# Soft post-preprocess workarounds. Fragile.
case "$f" in
*linux/btrfs.h)
sed -i '/[[:space:]]BTRFS_IOC_[GS]ET_FSLABEL[[:space:]]/d' \
"$tmpdir"/header.out
;;
*linux/kvm.h)
arm_list='KVM_ARM_[A-Z_]+'
ppc_list='KVM_ALLOCATE_RMA|KVM_CREATE_SPAPR_TCE|KVM_CREATE_SPAPR_TCE_64|KVM_PPC_[A-Z1-9_]+'

View File

@ -54,6 +54,14 @@
# define BTRFS_NAME_LEN 255
#endif
#ifndef FS_IOC_GETFSLABEL
# define FS_IOC_GETFSLABEL BTRFS_IOC_GET_FSLABEL
#endif
#ifndef FS_IOC_SETFSLABEL
# define FS_IOC_SETFSLABEL BTRFS_IOC_SET_FSLABEL
#endif
/*
* Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in
* its definition, which isn't exported by the kernel.
@ -1650,32 +1658,32 @@ btrfs_test_quota_rescan_ioctl(void)
/*
* Consumes argument, returns nothing:
* - BTRFS_IOC_SET_FSLABEL
* - FS_IOC_SETFSLABEL
*
* Consumes no argument, returns argument:
* - BTRFS_IOC_GET_FS_LABEL
* - FS_IOC_GETFSLABEL
*/
static void
btrfs_test_label_ioctls(void)
{
char label[BTRFS_LABEL_SIZE] = "btrfs-label";
ioctl(-1, BTRFS_IOC_SET_FSLABEL, NULL);
ioctl(-1, FS_IOC_SETFSLABEL, NULL);
printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n",
ioc(BTRFS_IOC_SET_FSLABEL));
ioc(FS_IOC_SETFSLABEL));
ioctl(-1, BTRFS_IOC_SET_FSLABEL, label);
ioctl(-1, FS_IOC_SETFSLABEL, label);
printf("ioctl(-1, %s, \"%s\") = -1 EBADF (%m)\n",
ioc(BTRFS_IOC_SET_FSLABEL), label);
ioc(FS_IOC_SETFSLABEL), label);
if (write_ok) {
ioctl(btrfs_test_dir_fd, BTRFS_IOC_SET_FSLABEL, label);
ioctl(btrfs_test_dir_fd, FS_IOC_SETFSLABEL, label);
printf("ioctl(%d, %s, \"%s\") = 0\n",
btrfs_test_dir_fd, ioc(BTRFS_IOC_SET_FSLABEL), label);
btrfs_test_dir_fd, ioc(FS_IOC_SETFSLABEL), label);
ioctl(btrfs_test_dir_fd, BTRFS_IOC_GET_FSLABEL, label);
ioctl(btrfs_test_dir_fd, FS_IOC_GETFSLABEL, label);
printf("ioctl(%d, %s, \"%s\") = 0\n",
btrfs_test_dir_fd, ioc(BTRFS_IOC_GET_FSLABEL), label);
btrfs_test_dir_fd, ioc(FS_IOC_GETFSLABEL), label);
}
}
@ -2025,7 +2033,7 @@ btrfs_test_read_ioctls(void)
XLAT(BTRFS_IOC_BALANCE_PROGRESS),
XLAT(BTRFS_IOC_FS_INFO),
XLAT(BTRFS_IOC_GET_FEATURES),
XLAT(BTRFS_IOC_GET_FSLABEL),
XLAT(FS_IOC_GETFSLABEL),
XLAT(BTRFS_IOC_GET_SUPPORTED_FEATURES),
XLAT(BTRFS_IOC_QGROUP_LIMIT),
XLAT(BTRFS_IOC_QUOTA_RESCAN_STATUS),