]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Detail.c
Release 3.2.6 - stability release
[thirdparty/mdadm.git] / Detail.c
index ae15846d8d5bd6edb2d68fb00fc314387d3f86ae..946b5e9be783150b9d713aebc03ee143d1d5f2b9 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -206,8 +206,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost, char *pre
                        printf("MD_UUID=%s\n", nbuf+5);
                        mp = map_by_uuid(&map, info->uuid);
                        if (mp && mp->path &&
-                           strncmp(mp->path, "/dev/md/", 8) == 0)
-                               printf("MD_DEVNAME=%s\n", mp->path+8);
+                           strncmp(mp->path, "/dev/md/", 8) == 0) {
+                               printf("MD_DEVNAME=");
+                               print_escape(mp->path+8);
+                               putchar('\n');
+                       }
 
                        if (st->ss->export_detail_super)
                                st->ss->export_detail_super(st);
@@ -220,8 +223,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost, char *pre
                                printf("MD_UUID=%s\n", nbuf+5);
                        }
                        if (mp && mp->path &&
-                           strncmp(mp->path, "/dev/md/", 8) == 0)
-                               printf("MD_DEVNAME=%s\n", mp->path+8);
+                           strncmp(mp->path, "/dev/md/", 8) == 0) {
+                               printf("MD_DEVNAME=");
+                               print_escape(mp->path+8);
+                               putchar('\n');
+                       }
                }
                goto out;
        }
@@ -374,11 +380,11 @@ int Detail(char *dev, int brief, int export, int test, char *homehost, char *pre
 
                        printf("          State : %s%s%s%s%s%s \n",
                               (array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
-                              (!e || (e->percent < 0 && e->percent != PROCESS_PENDING &&
-                              e->percent != PROCESS_DELAYED)) ? "" : sync_action[e->resync],
+                              (!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
+                              e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
                               larray_size ? "": ", Not Started",
-                              e->percent == PROCESS_DELAYED ? " (DELAYED)": "",
-                              e->percent == PROCESS_PENDING ? " (PENDING)": "");
+                              e->percent == RESYNC_DELAYED ? " (DELAYED)": "",
+                              e->percent == RESYNC_PENDING ? " (PENDING)": "");
                }
                if (array.raid_disks)
                        printf(" Active Devices : %d\n", array.active_disks);
@@ -424,7 +430,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost, char *pre
                }
                free_mdstat(ms);
 
-               if (st->sb && info->reshape_active) {
+               if ((st && st->sb) && (info && info->reshape_active)) {
 #if 0
 This is pretty boring
                        printf("  Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9,
@@ -537,7 +543,8 @@ This is pretty boring
                        if (disk.state & (1<<MD_DISK_REMOVED)) printf(" removed");
                        if (disk.state & (1<<MD_DISK_WRITEMOSTLY)) printf(" writemostly");
                        if ((disk.state &
-                            ((1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC)|(1<<MD_DISK_REMOVED)))
+                            ((1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC)
+                             |(1<<MD_DISK_REMOVED)|(1<<MD_DISK_FAULTY)))
                            == 0) {
                                printf(" spare");
                                if (is_26) {
@@ -575,7 +582,8 @@ This is pretty boring
        if (spares && brief && array.raid_disks) printf(" spares=%d", spares);
        if (brief && st && st->sb)
                st->ss->brief_detail_super(st);
-       st->ss->free_super(st);
+       if (st)
+               st->ss->free_super(st);
 
        if (brief > 1 && devices) printf("\n   devices=%s", devices);
        if (brief) printf("\n");