Commit Graph

97 Commits

Author SHA1 Message Date
Karel Zak 6195f9e6fa misc: use libmnt_cache reference counting
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21 14:38:38 +02:00
Karel Zak 81499ab24e findmnt: avoid unused parameter warning
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-03 12:42:06 +02:00
Karel Zak 4ba4893b36 findmnt: make udev usage more robust
$ findmnt -rn --target /home/kzak/.bashrc -o UUID

uses libudev to ask for UUID, unfortunately /home/kzak is DM device
and libudev expects sysfs-like names (e.g. dm-0). We have to convert
the name to kernel devname.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-01 15:59:16 +02:00
Karel Zak 4096946f3b findmnt: test for fstype/options/maj:min before source and target
This change allows to exclude for example NFS mountpoint:

  findmnt --fstab --target /mnt/foo --type nonfs

to stall on a stalled nfs mount.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-24 13:28:06 +02:00
Benno Schulenberg 97b820bffd textual: improve clarity of some error messages
Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 12:29:44 +02:00
Sami Kerola c9f63764dc various: fix shadow declarations [smatch scan]
libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one
libmount/src/tab.c:970:26: originally declared here
misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one
misc-utils/findmnt.c:473:14: originally declared here
fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one
fdisks/fdiskdoslabel.c:180:20: originally declared here
fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:578:16: originally declared here
fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here

