diff --git a/managemon.c b/managemon.c index 91755f9..4b06778 100644 --- a/managemon.c +++ b/managemon.c @@ -203,8 +203,7 @@ static void manage_new(struct mdstat_ent *mdstat, struct active_array *new; struct mdinfo *mdi, *di; - char *n; - int inst; + char *inst; int i; new = malloc(sizeof(*new)); @@ -218,10 +217,7 @@ static void manage_new(struct mdstat_ent *mdstat, 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| diff --git a/mdadm.h b/mdadm.h index f795b4a..783cd82 100644 --- a/mdadm.h +++ b/mdadm.h @@ -413,7 +413,8 @@ extern struct superswitch { 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) diff --git a/super-ddf.c b/super-ddf.c index e8082b5..8af85bd 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1201,14 +1201,19 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info) 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; @@ -2516,9 +2521,10 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst) * 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; } diff --git a/super-intel.c b/super-intel.c index 69aef65..8bf2073 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1128,9 +1128,11 @@ static struct mdinfo *container_content_imsm(struct supertype *st) } -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; }