]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Make --brief even briefer.
authorNeilBrown <neilb@suse.de>
Mon, 11 May 2009 05:18:20 +0000 (15:18 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 11 May 2009 05:18:20 +0000 (15:18 +1000)
Because ---examine --brief, or --detail --brief are
often used to create mdadm.conf, and because people don't want to
have to update their mdadm.conf unnecessarily, we don't want to
include information that might change.
And now that level changing is supported, that is almost everything
but UUID.

So move some more fields into the "Only print with --verbose" class.

Signed-off-by: NeilBrown <neilb@suse.de>
Detail.c
Examine.c
mdadm.h
super-ddf.c
super-intel.c
super0.c
super1.c

index dea605eae82978cbc31d49e3ceb3f41b325d72b6..54db558b48dd8664f9f660d3a3a25642ecc32e8e 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -196,14 +196,16 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
 
        if (brief) {
                mdu_bitmap_file_t bmf;
-               if (array.raid_disks)
-                       printf("ARRAY %s level=%s num-devices=%d", dev,
-                              c?c:"-unknown-",
-                              array.raid_disks );
-               else
-                       printf("ARRAY %s level=container num-devices=%d",
-                              dev, array.nr_disks);
-
+               printf("ARRAY %s", dev);
+               if (brief > 1) {
+                       if (array.raid_disks)
+                               printf("level=%s num-devices=%d",
+                                      c?c:"-unknown-",
+                                      array.raid_disks );
+                       else
+                               printf("level=container num-devices=%d",
+                                      array.nr_disks);
+               }
                if (container) {
                        printf(" container=%s", container);
                        printf(" member=%s", member);
index 3827e7ed08086bc740799524f82701bb49de7bd6..bc06b40c5c662a31e6f28555655e06905b948444 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -141,7 +141,7 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
                for (ap=arrays; ap; ap=ap->next) {
                        char sep='=';
                        char *d;
-                       ap->st->ss->brief_examine_super(ap->st);
+                       ap->st->ss->brief_examine_super(ap->st, brief > 1);
                        if (ap->spares) printf("   spares=%d", ap->spares);
                        if (brief > 1) {
                                printf("   devices");
diff --git a/mdadm.h b/mdadm.h
index 1f47be361d621c9a86f4c7ef93d5c1a71cb3041c..d9bb4c9c0052eb365e7193db59a6cea285676eeb 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -440,7 +440,7 @@ extern struct superswitch {
         * device. ->load_super has been called.
         */
        void (*examine_super)(struct supertype *st, char *homehost);
-       void (*brief_examine_super)(struct supertype *st);
+       void (*brief_examine_super)(struct supertype *st, int verbose);
        void (*export_examine_super)(struct supertype *st);
 
        /* Used to report details of an active array.
index fa4d351cf2ed35d08f121e67e10d4fec64134aae..77a481f37461cc8411b01b530764a53d6fcf0833 100644 (file)
@@ -1162,7 +1162,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info);
 
 static void uuid_from_super_ddf(struct supertype *st, int uuid[4]);
 
-static void brief_examine_super_ddf(struct supertype *st)
+static void brief_examine_super_ddf(struct supertype *st, int verbose)
 {
        /* We just write a generic DDF ARRAY entry
         */
index 300c7b86f6c261052f393b6b3b2b092e79860eac..a2e3b7fc3aa91e4d8f7ab99a9bb44ae17dcabcd4 100644 (file)
@@ -753,7 +753,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
        }
 }
 
-static void brief_examine_super_imsm(struct supertype *st)
+static void brief_examine_super_imsm(struct supertype *st, int verbose)
 {
        /* We just write a generic IMSM ARRAY entry */
        struct mdinfo info;
index 18e1d45eed5e5c4b651b44bc9a5b5f60a3f66af8..3f02ed403435bcaf4c5196e931539627c7ba8495 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -232,7 +232,7 @@ static void examine_super0(struct supertype *st, char *homehost)
        }
 }
 
-static void brief_examine_super0(struct supertype *st)
+static void brief_examine_super0(struct supertype *st, int verbose)
 {
        mdp_super_t *sb = st->sb;
        char *c=map_num(pers, sb->level);
@@ -240,14 +240,18 @@ static void brief_examine_super0(struct supertype *st)
 
        sprintf(devname, "/dev/md%d", sb->md_minor);
 
-       printf("ARRAY %s level=%s num-devices=%d UUID=",
-              devname,
-              c?c:"-unknown-", sb->raid_disks);
+       if (verbose) {
+               printf("ARRAY %s level=%s num-devices=%d",
+                      devname,
+                      c?c:"-unknown-", sb->raid_disks);
+       } else
+               printf("ARRAY %s", devname);
+
        if (sb->minor_version >= 90)
-               printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
+               printf(" UUID=%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
                       sb->set_uuid2, sb->set_uuid3);
        else
-               printf("%08x", sb->set_uuid0);
+               printf(" UUID=%08x", sb->set_uuid0);
        printf("\n");
 }
 
index 679120ff3c9b3b1ad2177f27f9c6bb0a3f0df712..850b2e4221cb9229bc20a947008f8330bae05045 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -414,7 +414,7 @@ static void examine_super1(struct supertype *st, char *homehost)
 }
 
 
-static void brief_examine_super1(struct supertype *st)
+static void brief_examine_super1(struct supertype *st, int verbose)
 {
        struct mdp_superblock_1 *sb = st->sb;
        int i;
@@ -430,9 +430,9 @@ static void brief_examine_super1(struct supertype *st)
        else
                nm = NULL;
 
-       printf("ARRAY%s%s level=%s ",
-              nm ? " /dev/md/":"", nm,
-              c?c:"-unknown-");
+       printf("ARRAY%s%s", nm ? " /dev/md/":"", nm);
+       if (verbose && c)
+               printf(" level=%s", c);
        sb_offset = __le64_to_cpu(sb->super_offset);
        if (sb_offset <= 4)
                printf("metadata=1.1 ");
@@ -440,7 +440,9 @@ static void brief_examine_super1(struct supertype *st)
                printf("metadata=1.2 ");
        else
                printf("metadata=1.0 ");
-       printf("num-devices=%d UUID=", __le32_to_cpu(sb->raid_disks));
+       if (verbose)
+               printf("num-devices=%d ", __le32_to_cpu(sb->raid_disks));
+       printf("UUID=");
        for (i=0; i<16; i++) {
                if ((i&3)==0 && i != 0) printf(":");
                printf("%02x", sb->set_uuid[i]);