diff options
author | NeilBrown <neilb@suse.de> | 2012-10-04 16:34:20 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-04 16:34:20 +1000 |
commit | 7103b9b88d8c27989e17c80d7296eda97370dc1e (patch) | |
tree | 225ef68ca743ca2bdf6e70a7581ac82aebfa29db /super1.c | |
parent | 9eafa1de73d1bd0b2ac0275d1389824825647df7 (diff) |
Handles spaces in array names better.
1/ When printing the "name=" entry for --brief output,
enclose name in quotes if it contains spaces etc.
Quotes are already supported for reading mdadm.conf
2/ When a name is used as a device name, translate spaces
and tabs to '_', as well as the current translation of
'/' to '-'.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r-- | super1.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -485,7 +485,12 @@ static void brief_examine_super1(struct supertype *st, int verbose) else nm = NULL; - printf("ARRAY%s%s", nm ? " /dev/md/":"", nm); + printf("ARRAY "); + if (nm) { + printf("/dev/md/"); + print_escape(nm); + putchar(' '); + } if (verbose && c) printf(" level=%s", c); sb_offset = __le64_to_cpu(sb->super_offset); @@ -502,8 +507,10 @@ static void brief_examine_super1(struct supertype *st, int verbose) if ((i&3)==0 && i != 0) printf(":"); printf("%02x", sb->set_uuid[i]); } - if (sb->set_name[0]) - printf(" name=%.32s", sb->set_name); + if (sb->set_name[0]) { + printf(" name="); + print_quoted(sb->set_name); + } printf("\n"); } @@ -584,8 +591,10 @@ static void brief_detail_super1(struct supertype *st) struct mdp_superblock_1 *sb = st->sb; int i; - if (sb->set_name[0]) - printf(" name=%.32s", sb->set_name); + if (sb->set_name[0]) { + printf(" name="); + print_quoted(sb->set_name); + } printf(" UUID="); for (i=0; i<16; i++) { if ((i&3)==0 && i != 0) printf(":"); |