summaryrefslogtreecommitdiff
path: root/bcache-super-show.c
diff options
context:
space:
mode:
Diffstat (limited to 'bcache-super-show.c')
-rw-r--r--bcache-super-show.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/bcache-super-show.c b/bcache-super-show.c
index c00d22e..26cc40e 100644
--- a/bcache-super-show.c
+++ b/bcache-super-show.c
@@ -4,6 +4,7 @@
* GPLv2
*/
+
#define _FILE_OFFSET_BITS 64
#define __USE_FILE_OFFSET64
#define _XOPEN_SOURCE 500
@@ -32,6 +33,29 @@ static void usage()
}
+static bool accepted_char(char c)
+{
+ if ('0' <= c && c <= '9')
+ return true;
+ if ('A' <= c && c <= 'Z')
+ return true;
+ if ('a' <= c && c <= 'z')
+ return true;
+ if (strchr(".-_", c))
+ return true;
+ return false;
+}
+
+static void print_encode(char* in)
+{
+ for (char* pos = in; *pos; pos++)
+ if (accepted_char(*pos))
+ putchar(*pos);
+ else
+ printf("%%%x", *pos);
+}
+
+
int main(int argc, char **argv)
{
bool force_csum = false;
@@ -123,6 +147,16 @@ int main(int argc, char **argv)
putchar('\n');
+ char label[SB_LABEL_SIZE + 1];
+ strncpy(label, (char*)sb.label, SB_LABEL_SIZE);
+ label[SB_LABEL_SIZE] = '\0';
+ printf("dev.label\t\t");
+ if (*label)
+ print_encode(label);
+ else
+ printf("(empty)");
+ putchar('\n');
+
uuid_unparse(sb.uuid, uuid);
printf("dev.uuid\t\t%s\n", uuid);