From 1601cd0d4fda9665817c9ca6d27ac648d8712ed5 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 31 Jan 2024 23:50:33 +0100 Subject: [PATCH] btrfs-progs: convert defined constants to enums Signed-off-by: David Sterba --- common/device-scan.h | 18 +++++++++++------- common/device-utils.h | 10 ++++++---- convert/source-fs.h | 14 ++++++++------ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/common/device-scan.h b/common/device-scan.h index 8a875832..f7278045 100644 --- a/common/device-scan.h +++ b/common/device-scan.h @@ -22,16 +22,20 @@ #include "kernel-lib/bitops.h" #include "kernel-shared/uapi/btrfs.h" -#define BTRFS_SCAN_MOUNTED (1ULL << 0) -#define BTRFS_SCAN_LBLKID (1ULL << 1) +enum { + BTRFS_SCAN_MOUNTED = (1ULL << 0), + BTRFS_SCAN_LBLKID = (1ULL << 1) +}; #define BTRFS_UPDATE_KERNEL 1 -#define BTRFS_ARG_UNKNOWN 0 -#define BTRFS_ARG_MNTPOINT 1 -#define BTRFS_ARG_UUID 2 -#define BTRFS_ARG_BLKDEV 3 -#define BTRFS_ARG_REG 4 +enum { + BTRFS_ARG_UNKNOWN, + BTRFS_ARG_MNTPOINT, + BTRFS_ARG_UUID, + BTRFS_ARG_BLKDEV, + BTRFS_ARG_REG, +}; #define SEEN_FSID_HASH_SIZE 256 diff --git a/common/device-utils.h b/common/device-utils.h index 853d17b5..97dceb85 100644 --- a/common/device-utils.h +++ b/common/device-utils.h @@ -28,10 +28,12 @@ struct stat; /* * Options for btrfs_prepare_device */ -#define PREP_DEVICE_ZERO_END (1U << 0) -#define PREP_DEVICE_DISCARD (1U << 1) -#define PREP_DEVICE_VERBOSE (1U << 2) -#define PREP_DEVICE_ZONED (1U << 3) +enum { + PREP_DEVICE_ZERO_END = (1U << 0), + PREP_DEVICE_DISCARD = (1U << 1), + PREP_DEVICE_VERBOSE = (1U << 2), + PREP_DEVICE_ZONED = (1U << 3), +}; /* Placeholder to denote no results for the zone_unusable sysfs value */ #define DEVICE_ZONE_UNUSABLE_UNKNOWN ((u64)-1) diff --git a/convert/source-fs.h b/convert/source-fs.h index 3e0c270b..b26e1842 100644 --- a/convert/source-fs.h +++ b/convert/source-fs.h @@ -41,12 +41,14 @@ struct task_ctx { #define SOURCE_FS_NAME_LEN (16) -#define CONVERT_FLAG_DATACSUM (1U << 0) -#define CONVERT_FLAG_INLINE_DATA (1U << 1) -#define CONVERT_FLAG_XATTR (1U << 2) -#define CONVERT_FLAG_COPY_LABEL (1U << 3) -#define CONVERT_FLAG_SET_LABEL (1U << 4) -#define CONVERT_FLAG_COPY_FSID (1U << 5) +enum { + CONVERT_FLAG_DATACSUM = (1U << 0), + CONVERT_FLAG_INLINE_DATA = (1U << 1), + CONVERT_FLAG_XATTR = (1U << 2), + CONVERT_FLAG_COPY_LABEL = (1U << 3), + CONVERT_FLAG_SET_LABEL = (1U << 4), + CONVERT_FLAG_COPY_FSID = (1U << 5), +}; /* 23.2.5 acl_tag_t values */