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.
This commit is contained in:
Lennart Poettering
2025-10-20 17:58:37 +02:00
parent b09ea23978
commit a251345cf5
2 changed files with 7 additions and 7 deletions

View File

@@ -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);

View File

@@ -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);