summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: read utab always when read mtab from /procKarel Zak2015-02-123-3/+21
| | | | | | | | | | | | | Now libmount reads utab only when mtab filename is no explicitly specified, but for example: mnt_table_parse_mtab(tb, "/proc/self/mountinfo"); ignores utab because filename points to regular file. This is mistake, we wnat to read utab always when we read mount table from kernel. Reported-by: Martin Pitt <martin.pitt@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "libmount: MNT_OMODE_FORCE usage"Karel Zak2015-02-101-3/+2Star
| | | | This reverts commit 6f41c5de40629c71a8f79e9be4b94f9a75f9ad21.
* libmount: MNT_OMODE_FORCE usageFridolin Pokorny2015-02-101-2/+3
| | | | | | | | | | | Hi, I have found out that libmount does not respect MNT_OMODE_FORCE mode. I don't see any usage in sources and libmount does not respect this mode when calling library functions. I'm proposing a patch to fix this. Have a nice day! Fridolin Pokorny
* libmount: fix type pointer usageKarel Zak2015-02-031-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix possible mem leak in has_utab_entry() [coverity scan]Karel Zak2015-01-291-3/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mem leak in do_mount_by_types() [coverity scan]Karel Zak2015-01-292-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add options map to docsKarel Zak2015-01-263-5/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: revert "read mtab on remount" ideaKarel Zak2015-01-161-6/+1Star
| | | | | | | | | | | | | | It's backwardly incompatible nonsense to prefer mtab on remount. mount -o remount /foo has to read mount options from fstab otherwise the remount has no effect. (The ideal solution would be to read both mtab, then modify the options according to fstab -- but for now more important is to be backwardly compatible.) References: https://bugzilla.redhat.com/show_bug.cgi?id=1182778 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (docs) add monitor exampleKarel Zak2015-01-131-0/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: update API docs yearsKarel Zak2015-01-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup gtk-docs warningsKarel Zak2015-01-135-9/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* maint: fix shadow declarationSami Kerola2015-01-071-3/+3
| | | | | | | | | | | | | | | | 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>
* libmount: (monitor) make mnt_monitor_next_changed() usable for epoll version tooKarel Zak2015-01-061-14/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* linmount: (monitor) refresh docs, headers and symbols tableKarel Zak2015-01-064-8/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) use inotify for utab lock fileKarel Zak2015-01-061-73/+75
| | | | | | | | | | | | It's better than monitor utab directly. The utab is updated by rename(2) and it's really tricky for inotify, because it's necessary to monitor all /run/mount directory and then it's necessary to verify that the renamed file is really "utab". The new concept is without possible false positives and it also triggers the change when utab update is really done. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) add kernel mountninfo monitoringKarel Zak2015-01-063-48/+175
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) cleanup wait/verify stuffKarel Zak2015-01-064-77/+286
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make public top-level monitor FD onlyKarel Zak2015-01-063-166/+223
| | | | | | | | | | | | | | | | | | | We need full control on changes evaluation, so it's better to hide all in our private epoll. This change also significantly simplify the API. mn = mnt_new_monitor(); mnt_monitor_enable_userapce(mn, TRUE, NULL); mnt_monitor_enable_kenrel(mn, TRUE); fd = mnt_monitor_get_fd(mn); ... <use 'fd' in epoll controlled by your application> ... while (mnt_monitor_next_changed(mn, &filename, NULL) == 0) printf("%s: change detected\n", filename); Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: monitor unref function refactoringKarel Zak2015-01-061-14/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup monitor testKarel Zak2015-01-061-26/+34
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: split monitor initializationKarel Zak2015-01-064-118/+181
| | | | | | | The patch introduces mnt_monitor_enable_*() functions (now for userspace only) to make the API easy to use for high-level purpose. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow unspecified source on remountKarel Zak2014-12-181-1/+9
| | | | | | | | | | | | kernel does not require mount source (e.g. device name) on remount, it means that fstab/mtab/mountinfo should be optional in this case. For example: mount -o rw,remount / has to work on system without mounted /proc. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add new libmnt_monitor APIKarel Zak2014-12-059-3/+476
| | | | | | | | | | | | It's usually enough to us [e]poll() to monitor kernel mount table, but there is no way how to monitor changes in userspace mount options (e.g. _netdev). The management of these mount options is completely hidden in libmount and /rub/mount/utab is private libmount file. This patch introduces new libmnt_mount API to monitor also userspace mount table. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: cleanup in libmount MakemoduleKarel Zak2014-11-261-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: cleanup library symbol filesKarel Zak2014-11-201-3/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix lock test to use real time to syncKarel Zak2014-11-191-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move all around clock_gettime() to monotonic.cKarel Zak2014-11-192-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use CLOCKGETTIME_LIBSKarel Zak2014-11-191-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix utab entry on remountKarel Zak2014-11-191-0/+3
| | | | | | | | | | mount(8) command does not set ROOT= field to utab entry on remount, for example: mount -oremount,_netdev /mnt Reported-by: Chris Leech <cleech@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add private mnt_context_get_mtab_for_target()Karel Zak2014-11-193-40/+69
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: reuse allocated fs in parserKarel Zak2014-11-191-7/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve mnt_reset_fs()Karel Zak2014-11-191-17/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use monotonic time rater than gettimeofdayKarel Zak2014-11-181-4/+5
| | | | | | Based on patch Alexander Samilovskih <alexsamilovskih@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix memory overflow [AddressSanitizer]Sami Kerola2014-11-181-1/+1
| | | | | | | | | | | | | | | | | | ==10918==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffd795b680 at pc 0x0000004447c6 bp 0x7fffd795b3e0 sp 0x7fffd795ab78 WRITE of size 129 at 0x7fffd795b680 thread T0 #0 0x4447c5 in scanf_common(void*, int, bool, char const*, __va_list_tag*) (/home/src/util-linux/.libs/lt-mount+0x4447c5) #1 0x445892 in sscanf (/home/src/util-linux/.libs/lt-mount+0x445892) #2 0x7fe78709a3d3 in get_filesystems /home/src/util-linux/libmount/src/utils.c:581:7 #3 0x7fe78709a1ba in mnt_get_filesystems /home/src/util-linux/libmount/src/utils.c:622:7 #4 0x7fe7870aa78f in do_mount_by_pattern /home/src/util-linux/libmount/src/context_mount.c:833:7 #5 0x7fe7870a9534 in mnt_context_do_mount /home/src/util-linux/libmount/src/context_mount.c:951:9 #6 0x7fe7870aab2b in mnt_context_mount /home/src/util-linux/libmount/src/context_mount.c:1051:8 #7 0x4ba9f5 in main /home/src/util-linux/sys-utils/mount.c:1107:7 #8 0x7fe785caa03f in __libc_start_main (/usr/lib/libc.so.6+0x2003f) #9 0x4b9f9c in _start (/home/src/util-linux/.libs/lt-mount+0x4b9f9c) Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: replace custom DBG() with include/debug.hKarel Zak2014-11-041-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: cleanup libmount debug testKarel Zak2014-11-031-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: clean up debug, add help debug maskKarel Zak2014-11-032-18/+25
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve kernel command line parsingMike Frysinger2014-10-311-10/+24
| | | | | | | | | | | | | | | | | | | | | | | The current command line parser will stop at the first occurrence of an option, however the kernel does the opposite. So if you have: root=/dev/sda1 root=/dev/sda2 When you look for "root", the kernel will use /dev/sda2, but util-linux uses /dev/sda1. Further, if args are passed to custom init programs, the parser will pick those up as kernel options. So if you have: root=/dev/sda1 -- /foo bar=yes The kernel will stop at the "--" and pass the rest to userland. But if you look for "bar", util-linux will incorrectly return "yes". Ultimately, there's no way for util-linux to exactly parse the command line the same way as the kernel -- we don't know exactly which ones the kernel picks up and which it passes on to userland (either as env vars or as command line args). The kernel passes all unrecognized options. These updates are simple best effort. URL: https://bugs.gentoo.org/526754 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: provide version as int for better compiletime testSøren Holm2014-10-141-0/+3
| | | | Signed-off-by: Søren Holm <sgh@sgh.dk>
* 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>