diff options
author | Karel Zak | 2013-11-19 17:41:28 +0100 |
---|---|---|
committer | Karel Zak | 2013-11-19 17:41:28 +0100 |
commit | a53cc4e0cb30eb55e5ccbd376d1ea803aefa060d (patch) | |
tree | 3da115b2873b666048f6cb9d0a55f0564b43de2f /libmount/src/utils.c | |
parent | fsck: add ext4 to list of filesystems with progress bars in fsck man page (diff) | |
download | kernel-qcow2-util-linux-a53cc4e0cb30eb55e5ccbd376d1ea803aefa060d.tar.gz kernel-qcow2-util-linux-a53cc4e0cb30eb55e5ccbd376d1ea803aefa060d.tar.xz kernel-qcow2-util-linux-a53cc4e0cb30eb55e5ccbd376d1ea803aefa060d.zip |
libmount: add mnt_tag_is_valid()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/utils.c')
-rw-r--r-- | libmount/src/utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libmount/src/utils.c b/libmount/src/utils.c index 0d5a22716..66203d2b4 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -14,6 +14,7 @@ #include <fcntl.h> #include <pwd.h> #include <grp.h> +#include <blkid.h> #include "strutils.h" #include "pathnames.h" @@ -71,6 +72,22 @@ int mnt_valid_tagname(const char *tagname) return 0; } +/** + * mnt_tag_is_valid: + * @tag: NAME=value string + * + * Returns: 1 if the @tag is parsable and tag NAME= is supported by libmount, or 0. + */ +int mnt_tag_is_valid(const char *tag) +{ + char *t = NULL; + int rc = tag && blkid_parse_tag_string(tag, &t, NULL) == 0 + && mnt_valid_tagname(t); + + free(t); + return rc; +} + int mnt_parse_offset(const char *str, size_t len, uintmax_t *res) { char *p; |