This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit 78c98e69e5b3473000bf4448ab37b1c181669ffc Author: Andreas Gruenbacher agruenba@redhat.com AuthorDate: Mon Mar 25 21:55:19 2019 +0000
libgfs2: lgfs2_field_str: Allow to decode bitmasks
In lgfs2_field_str, decode bitmasks into their symbolic form when not creating a hex dump (e.g., "gfs2_edit -x"). --- gfs2/libgfs2/meta.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c index c151148..486e0ea 100644 --- a/gfs2/libgfs2/meta.c +++ b/gfs2/libgfs2/meta.c @@ -970,6 +970,31 @@ int lgfs2_field_str(char *str, const size_t size, const char *blk, const struct snprintf(str, size, "%"PRIx64, value); goto out; } + if (field->flags & LGFS2_MFF_MASK) { + char *s = str, *end = str + size; + unsigned n; + + for (n = 0; n < field->nsyms; n++) { + const struct lgfs2_symbolic *sym = &field->symtab[n]; + + if (!(value & sym->key)) + continue; + if (s != str && s < end) + *s++ = '/'; + if (s < end) { + const char *v = sym->value + sym->prefix; + size_t len = strlen(v); + + if (len > end - s) + len = end - s; + memcpy(s, v, len); + s += len; + } + } + if (s < end) + *s = '\0'; + goto out; + } snprintf(str, size, "%"PRIu64, value); } out: