On Mon, Nov 18, 2024 at 12:18:20PM +0100, Martin Wilck wrote: > On Fri, 2024-11-15 at 18:22 -0500, Benjamin Marzinski wrote: > > > > I'm not completely happy with the MAPINFO_ID_IF_FOUND flag. An > > alternative would be to run a second libmp_mapinfo() call without > > MAPINFO_MPATH_ONLY to grab the name, if the first failed with > > DMP_EMPTY. > > If people think that's a better way to solve this, I can rework those > > patches. > > We could simply choose to always fill in this information if the > the caller has requested it, without an additional input flag. It's not > an expensive operation. Is there a reason not to do this? Your comments in the code said that libmp_mapinfo() will not touch any of the output parameters if it doesn't succeed. I didn't audit the code, but I can certainly imagine a situation where you passed in pointers to some varaibles that already had values and you didn't want those values overwritten unless libmp_mapinfo() returned DMP_OK. But I can go look and see if any callers would get messed up if name or uuid got set, even when the found device didn't match. -Ben > > Thanks > Martin