blockdev-list: add blockdev_list_full() which allows passing in a pre-determined pair of root_devno/whole_root_devno
This commit is contained in:
@@ -355,7 +355,13 @@ skipped:
|
||||
return BLOCKDEV_LIST_MATCH_SKIPPED;
|
||||
}
|
||||
|
||||
int blockdev_list(BlockDevListFlags flags, BlockDevice **ret_devices, size_t *ret_n_devices) {
|
||||
int blockdev_list_full(
|
||||
BlockDevListFlags flags,
|
||||
dev_t root_devno,
|
||||
dev_t whole_root_devno,
|
||||
BlockDevice **ret_devices,
|
||||
size_t *ret_n_devices) {
|
||||
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
int r;
|
||||
|
||||
@@ -368,8 +374,8 @@ int blockdev_list(BlockDevListFlags flags, BlockDevice **ret_devices, size_t *re
|
||||
size_t n = 0;
|
||||
CLEANUP_ARRAY(l, n, block_device_array_free);
|
||||
|
||||
dev_t root_devno = 0, whole_root_devno = 0;
|
||||
(void) blockdev_list_get_root_devnos(flags, &root_devno, &whole_root_devno);
|
||||
if (root_devno == 0 && whole_root_devno == 0)
|
||||
(void) blockdev_list_get_root_devnos(flags, &root_devno, &whole_root_devno);
|
||||
|
||||
if (sd_device_enumerator_new(&e) < 0)
|
||||
return log_oom();
|
||||
|
||||
@@ -71,4 +71,13 @@ int blockdev_list_one(
|
||||
dev_t whole_root_devno,
|
||||
BlockDevice *ret);
|
||||
|
||||
int blockdev_list(BlockDevListFlags flags, BlockDevice **ret_devices, size_t *ret_n_devices);
|
||||
int blockdev_list_full(
|
||||
BlockDevListFlags flags,
|
||||
dev_t root_devno,
|
||||
dev_t whole_root_devno,
|
||||
BlockDevice **ret_devices,
|
||||
size_t *ret_n_devices);
|
||||
|
||||
static inline int blockdev_list(BlockDevListFlags flags, BlockDevice **ret_devices, size_t *ret_n_devices) {
|
||||
return blockdev_list_full(flags, 0, 0, ret_devices, ret_n_devices);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user