On Wed, Apr 25, 2012 at 10:16:51PM -0400, Dave Reisner wrote: > On Wed, Apr 25, 2012 at 08:30:52PM -0400, Dave Reisner wrote: > > Use the newly exported mnt_get_mountpoint to determine the device that a > > given file resides on, in case the supplied source or target is not > > explicitly a mount point. > > > > http://www.spinics.net/lists/util-linux-ng/msg06081.html > > > > Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx> > > --- > > On second thought, this isn't good -- it'll return results even when > you're searching with --fstab (which is completely undesirable, imo). I have restricted the functionality ;-( - search with --kernel (this is default) - target has to be explicitly defined by --target option or if the source is explicitly defined by MAJ:MIN, UUID=, ... This restriction is required because findmnt(8) (like mount(8)) allows findmnt <device>|<mountpoint> and for example without this restriction, command findmnt /dev/sdb1 returns info about /dev tmpfs (because mnt_get_mountpoint() returns "/dev" as a mountpoint for path "/dev/sdb1" ;-) Note that source for mount(2) syscall could be whatever, including regular file, directory or any random string. All depends on filesystem driver(s). It means that we cannot make any decision about findmnt arguments if --target or --source are not explicitly given. Examples: $ findmnt /home/kzak/Pictures/ [nothing] $ findmnt --target /home/kzak/Pictures TARGET SOURCE FSTYPE OPTIONS /home/kzak /dev/mapper/luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e ext4 rw,relat Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html