struct active_array *new;
struct mdinfo *mdi, *di;
- char *n;
- int inst;
+ char *inst;
int i;
new = malloc(sizeof(*new));
new->container = container;
- n = &mdstat->metadata_version[10+strlen(container->devname)+1];
- inst = atoi(n);
- if (inst < 0)
- abort();//FIXME
+ inst = &mdstat->metadata_version[10+strlen(container->devname)+1];
mdi = sysfs_read(-1, new->devnum,
GET_LEVEL|GET_CHUNK|GET_DISKS|
struct mdinfo *(*container_content)(struct supertype *st);
/* for mdmon */
- int (*open_new)(struct supertype *c, struct active_array *a, int inst);
+ int (*open_new)(struct supertype *c, struct active_array *a,
+ char *inst);
/* Tell the metadata handler the current state of the array.
* This covers whether it is known to be consistent (no pending writes)
info->disk.major = 0;
info->disk.minor = 0;
- info->disk.number = __be32_to_cpu(ddf->dlist->disk.refnum);
-// info->disk.raid_disk = find refnum in the table and use index;
- info->disk.raid_disk = -1;
- for (i = 0; i < __be16_to_cpu(ddf->phys->max_pdes) ; i++)
- if (ddf->phys->entries[i].refnum == ddf->dlist->disk.refnum) {
- info->disk.raid_disk = i;
- break;
- }
+ if (ddf->dlist) {
+ info->disk.number = __be32_to_cpu(ddf->dlist->disk.refnum);
+ info->disk.raid_disk = -1;
+ for (i = 0; i < __be16_to_cpu(ddf->phys->max_pdes) ; i++)
+ if (ddf->phys->entries[i].refnum ==
+ ddf->dlist->disk.refnum) {
+ info->disk.raid_disk = i;
+ break;
+ }
+ } else {
+ info->disk.number = -1;
+// info->disk.raid_disk = find refnum in the table and use index;
+ }
info->disk.state = (1 << MD_DISK_SYNC);
info->reshape_active = 0;
* We need to confirm that the array matches the metadata in 'c' so
* that we don't corrupt any metadata.
*/
-static int ddf_open_new(struct supertype *c, struct active_array *a, int inst)
+static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
{
- fprintf(stderr, "ddf: open_new %d\n", inst);
+ fprintf(stderr, "ddf: open_new %s\n", inst);
+ a->info.container_member = atoi(inst);
return 0;
}
}
-static int imsm_open_new(struct supertype *c, struct active_array *a, int inst)
+static int imsm_open_new(struct supertype *c, struct active_array *a,
+ char *inst)
{
- fprintf(stderr, "imsm: open_new %d\n", inst);
+ fprintf(stderr, "imsm: open_new %s\n", inst);
+ a->info.container_member = atoi(inst);
return 0;
}