From a251345cf537ff0229fa3d4921e6ffd0ae7ed8cd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 20 Oct 2025 17:58:37 +0200 Subject: [PATCH] blockdev-util: rename BlockDeviceLookupFlag to plural This is a flags type and a flag function argument, let's name it in plural, because it allows many flags combinations. Internally, the implementation already used plural, but let's fix the prototypes too. --- src/shared/blockdev-util.c | 6 +++--- src/shared/blockdev-util.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/shared/blockdev-util.c b/src/shared/blockdev-util.c index 42a5c08b729..7641f17aec9 100644 --- a/src/shared/blockdev-util.c +++ b/src/shared/blockdev-util.c @@ -24,7 +24,7 @@ #include "path-util.h" #include "string-util.h" -static int fd_get_devnum(int fd, BlockDeviceLookupFlag flags, dev_t *ret) { +static int fd_get_devnum(int fd, BlockDeviceLookupFlags flags, dev_t *ret) { struct stat st; dev_t devnum; int r; @@ -148,7 +148,7 @@ int block_device_get_originating(sd_device *dev, sd_device **ret) { return 0; } -int block_device_new_from_fd(int fd, BlockDeviceLookupFlag flags, sd_device **ret) { +int block_device_new_from_fd(int fd, BlockDeviceLookupFlags flags, sd_device **ret) { _cleanup_(sd_device_unrefp) sd_device *dev = NULL; dev_t devnum; int r; @@ -194,7 +194,7 @@ int block_device_new_from_fd(int fd, BlockDeviceLookupFlag flags, sd_device **re return 0; } -int block_device_new_from_path(const char *path, BlockDeviceLookupFlag flags, sd_device **ret) { +int block_device_new_from_path(const char *path, BlockDeviceLookupFlags flags, sd_device **ret) { _cleanup_close_ int fd = -EBADF; assert(path); diff --git a/src/shared/blockdev-util.h b/src/shared/blockdev-util.h index 87b40054da9..3c3153bacce 100644 --- a/src/shared/blockdev-util.h +++ b/src/shared/blockdev-util.h @@ -11,16 +11,16 @@ #define xsprintf_sys_block_path(buf, suffix, devno) \ xsprintf(buf, "/sys/dev/block/%u:%u%s", major(devno), minor(devno), suffix ?: "") -typedef enum BlockDeviceLookupFlag { +typedef enum BlockDeviceLookupFlags { BLOCK_DEVICE_LOOKUP_WHOLE_DISK = 1 << 0, /* whole block device, e.g. sda, nvme0n1, or loop0. */ BLOCK_DEVICE_LOOKUP_BACKING = 1 << 1, /* fd may be regular file or directory on file system, in * which case backing block device is determined. */ BLOCK_DEVICE_LOOKUP_ORIGINATING = 1 << 2, /* Try to find the underlying layer device for stacked * block device, e.g. LUKS-style DM. */ -} BlockDeviceLookupFlag; +} BlockDeviceLookupFlags; -int block_device_new_from_fd(int fd, BlockDeviceLookupFlag flag, sd_device **ret); -int block_device_new_from_path(const char *path, BlockDeviceLookupFlag flag, sd_device **ret); +int block_device_new_from_fd(int fd, BlockDeviceLookupFlags flags, sd_device **ret); +int block_device_new_from_path(const char *path, BlockDeviceLookupFlags flags, sd_device **ret); int block_device_is_whole_disk(sd_device *dev); int block_device_get_whole_disk(sd_device *dev, sd_device **ret); -- 2.47.3