On Wed, May 29, 2024 at 03:36:39PM -0300, Thiago Macieira wrote: > Hello Miklos & others > > Thank you for the listmount() & statmount() API. I found it very easy to use > and definitely easier than parsing of /proc/self/mountinfo. I am missing three > pieces of information from statmount(), two of which I can get from elsewhere > but the third is a showstopper. > > The showstopper is the lack of mnt_devname anywhere in the output. It is > present in mountinfo and even in the older /etc/mtab and I couldn't find a way > to convert back from the device's major/minor to a string form. Scanning /dev > will not work because the process in question may not have a populated /dev > and even if it does, it would be wasteful to scan /dev for all devices. > Moreover, given symlinks for device-mapper, /dev/dm-1 isn't as descriptive as > /dev/mapper/system-root or /dev/system/root. > > Is there a chance of getting this in a new version of the kernel? > > Of the two others, we can get via other system calls, but would be nice if > statmount() also provided it. > > First, the information provided by statfs(), which is the workaround. It's > easy to call statfs() with the returned mount point path, though that causes a > minor race. > > The second is the filesystem label. The workaround for this is opening the > mount point and issuing ioctl(FS_IOC_GETFSLABEL), but that again introduces a > minor race and also requires that the ability to open() the path in question. > The second fallback to that is to scan /dev/disks/by-label, which is populated > by udev/udisks/systemd. I think that mnt_devname makes sense! I don't like the other additions because they further blur the distinction between mount and filesystem information.