summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: Recognize more fuse filesystems as pseudofs and netfsStanislav Brabec2019-03-041-1/+10
| | | | | | | | Add some fuse filesystems to the list of pseudofs and netfs. There are still tens of filesystems that should be evaluated and added. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* libmount: add mnt_table_{find,insert,move}_fs()Karel Zak2019-02-214-5/+182
| | | | | | | | Add functions to insert FS into table to specified position and to move FS between two tables. Co-Author: Tim Hildering <hilderingt@posteo.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix typos [codespell]Sami Kerola2019-02-181-1/+1
| | | | | Reference: https://github.com/codespell-project/codespell Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: (tabdiff) use list_add_tail() in more robust wayKarel Zak2019-02-182-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: check table membership before adding entryTim Hildering2019-02-181-0/+3
| | | | | | | Added validation to function 'mnt_table_add_fs()' to check that added @fs is not already a member of another table. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add support for MS_REMOUNT on --allKarel Zak2019-01-166-0/+158
| | | | | | | | | | | | | This patch add to support for remount-all operation to libmount and mount(8). For example: mount --all -o remount,ro -t vfat to remount read-only all VFAT filesystems. Addresses: https://github.com/karelzak/util-linux/issues/589 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (umount) make mnt_stat_mountpoin() usable for relative pathsKarel Zak2018-12-101-1/+1
| | | | | | | | | # mount -o loop devicefile /mnt/test # umount devicefile umount: devicefile: not mounted. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653781 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: export mnt_guess_system_root() by APIKarel Zak2018-12-105-2/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (fuse) follow only user_id= on umountKarel Zak2018-11-301-27/+8Star
| | | | | | | | | | | | | The option user= is already handled by evaluate_permissions() and by classic mount and umount usermount support. It seems we do not need to duplicate support for user= in is_fuse_usermount(). The option user_id= is fuse specific and it's maintained by libfuse/kernel in /proc/self/mountinfo. This is feature we need to support in umount(8). Addresses: https://github.com/karelzak/util-linux/pull/705 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Support unmount FUSE mountsRian Hunter2018-11-301-1/+81
| | | | | | | | | | | | | | | | | FUSE mounts don't need an fstab entry to be unmounted. This checks if a mount is a FUSE mount before checking for the fstab entry, and if so returns success. [kzak@redhat.com: - use libmount tools for mount options - use namespace switches - cleanup code The requirement is user=<username> or user_id=<uid> in /proc/self/mountinfo for fuse filesystem. The logic is the same as for user= mount options, but in this case it is not maintained by libmount in userspace, but by fuse FS in kernel.] Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: keep namespaces support optionalKarel Zak2018-10-052-4/+21
| | | | | Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix gtkdoc warningKarel Zak2018-09-241-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup licenses sections in the filesKarel Zak2018-08-1624-71/+198
| | | | | | | | | * add SPDX-License-Identifier (see https://spdx.org/licenses/) * add "This file part of libmount from util-linux project." * use proper text for LGPL-2.1-or-later * use the same texts everywhere Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: use SPDX license namesKarel Zak2018-08-161-1/+1
| | | | | | | | | | Let's use standardized names for licenses. The names used by SPDX makes things more obvious at first glance. For complete list see: https://spdx.org/licenses/ Note, this commit does not change any license or so... Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: report context paths on debugKarel Zak2018-08-141-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (utils) fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix compiler warning [-Wcast-qual]Karel Zak2018-07-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: const quialifier cleanupKarel Zak2018-07-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup const in umount codeKarel Zak2018-07-201-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add missing constKarel Zak2018-07-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use const char in swaps parserKarel Zak2018-07-201-1/+1
| | | | | | The parser does not modify the string, so let's keep it "const char". Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use const char in mountinfo parserKarel Zak2018-07-201-2/+3
| | | | | | The parser does not modify the string, so let's keep it "const char". Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use const char in fstab parserKarel Zak2018-07-201-19/+27
| | | | | | The parser does not modify the string, so let's keep it "const char". Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add since tag for new functionsKarel Zak2018-07-191-0/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add -Wno-cast-function-type for pythonKarel Zak2018-07-181-1/+1
| | | | | | | | | | | | | | | | | libmount/python/pylibmount.c:158:19: warning: cast between incompatible function types from ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type] This is generic problem in all Python C code and gcc v8. The another possible (and probably more correct) way is to add unused argument to all API functions. Unfortunately, this solution is pretty invasive. The question is if gcc is not too paranoid in this case. For more details see https://bugs.python.org/issue33012. It seems Python guys also prefer CFLAGS modification for now. Signed-off-by: Karel Zak <kzak@redhat.com>
* * break up large strings for PySys_WriteStdout()Frank Schaefer2018-07-111-13/+43
|
* libmount: (mountinfo) parse empty strings in sourceAlban Crequy2018-07-101-5/+28
| | | | | | | | | | | | | | | | | | | | | The source of a mount in /proc/self/mountinfo can unfortunately be an empty string. Before this patch, 'mount' and 'mountpoint' fail as following: $ sudo mount -t tmpfs "" /tmp/bb $ mount mount: /proc/self/mountinfo: parse error at line 64 -- ignored $ mountpoint /tmp/bb /tmp/bb is not a mountpoint This patch fixes the parsing. It is unfortunately more complex because sscanf() does not handle fields with empty strings easily. Other projects have their own parser for mountinfo and have similar issues. I know of runc and runtime-tools (I'll send a patch for those two) but there are probably others. Signed-off-by: Alban Crequy <alban@kinvolk.io>
* libmount: switch namespace when appropriateVaclav Dolezal2018-06-114-19/+241
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: support for namespaces for helpersVaclav Dolezal2018-06-112-5/+37
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: make errno usable after mnt_context_set_target_ns()Karel Zak2018-06-111-4/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: added error MNT_ERR_NAMESPACEVaclav Dolezal2018-06-113-0/+22
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: note namespaces in mnt_reset_context() docsVaclav Dolezal2018-06-111-2/+3
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: add support for switching namespacesVaclav Dolezal2018-06-115-0/+242
| | | | | | | [kzak@redhat.com: - cosmetic changes, add some comments] Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: keep MS_MOVE as flagKarel Zak2018-06-011-1/+4
| | | | | | | | The previous commit 4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0 replaced all operations by strings, but it does not work for MS_MOVE as this operation is not supported in fstab by libmount. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use MS_MGC_VAL magic in mount(2) syscallKarel Zak2018-06-013-4/+3Star
| | | | | | | | | Specifying MS_MGC_VAL was required in kernel versions prior to 2.4, but since Linux 2.4 is no longer required and is ignored if specified The minimal kernel requirement for util-linux is Linux v2.6. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve MS_REC usageKarel Zak2018-06-013-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | libmount allows to split one library (mount(8)) call to multiple mount(2) syscalls, for example --rbind --make-rslave in this case we have to be careful with MS_REC because the flag is applied to multiple operations. # strace -e mount mount --rbind --make-rslave /mnt/A /mnt/B Old version: mount("/mnt/A", "/mnt/B", 0x13ecac0, MS_MGC_VAL|MS_BIND, NULL) = 0 mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0 Fixed version: mount("/mnt/A", "/mnt/B", 0x1f22ac0, MS_MGC_VAL|MS_BIND|MS_REC, NULL) = 0 mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0 Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1584443 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: include sys/mount.h on Linux onlyKarel Zak2018-05-291-1/+1
| | | | | Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=891812 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: accept another flags on MS_REMOUNT|MS_BINDKarel Zak2018-05-282-14/+11Star
| | | | | | | | | | | | | | | | | | | | | | The current libmount MS_REMOUNT|MS_BIND support is restricted to MS_RDONLY (read-only bind mount). This is too restrictive as Linux kernel supports bind-remount for arbitrary VFS flags. After this update you can use # mount /dev/sdc1 /mnt/A # mount --bind -onosuid,noexec /mnt/A /mnt/B # findmnt /dev/sdc1 -oTARGET,SOURCE,FS-OPTIONS,VFS-OPTIONS TARGET SOURCE FS-OPTIONS VFS-OPTIONS /mnt/A /dev/sdc1 rw,stripe=512,data=ordered rw,relatime /mnt/B /dev/sdc1 rw,stripe=512,data=ordered rw,nosuid,noexec,relatime The "mount --bind" is composed from two syscalls of course (1st is bind, 2nd is bind,remount,nosuid,noexec). Addresses: https://github.com/karelzak/util-linux/issues/637 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix compiler warning [-Wunused-parameter]Karel Zak2018-05-031-4/+2Star
| | | | | Reported-by: L A Walsh <lkml@tlinx.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve docs about mnt_context_mount() return codesKarel Zak2018-04-261-3/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.NeilBrown2018-04-181-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | When you bind-mount a subdirectory of a local filesystem, the path to that subdirectory appears as the fourth field in mountinfo. For nfs mounts, the fourth field is always "/", and the subdirectory part is appended to the "special" (aka "device") field. This is consistent with historical NFS usage which always includes a path in the fs_spec field. libmount needs to know about this when "mount -a" checks to see if a filesystem is already mounted. Without this fix, fstab lines like: server::/path /dir nfs defaults 0 0 /dir/subdir /mnt/test none bind 0 0 result in a new mount at /mnt/test every time "mount -a" is run. [kzak@redhat.com: - use strappend() rather than asprintf()] Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* bugfix: fix possible segfault during umount -aRichard Fuchs2018-04-171-1/+2
| | | | | | | mnt_context_get_mtab() doesn't set its return **tb argument on error, and so in mnt_context_next_umount() mtab will remain uninitialized on error, later resulting in cxt->mtab containing garbage, possibly resulting in segfault on exit.
* libmount: include sys/mount.h only if necessaryKarel Zak2018-03-221-1/+8
| | | | | Addresses: https://github.com/systemd/systemd/issues/8507 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (docs) update yearKarel Zak2018-03-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix example in docsKarel Zak2018-03-201-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/599 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: deallocate on /proc/swaps parse errorKarel Zak2018-03-201-5/+6
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/596 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make sure we deallocate on parse errorKarel Zak2018-03-201-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make libmount.h more robustKarel Zak2018-03-201-0/+1
| | | | | | | | | | Let's include sys/mount.h to be sure that our local libmount fallbacks are not used by default to avoid possible conflicts with later included sys/mount.h. Addresses: https://github.com/systemd/systemd/pull/8452 Reported-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix fs pattern usage in mount --allKarel Zak2018-03-061-0/+12
| | | | | | | | | | | | | | | | | The command "mount -a -t <pattern>" uses the -t as pattern to filter fstab entries. And "mount -t <type>" is used to specify FS type. Unfortunately libmount does not care about this difference when it calls standard mount functionality. The original pattern is still in the library control struct and mnt_do_mount() tries to use it as FS type. This patch is just bugfix. Maybe the long term solution would be to differentiate between the pattern and type in the library API. Now the library follows mount(8) command line and it's little bit messy. Reported-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add missing macro to docsKarel Zak2018-02-211-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>