diff options
author | Neil Brown <neilb@suse.de> | 2005-07-18 03:30:42 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2005-07-18 03:30:42 +0200 |
commit | fbf8a0b7a6f107c0fcecb6fea5640ffb1bc0d9c2 (patch) | |
tree | 6de8349d9242cfe11ad7ea0c3ac394a530315cf6 /Query.c | |
parent | Add ANNOUNCE-2.0-devel-2 (diff) | |
download | mdadm-fbf8a0b7a6f107c0fcecb6fea5640ffb1bc0d9c2.tar.xz mdadm-fbf8a0b7a6f107c0fcecb6fea5640ffb1bc0d9c2.zip |
Document this...
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'Query.c')
-rw-r--r-- | Query.c | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -105,26 +105,31 @@ int Query(char *dev) if (superror == 0) { /* array might be active... */ st->ss->getinfo_super(&info, super); - mddev = get_md_name(info.array.md_minor); - disc.number = info.disk.number; - activity = "undetected"; - if (mddev && (fd = open(mddev, O_RDONLY))>=0) { - if (md_get_version(fd) >= 9000 && - ioctl(fd, GET_ARRAY_INFO, &array)>= 0) { - if (ioctl(fd, GET_DISK_INFO, &disc) >= 0 && - makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev) - activity = "active"; - else - activity = "mismatch"; + if (st->ss->major == 0) { + mddev = get_md_name(info.array.md_minor); + disc.number = info.disk.number; + activity = "undetected"; + if (mddev && (fd = open(mddev, O_RDONLY))>=0) { + if (md_get_version(fd) >= 9000 && + ioctl(fd, GET_ARRAY_INFO, &array)>= 0) { + if (ioctl(fd, GET_DISK_INFO, &disc) >= 0 && + makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev) + activity = "active"; + else + activity = "mismatch"; + } + close(fd); } - close(fd); + } else { + activity = "unknown"; + mddev = "array"; } - printf("%s: device %d in %d device %s %s md%d. Use mdadm --examine for more detail.\n", + printf("%s: device %d in %d device %s %s %s. Use mdadm --examine for more detail.\n", dev, info.disk.number, info.array.raid_disks, activity, map_num(pers, info.array.level), - info.array.md_minor); + mddev); } return 0; } |