]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Query.c
Release 3.2.6 - stability release
[thirdparty/mdadm.git] / Query.c
diff --git a/Query.c b/Query.c
index dc69eb8271ec171c35a418bf883b52cfacb04b6d..d6489e5a6a6da003fa8091c3c55aecf9b3ea25f2 100644 (file)
--- a/Query.c
+++ b/Query.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2002-2006 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2002-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"
@@ -40,7 +35,7 @@ int Query(char *dev)
        int fd = open(dev, O_RDONLY);
        int vers;
        int ioctlerr;
-       int superror, superrno;
+       int superror;
        struct mdinfo info;
        mdu_array_info_t array;
        struct supertype *st = NULL;
@@ -87,17 +82,20 @@ int Query(char *dev)
                       array.spare_disks, array.spare_disks==1?"":"s");
        }
        st = guess_super(fd);
-       if (st) {
+       if (st && st->ss->compare_super != NULL)
                superror = st->ss->load_super(st, fd, dev);
-               superrno = errno;
-       } else
+       else
                superror = -1;
        close(fd);
        if (superror == 0) {
                /* array might be active... */
-               st->ss->getinfo_super(st, &info);
-               if (st->ss == &super0) {
-                       mddev = get_md_name(info.array.md_minor);
+               int uuid[4];
+               struct map_ent *me, *map = NULL;
+               st->ss->getinfo_super(st, &info, NULL);
+               st->ss->uuid_from_super(st, uuid);
+               me = map_by_uuid(&map, uuid);
+               if (me) {
+                       mddev = me->path;
                        disc.number = info.disk.number;
                        activity = "undetected";
                        if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
@@ -112,7 +110,7 @@ int Query(char *dev)
                                close(fd);
                        }
                } else {
-                       activity = "unknown";
+                       activity = "inactive";
                        mddev = "array";
                }
                printf("%s: device %d in %d device %s %s %s.  Use mdadm --examine for more detail.\n",