summaryrefslogtreecommitdiffstats
path: root/misc-utils/findmnt.c
Commit message (Collapse)AuthorAgeFilesLines
* findmnt: fix filters use on --listKarel Zak2019-05-291-1/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: keep it easy for static analyzersKarel Zak2019-05-161-1/+2
|
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc-tools/findmnt: a few whitespace fixessluidfoe2018-05-101-3/+3
|
* misc-tools/findmnt: add --pseudo, --real filterssluidfoe2018-05-101-1/+20
|
* findmnt: add --output-all optionSami Kerola2018-05-031-1/+11
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* findmnt: use scols_column_set_json_type()Karel Zak2018-04-181-2/+24
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-271-1/+0Star
| | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* include/c.h: add USAGE_COMMANDS and USAGE_COLUMNSJ William Piggott2017-06-241-2/+1Star
| | | | | | | | | | | | * login-utils/lslogins.c: all uses changed * misc-utils/findmnt.c: likewise * sys-utils/blkzone.c: likewise * disk-utils/sfdisk.c: likewise * sys-utils/lscpu.c: likewise * sys-utils/lsmem.c: likewise * sys-utils/wdctl.c: likewise Signed-off-by: J William Piggott <elseifthen@gmx.com>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-141-4/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: consolidate smartcols error messagesKarel Zak2017-05-181-13/+15
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-38/+38
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* findmnt: use line separator for --poll outputKarel Zak2017-02-101-0/+2
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/409 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: flush stdout after each (un)(re)mount event, when polling.Pedro Miguel Carvalho2017-01-291-0/+1
| | | | Addresses: karelzak#407
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+1Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --tree to allow to enable tree output for --mtabKarel Zak2016-12-081-2/+13
| | | | | | | | | | | | The --mtab output is merge from kernel and utab on all modern systems (without classic /etc/mtab). It means we have all necessary information to generate tree output. For the backward compatibility --mtab is the list by default, the new option --tree allows to override the default and enable tree always when the table contains child-parent relations. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add note about mount optionsKarel Zak2016-12-081-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --verify and --verboseKarel Zak2016-09-231-41/+40Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-3/+3
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messagesBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* Revert "include sysmacros.h where used"Karel Zak2016-03-081-1/+0Star
| | | | This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.
* include sysmacros.h where usedMike Frysinger2016-03-081-0/+1
| | | | | | | | BSD/Linux systems stick major/minor/makedev in sysmacros.h. Newer Linux libraries have been moving away from including sysmacros.h implicitly via sys/types.h, so include it directly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* findmnt: use scols_table_print_range() for --pollKarel Zak2016-02-241-1/+2
| | | | | | This change fixes problem with duplicate header line. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed linesKarel Zak2015-10-151-1/+1
| | | | | | | | | | | | | | | | | The libmount provides way how to deal with parsing errors in fstab -- on error callback function is executed and according to the return libmount manipulate with the malformed line, possible are three states: 1/ fatal error; all file ignored (callback rc < 0) 2/ recoverable error; malformed line ignored (callback rc > 0) 3/ ignore the error (callback rc == 0) The 2/ is the default if no callback specified. Unfortunately our utils uses 3/. The correct way is to use 2/. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --jsonKarel Zak2015-06-051-4/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: fix string_add_to_idarray() int vs. size_tKarel Zak2015-04-221-5/+7
| | | | | | | | | | | | | | | | | | | | The function uses "int" as argument, but for array size (and index) is better to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk) and "int" in lib/strutils.c then result is unexpected behavior on ppc64. # sfdisk --list -o DEVICE,START,SIZE /dev/sdb Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 32768 bytes Disklabel type: gpt Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539 lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed. The patch cleanup all code to use size_t everywhere. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --mountpoint command line optionKarel Zak2015-03-191-4/+17
| | | | | | | | | The current --target <path> implementation check the <path> elements in reverse order to get the mountpoint. The feature may be inwanted in some cases when we really want to check for mountpoint specified by the <path>. The new option "--mountpoint <path>" allows to be strict. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: don't rely on st_dev for --targetKarel Zak2015-03-101-8/+10
| | | | | | | | | | | | The overlay filesystem does not provide usable st_dev (in traditional UNIX way). It's necessary to search in /proc/self/mountinfo to detect which path element is mountpoint. $ findmnt --target /mnt/merged/dir-a/foo TARGET SOURCE FSTYPE OPTIONS /mnt/merged overlay overlay rw,relatime,lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: don't parse mountinfo twiceKarel Zak2015-02-121-0/+23
| | | | | | | We parse /proc/self/mountinfo to initialize cache targets, this step is unnecessary if --mtab reads all from kernel. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: fix mem leaks [coverity scan]Karel Zak2015-01-291-10/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* maint: fix shadow declarationSami Kerola2015-01-071-2/+2
| | | | | | | | | | | | | | | | This change fixes all shadow declarations. The worth while to mention fix is with libfdisk sun geometry. It comes from bitops.h cpu_to_be16 macro that further expands from include/bits/byteswap.h that has the shadowing. libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow] libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow] That could have caused earlier some unexpected results. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: remove some inconsistent periods from error messagesBenno Schulenberg2014-08-111-1/+1
| | | | | | While doing so, also improve translatability and some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* findmnt: more robust usage of columns[]Karel Zak2014-07-181-34/+46
| | | | | | For more details see commit dcc8dbdc8137cb3da5100158639b565565b89875. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: fix memory leak [coverity scan]Karel Zak2014-07-171-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: simplify cache_set_targets()Karel Zak2014-07-011-12/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: use mnt_cache_set_targets() for non-kernel tableEric Rannaud2014-07-011-0/+33
| | | | | | | | | | | | | | | | | findmnt compares the user-supplied path <target> with each entry in the parsed table. To do this comparison, libmount attempts to canonicalize the target path of each table entry, when the entry does not originate from the kernel (kernel supplied target paths are already canonicalized). However, if one of these entries is an active mount point, stat(2) or readlink(2) on the mount target path can hang (e.g. unreachable NFS server). If the main table is not a kernel table, we parse /proc/self/mountinfo into a secondary table and call mnt_cache_set_targets(). This allows libmount to check that the target path of each entry in the main table is not an active mount point, so it can avoid canonicalizing it. Signed-off-by: Eric Rannaud <e@nanocritical.com>
* findmnt: minimally improve wording of usage textBenno Schulenberg2014-06-301-7/+7
| | | | | | Also sort the options better and tweak whitespace. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* findmnt: add --nocanonicalize to avoid realpath()Karel Zak2014-06-161-11/+25
| | | | | | | | | * in some cases is realpath() overkill * sometimes you want to search for explicitly specified paths (e.g. "findmnt --fstab /mnt/symlink") rather than for real paths * you want to avoid readlink() and stat() on NFS Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add debug messagesKarel Zak2014-06-061-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: clean up flags usageKarel Zak2014-04-031-5/+5
| | | | | | | | | * rename flags functions to scols_table_enable_* * rename *_no_foo() functions to _nofoo() * output formats are mutually exclusive, so don't use flags there * don't assume symbols in scols_new_table(), use scols_table_set_symbols() Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: cleanup flagsKarel Zak2014-04-031-37/+34Star
| | | | | | Let's use one flags variable for everything. Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: use libsmartcolsOndrej Oprala2014-04-031-80/+97
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* lib/tt: add tt_line_get_userdata()Karel Zak2014-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --bytes to print sizes in bytesKarel Zak2014-02-211-4/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>