util: add generic block device listener helper

Various of our tools operate on block devices, and it's not always
obvious to know which block devices are actually appropriate for use.
Hence, let's add a helper that allows to list block devices, and
supports some limited filtering.
This commit is contained in:
Lennart Poettering
2024-07-01 16:39:40 +02:00
parent bff5d2fd5a
commit 68ff31fa0a
3 changed files with 91 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
typedef enum BlockDevListFlags {
BLOCKDEV_LIST_SHOW_SYMLINKS = 1 << 0,
BLOCKDEV_LIST_REQUIRE_PARTITION_SCANNING = 1 << 1,
BLOCKDEV_LIST_IGNORE_ZRAM = 1 << 2,
BLOCKDEV_LIST_REQUIRE_LUKS = 1 << 3,
} BlockDevListFlags;
int blockdev_list(BlockDevListFlags flags);