[kzak@redhat.com: - don't use local 'tmp' in findmnt.c]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 12:19:25 +02:00
Karel Zak 395eb05d16 findmnt: fix typo fsroot -> nofsroot
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-05 11:19:56 +02:00
Karel Zak 426f0ceac7 findmnt: add FREQ and PASSNO columns
... to provide all information from fstab.

Reported-by: Roger Leigh <rleigh@codelibre.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-14 10:50:37 +01:00
Karel Zak e346233ea2 findmnt: allow to read (PART)UUID/LABEL from udev DB
Currently findmnt uses libmount to get filesystem properties (and
libmount uses libblkid). This works as expected, but root permissions
are required to read the tags from the devices.

It seems better to read the information from udev db and use libblkid
as fallback solution only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18 15:00:57 +01:00
Sami Kerola ff2bd506db findmnt: make usage() translator friendly
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25 16:40:04 +01:00
Karel Zak 31f67453a3 findmnt: use tree output in more cases
It seems that we can create the tree also if output is restricted by
fstype or options filter, for example

	$ findmnt -t cgroups

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-17 12:08:09 +01:00
Karel Zak 3e373967ec findmnt: make --target usable with bind mounts
The --target <non-mount-point> functionality should be enabled only if
previous regular search found nothing to avoid collisions with bind
mounts, because to detect mountpoint we use traditional child / parent
stat.st_dev comparison which does not work for bind mounts (--bind /A
/A).

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-14 14:50:50 +01:00
Karel Zak 624f2b47c3 findmnt: add PROPAGATION column
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10 15:59:16 +01:00
Karel Zak 9238e0fa33 findmnt: add ID column
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10 14:59:39 +01:00
Karel Zak 327ea85a73 findmnt: add OPT-FIELDS column
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10 14:58:05 +01:00
Karel Zak 60b17c6f0e findmnt: don't care about xasprintf() return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12 12:08:06 +01:00
Dave Reisner ed6c8c1b61 findmnt: use st.st_bavail for available column
This matches more closely with what 'df -h' reports as space available.
Any remaining discrepancy between these 2 tools is a result of precision
and choices in rounding.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-04 12:43:28 +02:00
Milan Broz c57dca6877 findmnt: support -o +<attr> for adding attribute to output fields.
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-07-27 09:56:54 +02:00
Karel Zak f1622b5705 findmnt: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:24:21 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Karel Zak 7d8f4e0c4b findmnt: add TID column
just in case we read from more mountinfo files.

For example get mountpoint from the current namespace which is invisible
for initd (PID=1):

 # unsahre -m bash
 # mount /dev/sdb /mnt/test
 # echo $$
 30070

 # findmnt -n -o TARGET,TID,SOURCE --task 1 --task $$ | \
      sort -u --key=1,1 | awk ' ($2 != 1) { print $0 }'

 /mnt/test                  30070 /dev/sdb

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-28 15:46:38 +02:00
Karel Zak c7fcc8307d findmnt: add --task <tid> option
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-28 13:51:34 +02:00
Karel Zak aca72ac2f9 findmnt: don't use tree-like output if more -F options specified
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-28 13:20:31 +02:00
Dave Reisner 8b8cd87b21 findmnt: add FSROOT column
Provide this separately in an unambiguous format, mainly to avoid the
need for scripts to parse the source of a btrfs subvol or bind mount.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-28 12:59:57 +02:00
Sami Kerola fb9a004206 findmnt: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Dave Reisner b8a670aecf findmnt: fallback to mountinfo for polling
If no tabfiles are specified, default to watching /proc/self/mountinfo
rather than exiting silently with EXIT_FAILURE.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-23 09:56:51 +02:00
Dave Reisner beda9dd309 findmnt: reference correct manual section
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-23 09:56:51 +02:00
Karel Zak db41a4298f misc-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:44:37 +02:00
Karel Zak 4bfd4bffb7 findmnt: restrict within-device matching
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-27 14:06:20 +02:00
Petr Uzel 6901f22ce0 findmnt: fix compiler warnings [-Wuninitialized]
findmnt.c:333:29: error: ‘vfs_attr’ may be used uninitialized in this function [-Werror=uninitialized]
findmnt.c:307:11: note: ‘vfs_attr’ was declared here

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-04-27 12:30:51 +02:00
Dave Reisner b215d8e9a7 findmnt: add match_by_file to do within-device matching
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>
2012-04-26 09:38:07 +02:00
Karel Zak cd49218679 findmnt: add support for maj:min source
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-25 09:51:26 +02:00
Karel Zak 090b5e84b2 findmnt: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:38:53 +02:00
Sami Kerola c05a80ca63 misc-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:56:48 +02:00
Sami Kerola 13814e3697 findmnt: remove dublicate usage() line
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Sami Kerola 5cc12c4090 findmnt: add --version & align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:11 +02:00
Karel Zak 451d76463c misc: clenaup SIZE columns in lsblk and findmnt
Note that lib/tt.c will never truncate columns without TT_FL_TRUNC or
relative column width. So it's fine to set small width for columns
with SIZEs, the defined width is minimal width.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 11:04:48 +01:00
Karel Zak cd4ed46f98 findmnt: improve --df output
* don't print pseudo-filesystems (except tmpfs)
 * add --all to disable built-in filters
 * don't overwrite --df --output=<list> with default columns

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 10:52:13 +01:00
Karel Zak d7bcb2052e findmnt: use xasprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 09:55:24 +01:00
Dave Reisner eda399b995 findmnt: add -D, --df option to imitate df(1)
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-20 09:53:47 +01:00
Dave Reisner a85ef33b16 findmnt: add FS size, avail, used, and use% columns
Provide display of filesystem attributes from statvfs(3). These are all
displayed in human readable format.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-20 09:53:41 +01:00
Dave Reisner 99d618c0eb checkxalloc: nudge regex, fix newfound instances
Using the -w flag with grep actually fought against us here, and hid
some instances where xalloc functions weren't used. Discard it in
favor of an explicit word boundary as a prefix to the function name,
and extend our requirements on the trailing side of the pattern.

This also fixes the few new instances that were overlooked because of
the regex's deficiency.

[kzak@redhat.com: - fix also newfound in findmnt
                  - remove unnecessary checks after xallocs]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 09:44:40 +01:00
Sami Kerola 6f312c8957 xalloc: use xasprintf in all files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Davidlohr Bueso aec5c2a626 misc-utils: fix typos
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-02-24 14:15:39 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak 762ef0e12d findmnt: initialize rc variable 2012-02-02 12:50:44 +01:00
Karel Zak 275c9a4849 findmnt: make --poll more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-02 00:05:24 +01:00
Karel Zak d1cabd5ce5 findmnt: fix resource leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:49:23 +01:00
Karel Zak 8c5eba3e7c findmnt: support multiple --tab-file options
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 20:22:11 +01:00
Karel Zak 2f1ac44b4b findmnt: revert --fstab behavior, add --tab-file option
The optional argument for -s, --fstab options (--fstab=file) is not
backwardly compatible, because command line with short options (e.g.
findmnt -snr) will be interpreted incorrectly.

This patch removes support for the optional --fstab argument and
introduces a new option --tab-file, for example:

	findmnt --fstab --tab-file=/etc/fstab.foo

Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-20 12:15:37 +01:00