struct mdstat_ent *ent;
struct mddev_dev *d;
struct mddev_dev *rv = NULL;
+ struct map_ent *map = NULL, *me;
if (!mdstat)
return NULL;
!is_subarray(&ent->metadata_version[9])) {
d = xmalloc(sizeof(*d));
memset(d, 0, sizeof(*d));
- if (asprintf(&d->devname, "/dev/%s", ent->dev) < 0) {
+ me = map_by_devnm(&map, ent->dev);
+ if (me)
+ d->devname = xstrdup(me->path);
+ else if (asprintf(&d->devname, "/dev/%s", ent->dev) < 0) {
free(d);
continue;
}
rv = d;
}
free_mdstat(mdstat);
+ map_free(map);
return rv;
}