summaryrefslogtreecommitdiff
path: root/Detail.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
committerNeilBrown <neilb@suse.de>2010-11-22 19:35:25 +1100
commit4725bc31fb3d7fc207671e851617852dc8034cd5 (patch)
treea79c3c1d0565aaaab0658c95e8033ed23072c4a4 /Detail.c
parentfeab51f8f710f28a63a5b01ec59a5a609a45525b (diff)
super_by_fd: return subarray info explicitly.
Rather than hiding this in the 'st', return it explicitly. In the one case we still need it, copy it into st where needed. This will disappear in a future patch. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Detail.c')
-rw-r--r--Detail.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Detail.c b/Detail.c
index eb51a3ec..0cc1bcf6 100644
--- a/Detail.c
+++ b/Detail.c
@@ -49,6 +49,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
int is_rebuilding = 0;
int failed = 0;
struct supertype *st;
+ char *subarray = NULL;
int max_disks = MD_SB_DISKS; /* just a default */
struct mdinfo info;
struct mdinfo *sra;
@@ -88,7 +89,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
return rv;
}
sra = sysfs_read(fd, 0, GET_VERSION);
- st = super_by_fd(fd);
+ st = super_by_fd(fd, &subarray);
if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
stb.st_rdev = 0;
@@ -139,6 +140,8 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
if (st->sb)
st->ss->free_super(st);
+ if (subarray)
+ strcpy(st->subarray, subarray);
err = st->ss->load_super(st, fd2, NULL);
close(fd2);
if (err)
@@ -581,6 +584,7 @@ This is pretty boring
free(disks);
out:
close(fd);
+ free(subarray);
return rv;
}