mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-14 07:44:29 +08:00
btrfs-progs: print optional features in btrfs version
There's a number of optionally built features, print the list on the 2nd line of 'btrfs version'. The format is same as for e.g. systemd: $ btrfs version btrfs-progs v6.9.2 +EXPERIMENTAL -INJECT -STATIC +LZO +ZSTD +UDEV +FSVERITY +ZONED CRYPTO=builtin Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
84841dc8b4
commit
2c3a2f1437
55
btrfs.c
55
btrfs.c
@ -221,7 +221,62 @@ static const char * const cmd_version_usage[] = {
|
||||
|
||||
static int cmd_version(const struct cmd_struct *unused, int argc, char **argv)
|
||||
{
|
||||
static const char *features[] = {
|
||||
#if EXPERIMENTAL
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"EXPERIMENTAL",
|
||||
#ifdef INJECT
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"INJECT",
|
||||
#ifdef STATIC_BUILD
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"STATIC",
|
||||
#if defined(COMPRESSION_LZO) && COMPRESSION_LZO == 1
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"LZO",
|
||||
#if defined(COMPRESSION_ZSTD) && COMPRESSION_ZSTD == 1
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"ZSTD",
|
||||
#if defined(HAVE_LIBUDEV) && HAVE_LIBUDEV == 1
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"UDEV",
|
||||
#if defined(HAVE_LINUX_FSVERITY_H) && HAVE_LINUX_FSVERITY_H == 1
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"FSVERITY",
|
||||
#if defined(BTRFS_ZONED) && BTRFS_ZONED == 1
|
||||
"+"
|
||||
#else
|
||||
"-"
|
||||
#endif
|
||||
"ZONED",
|
||||
"CRYPTO=" CRYPTOPROVIDER,
|
||||
};
|
||||
|
||||
printf("%s\n", PACKAGE_STRING);
|
||||
for (int i = 0; i < ARRAY_SIZE(features); i++)
|
||||
printf("%s%s", (i == 0 ? "" : " "), features[i]);
|
||||
putchar('\n');
|
||||
return 0;
|
||||
}
|
||||
static DEFINE_SIMPLE_COMMAND(version, "version");
|
||||
|
Loading…
Reference in New Issue
Block a user