if (tmpdev->content)
content = tmpdev->content;
else
- content = tst->ss->container_content(tst);
+ content = tst->ss->container_content(tst, NULL);
if (!content)
goto loop; /* empty container */
* array, choose a device name and assemble the array.
*/
- struct mdinfo *list = st->ss->container_content(st);
+ struct mdinfo *list = st->ss->container_content(st, NULL);
struct mdinfo *ra;
struct map_ent *map = NULL;
char *subdev, unsigned long long *freesize,
int verbose);
- struct mdinfo *(*container_content)(struct supertype *st);
+ struct mdinfo *(*container_content)(struct supertype *st, char *subarray);
/* Allow a metadata handler to override mdadm's default layouts */
int (*default_layout)(int level); /* optional */
/* query the supertype for default chunk size */
}
#endif /* MDASSEMBLE */
-static struct mdinfo *container_content_ddf(struct supertype *st)
+static struct mdinfo *container_content_ddf(struct supertype *st, char *subarray)
{
/* Given a container loaded by load_super_ddf_all,
* extract information about all the arrays into
unsigned int i;
unsigned int j;
struct mdinfo *this;
+ char *ep;
+
+ if (subarray &&
+ (strtoul(subarray, &ep, 10) != vc->vcnum ||
+ *ep != '\0'))
+ continue;
+
this = malloc(sizeof(*this));
memset(this, 0, sizeof(*this));
this->next = rest;
}
-static struct mdinfo *container_content_imsm(struct supertype *st)
+static struct mdinfo *container_content_imsm(struct supertype *st, char *subarray)
{
/* Given a container loaded by load_super_imsm_all,
* extract information about all the arrays into
* an mdinfo tree.
+ * If 'subarray' is given, just extract info about that array.
*
* For each imsm_dev create an mdinfo, fill it in,
* then look for matching devices in super->disks
struct intel_super *super = st->sb;
struct imsm_super *mpb = super->anchor;
struct mdinfo *rest = NULL;
- int i;
+ unsigned int i;
/* do not assemble arrays that might have bad blocks */
if (imsm_bbm_log_size(super->anchor)) {
}
for (i = 0; i < mpb->num_raid_devs; i++) {
- struct imsm_dev *dev = get_imsm_dev(super, i);
- struct imsm_map *map = get_imsm_map(dev, 0);
+ struct imsm_dev *dev;
+ struct imsm_map *map;
struct mdinfo *this;
int slot;
+ char *ep;
+
+ if (subarray &&
+ (i != strtoul(subarray, &ep, 10) || *ep != '\0'))
+ continue;
+
+ dev = get_imsm_dev(super, i);
+ map = get_imsm_map(dev, 0);
/* do not publish arrays that are in the middle of an
* unsupported migration
info->array.working_disks = working;
}
+static struct mdinfo *container_content0(struct supertype *st, char *subarray)
+{
+ struct mdinfo *info;
+
+ if (subarray)
+ return NULL;
+
+ info = malloc(sizeof(*info));
+ getinfo_super0(st, info, NULL);
+ return info;
+}
static int update_super0(struct supertype *st, struct mdinfo *info,
char *update,
.match_home = match_home0,
.uuid_from_super = uuid_from_super0,
.getinfo_super = getinfo_super0,
+ .container_content = container_content0,
.update_super = update_super0,
.init_super = init_super0,
.store_super = store_super0,
info->array.working_disks = working;
}
+static struct mdinfo *container_content1(struct supertype *st, char *subarray)
+{
+ struct mdinfo *info;
+
+ if (subarray)
+ return NULL;
+
+ info = malloc(sizeof(*info));
+ getinfo_super1(st, info, NULL);
+ return info;
+}
+
static int update_super1(struct supertype *st, struct mdinfo *info,
char *update,
char *devname, int verbose,
.match_home = match_home1,
.uuid_from_super = uuid_from_super1,
.getinfo_super = getinfo_super1,
+ .container_content = container_content1,
.update_super = update_super1,
.init_super = init_super1,
.store_super = store_super1,