From: Karel Zak <kzak@redhat.com>
To: util-linux@vger.kernel.org
Subject: Re: [PATCH 2/2] findmnt: add match_by_file to do within-device matching
Date: Fri, 27 Apr 2012 14:28:49 +0200 [thread overview]
Message-ID: <20120427122849.GC8985@x2.net.home> (raw)
In-Reply-To: <20120426021651.GH938@rampage>
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@archlinux.org>
> > ---
>
> 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@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2012-04-27 12:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-26 0:30 [PATCH 1/2] libmount: expose mnt_get_mountpoint as external API Dave Reisner
2012-04-26 0:30 ` [PATCH 2/2] findmnt: add match_by_file to do within-device matching Dave Reisner
2012-04-26 2:16 ` Dave Reisner
2012-04-26 7:46 ` Karel Zak
2012-04-26 10:45 ` Dave Reisner
2012-04-27 12:28 ` Karel Zak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120427122849.GC8985@x2.net.home \
--to=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox