summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: fix mnt_is_readonly() #ifdefKarel Zak2014-10-071-1/+1
| | | | | | | This issue affects util-linux portability to GNU/HURD Reported-by: Pino Toscano (from Red Hat) Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't return root if path contains // or ending /Søren Holm2014-10-011-1/+1
| | | | | | | | If the path fx. is /foo/bar/ the initial stripoff will replace the last slash with \0 and return a pointer to that exact \0 character. The same thing will happen if the path contains // somewhere. Signed-off-by: Søren Holm <sgh@sgh.dk>
* libmount: only include context on linuxAndreas Henriksson2014-09-221-4/+8
| | | | | | | | | | This is part of an attempt to make libmount buildable on non-linux. The parts that need architecture specific porting is under the context*.c files and the rest of libmount is useful/used by for example fsck. Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* libmount: only invoke loopcxt on linuxAndreas Henriksson2014-09-222-0/+4
| | | | | | | | | This is part of an attempt to make libmount buildable on non-linux. The support for /dev/loop* is Linux-specific so just disable it on non-linux for now. Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* umount: read mountinfo if --detach-loop givenRobert Schiele2014-09-221-1/+3
| | | | | | | | | | Don't use the optimization not to read mountinfo from commit 6a52473ecd877227f6f7da2b95da0b51593ffec1 if --detach-loop was given since we need the name of the loop device in that case and with the optimization this is not present and thus the detach operation obviously fails. Signed-off-by: Robert Schiele <rschiele@gmail.com>
* libmount: hide details about failed search in fstab/mtabKarel Zak2014-09-161-2/+8
| | | | | | | | | | | | The current code returns -errno when not found "mount /foo" in fstab and mtab does not exist (or /etc/mtab points to non-mounted /proc). This is problem because the return value is too low-level and maybe misinterpreted by top level code. It's better to always return MNT_ERR_NOFSTAB when not found in fstab/mtab. Reported-by: Dylan Cali <calid1984@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use -t for type.subtype in helpers APIKarel Zak2014-08-212-3/+7
| | | | | References: https://github.com/karelzak/util-linux/issues/116 Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: cleanup masksKarel Zak2014-08-131-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libs/debug: accept human readable names for _DEBUG=Ondrej Oprala2014-08-132-2/+50
| | | | | | | | | | For example $ LIBMOUNT_DEBUG=tab,cache findmnt to debug only TAB and CACHE subsystem. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use /{proc,ext}/filesystems when more fs types specifiedKarel Zak2014-07-251-43/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | # mkfs.ext4 /dev/sda1 # mount -t foo,bar /dev/sda1 /mnt successfully mount the device, this is unexpected as extN is no between wanted (by -t specified) filesystems. Summary about -t: * "mount -t foo" mount(2) with "foo" type * "mount -t foo,bar" try mount(2) with "foo" or "bar" * "mount -t foo,auto" try mount(2) with "foo" or ask libblkid for the type * "mount -t nofoo,bar" try types from /{etc,proc}/filesystems, but exclude "foo" and "bar" Note that more filesystems may be specified in fstab (as comma delimited list). The stuff from fstab is always interpreted as list and never as a pattern ("no" prefix makes no sense in fstab). Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add missing assert()Karel Zak2014-07-171-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: adjust the ordering of a #define and tweak some commentsBenno Schulenberg2014-07-141-11/+10Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: fix some typosSami Kerola2014-07-131-1/+1
| | | | | | | Found with misspell-check version 2.0d. Reference: https://github.com/lyda/misspell-check Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: always use mnt_resolve_target() in mnt_fs_match_target()Karel Zak2014-07-012-4/+9
| | | | | | | The requested path is also target mountpoint, so let's optimize realpath() usage as well. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: mnt_resolve_target: tiptoe around active mount pointsEric Rannaud2014-07-015-24/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | Current code in mnt_fs_match_target() and mnt_table_find_target() already does not canonicalize active mount points (when read from mountinfo), because they are already canonicalized by the kernel. Calling realpath(fs->target) on a mount point can hang -- e.g. if the NFS server is unreachable. This patch optionally extends this strategy to the general case, that is when @fs does not directly come from the kernel through mountinfo (for instance, it may have been parsed from /etc/fstab). Given @mtab parsed from mountinfo, and if mnt_cache_set_targets(cache, mtab) is used, then mnt_fs_match_target() and mnt_table_find_target() check whether @fs->target is a known mount point in the cached mountinfo, before attempting to canonicalize @fs->target, no matter where @fs itself comes from. If found in the cached mountinfo, @fs->target is not canonicalized. [kzak@redhat.com: - don't allocate libmnt_iter, - add docs for mnt_cache_set_targets(), - fallback to mnt_resolve_path() if no cache->mtab specified, - use streq_except_trailing_slash() to compare paths] Signed-off-by: Eric Rannaud <e@nanocritical.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: mnt_resolve_path: don't canonicalize fs->target for swapEric Rannaud2014-07-011-1/+1
| | | | | | | | This is how mnt_table_find_target() does it. It makes sense because @fs->target is "none" for swap and is never a sensible match for a user-specified target. Signed-off-by: Eric Rannaud <e@nanocritical.com>
* libmount: mnt_resolve_path: use strcmp() only if both are canonicalEric Rannaud2014-07-011-1/+1
| | | | Signed-off-by: Eric Rannaud <e@nanocritical.com>
* libmount: special treatment for auto in fstype patternKarel Zak2014-06-233-28/+61
| | | | | | | | | | Let's support mount -t ext2,auto /dev/sde /media/stick Reported-by: Andreas Henriksson <andreas@fatal.se> Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506695 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't touch mtab when mount -n specifiedKarel Zak2014-06-174-16/+73
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1109367 Signed-off-by: Karel Zak <kzak@redhat.com>
* Only move shared libraries to /lib if they existsThomas Petazzoni2014-06-161-1/+1
| | | | | | | | | | | | | | | | | | In several Makemodule.am, there is a install-exec-hook-<library> target whose role is to move the shared library from /usr/lib to /lib, while keeping a symbolic link /usr/lib/libuuid.so -> ../../lib/<library>.so.<version>. However, when util-linux is built with --enable-static --disable-shared (as is needed on noMMU platforms that don't support shared libraries), no <library>.so is built, but the install-exec-hook-libuuid creates an invalid /usr/lib/<library>.so symbolic link, pointing to ../../lib (yes, the directory). This causes troubles later one when other libraries/programs are compiled with -l<library>, as gcc thinks a shared library is available because there's a file named /usr/lib/<library>.so. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* lib/fileutils: add stripoff_last_component() from libmountKarel Zak2014-06-093-16/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/fileutils: add mkdir_p() from libmountKarel Zak2014-06-092-37/+2Star
|
* docs: fix "behaviour" vs. "behavior"Karel Zak2014-06-061-2/+2
| | | | | | | | Sometimes we use "behaviour" and "behavior" in the same text, let's use "behavior" only everywhere. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068 Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix python tests for dist and out-of-tree buildsRuediger Meier2014-06-041-0/+4
| | | | | | | | | - add python helper scripts to the dist - helper scripts are always in srcdir - python libs are in builddir - abort tests if helpers are missing Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: use automake's PYTHON primary for __init__.pyRuediger Meier2014-06-031-3/+1Star
| | | | | | | | | | Actually the initial reason for this commit was to remove execute permission from installed __init__.py. Now after discovering automake's _PYTHON suffix we slightly cleanup Makemodule.am and we will install byte compiled .pyc and .pyo files. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* docs: rename libs xml/version.xml to xml/version-utils.xmlKarel Zak2014-06-033-3/+3
| | | | | | | It seems that gtk-docs stuff is confused when we use version.xml (package version) and xml/version.xml (library version functions). Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix .h.in usage in libblkid and libmountKarel Zak2014-04-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: apply "nofail" to MNT_ERR_NOSOURCE libmount errorKarel Zak2014-04-071-0/+5
| | | | | | | | | | | | | fstab: UUID=nonexist /mnt/nonexist1 ext4 nofail 0 1 # mount -av mount: can't find UUID=nonexist .. this is bug of course. Reported-by: Patrick McLean <chutzpah@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: silence some docs warningsOndrej Oprala2014-03-282-2/+2
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* Merge branch 'master' of https://github.com/rudimeier/util-linuxKarel Zak2014-03-211-2/+1Star
|\ | | | | | | | | | | | | | | * 'master' of https://github.com/rudimeier/util-linux: tests: try hard to create swaplabel's test image build-sys: libmount/python/__init__.py is always a dist file tests: return error if failures file not usable tests: write tests/failures to build- instead of srcdir
| * build-sys: libmount/python/__init__.py is always a dist fileRuediger Meier2014-03-131-2/+1Star
| | | | | | | | | | | | | | "make dist" and "make distcheck" should work after a bare ./configure to give us a full featured tar ball. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | libmount: use new debug functionsKarel Zak2014-03-2116-348/+291Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | clean up redundant macros and definesOndrej Oprala2014-03-133-12/+2Star
| | | | | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* | libmount: further debug.h integrationOndrej Oprala2014-03-132-15/+6Star
| | | | | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* | libmount: use macros from include/debug.hOndrej Oprala2014-03-122-8/+5Star
|/ | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* build-sys: sort gitignore filesSami Kerola2014-03-121-8/+8
| | | | | | Use 'LC_ALL=C sort -fu' order for all lists. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: add statfs_magic.hKarel Zak2014-03-061-74/+74
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: define BTRFS_TEST_MAGIC if missingBernhard Voelker2014-03-051-0/+3
| | | | | | | * libmount/src/utils.c (BTRFS_TEST_MAGIC): Conditionally add define which is used since commit v2.24-243-g6a52473. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* build-sys: don't connect _DEPENDENCIES and _LIBADDKarel Zak2014-03-051-1/+2
| | | | | | | | | The _DEPENDENCIES has to be used for dependencies on another in-tree files, but _LIBADD is to specify additional libs (including external libs). Reported-by: oleid <notifications@github.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cgroup magic already definedKarel Zak2014-03-031-3/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: don't use mountinfo if possibleKarel Zak2014-03-035-31/+242
| | | | | | | | | | | | | | | | | | | | | | | | The umount(8) always parses /proc/self/mountinfo to get fstype and to merge kernel mount options with userspace mount options from /run/mount/utab. This behavior is overkill in many cases and it's pretty expensive as kernel has to always compose *whole* mountinfo. This performance disadvantage is visible for crazy use-cases with huge number of mountpoints and frequently called umount(8). It seems that we can bypass /proc/self/mountinfo by statfs() to get filesystem type (statfs.f_type magic) and analyze /run/mount/utab before we parse mountinfo. This optimization is not used when: * umount(8) executed by non-root (as user= in utab is expected) * umount --lazy / --force (target is probably unreachable NFS, then use statfs() is pretty bad idea) * target is not a directory (e.g. umount /dev/sda1) * there is (deprecated) writeable mtab Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: FS id and parent ID could be zeroKarel Zak2014-02-201-8/+4Star
| | | | | | | | | | It seems that linux 3.14 is able to produce things like: 19 0 8:3 / / rw,relatime - ext4 /dev/sda3 rw,data=ordered ^ Reported-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: initialize *root to NULL in mnt_table_get_root_fsThomas Bächler2014-02-171-0/+2
| | | | | | | | mnt_table_get_root_fs only works when *root is set to NULL. This is not only undocumented, but also unintuitive. Fix it by initializing *root inside mnt_table_get_root_fs. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make the mountinfo parser more robustKarel Zak2014-02-171-10/+11
| | | | | | ... sorry, the previous change to the parser was too stupid. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: accept (deleted) path suffix in mountinfo fileKarel Zak2014-02-171-0/+10
| | | | | Addresses: debian bug #711183 Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c.h: prefer nanosleep() over usleep()Karel Zak2014-01-241-2/+2
| | | | | | | | | | | | | | Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix scanf format string [coverity scan]Karel Zak2014-01-141-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: import directly from pylibmount in testsKarel Zak2014-01-143-3/+9
| | | | | | | This change does not have any impact to in a standard way installed libmount impact. It's simplification for in-tree tests. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: remove unncessary subdirectoryKarel Zak2014-01-142-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_uniq_fs()Karel Zak2013-12-114-14/+158
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>