diff --git a/btrfs.c b/btrfs.c index 3be87542..d6f441e8 100644 --- a/btrfs.c +++ b/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");