From a1f976a013ab738affd54a1ba737107aa05c26ad Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 22 Nov 2010 20:24:35 +1100 Subject: Use new container_content rather than passing subarray to load_super. Now that we can ask container_content for a specific subarray, we don't need to pass the subarray name to load_super, and have it secretly modify the returned state. Signed-off-by: NeilBrown --- mapfile.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'mapfile.c') diff --git a/mapfile.c b/mapfile.c index 2645aa95..be58436c 100644 --- a/mapfile.c +++ b/mapfile.c @@ -380,8 +380,9 @@ void RebuildMap(void) int dfd; int ok; struct supertype *st; + char *subarray; char *path; - struct mdinfo info; + struct mdinfo *info; sprintf(dn, "%d:%d", sd->disk.major, sd->disk.minor); dfd = dev_open(dn, O_RDONLY); @@ -391,14 +392,14 @@ void RebuildMap(void) if ( st == NULL) ok = -1; else { - char *subarray = get_member_info(md); - strcpy(st->subarray, subarray); + subarray = get_member_info(md); ok = st->ss->load_super(st, dfd, NULL); } close(dfd); if (ok != 0) continue; - st->ss->getinfo_super(st, &info, NULL); + info = st->ss->container_content(st, subarray); + if (md->devnum >= 0) path = map_dev(MD_MAJOR, md->devnum, 0); else @@ -418,7 +419,7 @@ void RebuildMap(void) * find a unique name based on metadata name. * */ - struct mddev_ident_s *match = conf_match(&info, st); + struct mddev_ident_s *match = conf_match(info, st); struct stat stb; if (match && match->devname && match->devname[0] == '/') { path = match->devname; @@ -436,13 +437,13 @@ void RebuildMap(void) st->ss->match_home(st, homehost) != 1) && st->ss->match_home(st, "any") != 1 && (require_homehost - || ! conf_name_is_free(info.name))) + || ! conf_name_is_free(info->name))) /* require a numeric suffix */ unum = 0; else /* allow name to be used as-is if no conflict */ unum = -1; - name = info.name; + name = info->name; if (!*name) { name = st->ss->name; if (!isdigit(name[strlen(name)-1]) && @@ -475,9 +476,10 @@ void RebuildMap(void) } } map_add(&map, md->devnum, - info.text_version, - info.uuid, path); + info->text_version, + info->uuid, path); st->ss->free_super(st); + free(info); break; } sysfs_free(sra); -- cgit v1.2.3