diff options
Diffstat (limited to 'libmount/src/version.c')
-rw-r--r-- | libmount/src/version.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/libmount/src/version.c b/libmount/src/version.c index 327188dbe..e3bc5ca8a 100644 --- a/libmount/src/version.c +++ b/libmount/src/version.c @@ -18,6 +18,15 @@ #include "mountP.h" static const char *lib_version = LIBMOUNT_VERSION; +static const char *lib_features[] = { +#ifdef HAVE_LIBSELINUX + "selinux", +#endif +#ifdef CONFIG_LIBMOUNT_DEBUG + "debug", +#endif + NULL +}; /** * mnt_parse_version_string: @@ -42,7 +51,7 @@ int mnt_parse_version_string(const char *ver_string) /** * mnt_get_library_version: - * @ver_string: return pointer to the static library version string + * @ver_string: return pointer to the static library version string if not NULL * * Returns: release version number. */ @@ -54,15 +63,46 @@ int mnt_get_library_version(const char **ver_string) return mnt_parse_version_string(lib_version); } +/** + * mnt_get_library_features: + * @features: returns pointer to the static array of strings, the array is + * terminated by NULL. + * + * Example: + * + * const char *features; + * + * mnt_get_library_features(&features); + * while (features && *features) + * printf("%s\n", *features++); + * + * Returns: number of items in the features array not including the last NULL, + * or less then zero in case of error + */ +int mnt_get_library_features(const char ***features) +{ + if (!features) + return -EINVAL; + + *features = lib_features; + return ARRAY_SIZE(lib_features) - 1; +} + #ifdef TEST_PROGRAM int test_version(struct libmnt_test *ts, int argc, char *argv[]) { const char *ver; + const char **features; mnt_get_library_version(&ver); printf("Library version: %s\n", ver); printf("Library API version: " LIBMOUNT_VERSION "\n"); + printf("Library features:"); + + mnt_get_library_features(&features); + while (features && *features) + printf(" %s", *features++); if (mnt_get_library_version(NULL) == mnt_parse_version_string(LIBMOUNT_VERSION)) |