From: Yang Xu Date: Thu, 1 Feb 2024 04:23:48 +0000 (-0500) Subject: t_snapshot_deleted_subvolume: add check for BTRFS_IOC_SNAP_DESTROY_V2 X-Git-Tag: v2024.02.09~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6b0efdc02753e3313949aa43cf340707ee41e53f;p=xfstests-dev.git t_snapshot_deleted_subvolume: add check for BTRFS_IOC_SNAP_DESTROY_V2 On some platform, struct btrfs_ioctl_vol_args_v2 is defined, but the macros BTRFS_IOC_SNAP_DESTROY_V2 is not defined. This will cause compile error. Add check for BTRFS_IOC_SNAP_DESTROY_V2 to solve this problem. BTRFS_IOC_SNAP_CREATE_V2 and BTRFS_IOC_SUBVOL_CREATE_V2 were introduced together with struct btrfs_ioctl_vol_args_v2 by the commit 55e301fd57a6 ("Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h"). So there is no need to check them. Signed-off-by: Yang Xu Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/configure.ac b/configure.ac index 1a936997..4d72717c 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,7 @@ AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[ #include #include ]]) +AC_CHECK_DECLS([BTRFS_IOC_SNAP_DESTROY_V2],,,[#include ]) AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_FILES([include/builddefs]) diff --git a/src/t_snapshot_deleted_subvolume.c b/src/t_snapshot_deleted_subvolume.c index c3adb1c4..402c0515 100644 --- a/src/t_snapshot_deleted_subvolume.c +++ b/src/t_snapshot_deleted_subvolume.c @@ -20,11 +20,6 @@ #define BTRFS_IOCTL_MAGIC 0x94 #endif -#ifndef BTRFS_IOC_SNAP_DESTROY_V2 -#define BTRFS_IOC_SNAP_DESTROY_V2 \ - _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2) -#endif - #ifndef BTRFS_IOC_SNAP_CREATE_V2 #define BTRFS_IOC_SNAP_CREATE_V2 \ _IOW(BTRFS_IOCTL_MAGIC, 23, struct btrfs_ioctl_vol_args_v2) @@ -58,6 +53,11 @@ struct btrfs_ioctl_vol_args_v2 { }; #endif +#if !HAVE_DECL_BTRFS_IOC_SNAP_DESTROY_V2 +#define BTRFS_IOC_SNAP_DESTROY_V2 \ + _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2) +#endif + int main(int argc, char **argv) { if (argc != 2) {