]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Examine.c
Remove spaces/tabs from ends of lines.
[thirdparty/mdadm.git] / Examine.c
index e07b27e0590e54ac0177056579de05e07231c9b8..ba00270e8d9baa5ffd79b0c14bc4a73a7397e6b3 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -35,7 +35,9 @@
 #endif
 #include       "md_u.h"
 #include       "md_p.h"
-int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct supertype *forcest)
+int Examine(mddev_dev_t devlist, int brief, int scan,
+           int SparcAdjust, struct supertype *forcest,
+           char *homehost)
 {
 
        /* Read the raid superblock from a device and
@@ -53,16 +55,15 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
         * If (brief) gather devices for same array and just print a mdadm.conf line including devices=
         * if devlist==NULL, use conf_get_devs()
         */
-       int fd; 
+       int fd;
        void *super = NULL;
        int rv = 0;
-       int err;
+       int err = 0;
 
        struct array {
                void *super;
                struct supertype *st;
                struct mdinfo info;
-               struct mddev_ident_s ident;
                void *devs;
                struct array *next;
                int spares;
@@ -73,9 +74,11 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
 
                fd = dev_open(devlist->devname, O_RDONLY);
                if (fd < 0) {
-                       if (!scan)
+                       if (!scan) {
                                fprintf(stderr,Name ": cannot open %s: %s\n",
                                        devlist->devname, strerror(errno));
+                               rv = 1;
+                       }
                        err = 1;
                }
                else {
@@ -83,16 +86,20 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
                                st = guess_super(fd);
                        if (st)
                                err = st->ss->load_super(st, fd, &super, (brief||scan)?NULL:devlist->devname);
-                       else
+                       else {
+                               if (!brief) {
+                                       fprintf(stderr, Name ": No md superblock detected on %s.\n", devlist->devname);
+                                       rv = 1;
+                               }
                                err = 1;
+                       }
                        close(fd);
                }
                if (err)
                        continue;
-               if (err) rv =1;
 
                if (SparcAdjust)
-                       st->ss->update_super(NULL, super, "sparc2.2", devlist->devname,  0);
+                       st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0, 0, NULL);
                /* Ok, its good enough to try, though the checksum could be wrong */
                if (brief) {
                        struct array *ap;
@@ -109,9 +116,9 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
                                ap->spares = 0;
                                ap->st = st;
                                arrays = ap;
-                               st->ss->getinfo_super(&ap->info, &ap->ident, super);
+                               st->ss->getinfo_super(&ap->info, super);
                        } else {
-                               st->ss->getinfo_super(&ap->info, &ap->ident, super);
+                               st->ss->getinfo_super(&ap->info, super);
                                free(super);
                        }
                        if (!(ap->info.disk.state & MD_DISK_SYNC))
@@ -120,7 +127,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
                        dl_add(ap->devs, d);
                } else {
                        printf("%s:\n",devlist->devname);
-                       st->ss->examine_super(super);
+                       st->ss->examine_super(super, homehost);
                        free(super);
                }
        }