On Fri, Jul 12, 2024 at 07:14:34PM +0200, Martin Wilck wrote: > Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> > --- > libmultipath/devmapper.c | 34 ++++++---------------------------- > 1 file changed, 6 insertions(+), 28 deletions(-) > > diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c > index 003d834..8af4167 100644 > --- a/libmultipath/devmapper.c > +++ b/libmultipath/devmapper.c > @@ -1481,37 +1481,15 @@ dm_is_suspended(const char *name) > return info.suspended; > } > > -char * > -dm_mapname(int major, int minor) > +char *dm_mapname(int major, int minor) > { > - char * response = NULL; > - const char *map; > - struct dm_task *dmt; > - int r; > + char name[WWID_SIZE]; > > - if (!(dmt = libmp_dm_task_create(DM_DEVICE_INFO))) > + if (libmp_mapinfo(DM_MAP_BY_DEV, > + (mapid_t) { ._u = { major, minor } }, > + (mapinfo_t) { .name = name }) != DMP_OK) > return NULL; > - > - if (!dm_task_set_major(dmt, major) || > - !dm_task_set_minor(dmt, minor)) > - goto bad; > - > - r = libmp_dm_task_run(dmt); > - if (!r) { > - dm_log_error(2, DM_DEVICE_INFO, dmt); > - goto bad; > - } > - > - map = dm_task_get_name(dmt); > - if (map && strlen(map)) > - response = strdup((const char *)map); > - > - dm_task_destroy(dmt); > - return response; > -bad: > - dm_task_destroy(dmt); > - condlog(0, "%i:%i: error fetching map name", major, minor); > - return NULL; > + return strdup(name); > } > > static int > -- > 2.45.2