]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Examine.c
imsm: fix family number handling
[thirdparty/mdadm.git] / Examine.c
index 276e0fa9610e33877e5f8e134ca9a400f4df994e..3d0ea8a54ac336ae8bcf8ca844501ce58e37a9cc 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  *    Author: Neil Brown
- *    Email: <neilb@cse.unsw.edu.au>
- *    Paper: Neil Brown
- *           School of Computer Science and Engineering
- *           The University of New South Wales
- *           Sydney, 2052
- *           Australia
+ *    Email: <neilb@suse.de>
  */
 
 #include       "mdadm.h"
@@ -35,7 +30,7 @@
 #endif
 #include       "md_u.h"
 #include       "md_p.h"
-int Examine(mddev_dev_t devlist, int brief, int scan,
+int Examine(mddev_dev_t devlist, int brief, int export, int scan,
            int SparcAdjust, struct supertype *forcest,
            char *homehost)
 {
@@ -102,6 +97,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                        st->ss->update_super(st, NULL, "sparc2.2",
                                             devlist->devname, 0, 0, NULL);
                /* Ok, its good enough to try, though the checksum could be wrong */
+
                if (brief) {
                        struct array *ap;
                        char *d;
@@ -118,14 +114,15 @@ int Examine(mddev_dev_t devlist, int brief, int scan,
                                ap->st = st;
                                arrays = ap;
                                st->ss->getinfo_super(st, &ap->info);
-                       } else {
+                       } else
                                st->ss->getinfo_super(st, &ap->info);
-                               st->ss->free_super(st);
-                       }
-                       if (!(ap->info.disk.state & MD_DISK_SYNC))
+                       if (!(ap->info.disk.state & (1<<MD_DISK_SYNC)))
                                ap->spares++;
                        d = dl_strdup(devlist->devname);
                        dl_add(ap->devs, d);
+               } else if (export) {
+                       if (st->ss->export_examine_super)
+                               st->ss->export_examine_super(st);
                } else {
                        printf("%s:\n",devlist->devname);
                        st->ss->examine_super(st, homehost);
@@ -137,7 +134,7 @@ int Examine(mddev_dev_t devlist, int brief, 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");