summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: fix comment referring to passno fieldPatrick Steinhardt2019-08-201-1/+1
| | | | | | | | | | | There's an obvious copy-paste error in `mnt_parse_table_line` when referring to the 6th field of the fstab format, where it says "freq" instead of "passno". This has probably been copied from the 5th field, which is in fact correctly labelled as "freq". Fix the mistake by changing the comment to say "passno" instead. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* libmount: Keep the mnt_tab info for the existent dest in mnt_copy_fs()Kevin Hao2019-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | The "umount -f -a -r" get stuck in a endless loop when run with a mountinfo like below: 15 0 179:2 / / ro,relatime - ext4 /dev/root ro 16 15 0:6 / /dev rw,relatime - devtmpfs devtmpfs rw,size=242896k,nr_inodes=60724,mode=755 17 15 0:4 / /proc rw,relatime - proc proc rw 18 15 0:15 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k 19 15 0:16 / /sys rw,relatime - sysfs sysfs rw 20 19 0:7 / /sys/kernel/debug rw,relatime - debugfs debugfs rw 21 15 0:17 / /run rw,nosuid,nodev - tmpfs tmpfs rw,mode=755 22 15 0:18 / /var/volatile rw,relatime - tmpfs tmpfs rw 23 15 179:1 / /boot rw,relatime - vfat /dev/mmcblk0p1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 24 16 0:19 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000 25 18 0:20 / /mnt/.psplash rw,relatime - tmpfs tmpfs rw,size=40k The reason is that the two same mnt entry "/mnt/.psplash" will cause the dst->tab set to NULL when umount this mnt entry the second time. This will trigger an endless loop in mnt_reset_table() because that mnt entry is linked on the libmnt_table but its .tab is set to NULL. Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
* libmount: fix potential null pointer dereferenceSami Kerola2019-07-121-1/+3
| | | | | | | | | | This is false positive warning, but lets silence it so that if and when warnings crop up they are easy to notice and take seriously. libmount/src/optstr.c:354:29: warning: potential null pointer dereference [-Wnull-dereference] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix docs typoKarel Zak2019-06-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (docs) add reference to v2.33 and v2.34Karel Zak2019-06-075-1/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add selinuxfs between pseudo filesystemsKarel Zak2019-05-291-0/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add bpf between pseudo filesystemsKarel Zak2019-05-291-0/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1714826 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: avoid possible null pointer dereference [cppcheck]Sami Kerola2019-05-181-6/+9
| | | | | | [libmount/src/monitor.c:797]: (warning) Possible null pointer dereference: me Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix memory leak on error [coverity scan]Karel Zak2019-05-151-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix "maybe be" duplicationAustin English2019-05-151-1/+1
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* libmount: return errno on failed fstab stat()Karel Zak2019-05-091-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix compiler warning [-Wsometimes-uninitialized]Karel Zak2019-04-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix memleak on parse errorsKarel Zak2019-04-151-3/+11
| | | | | Addresses: https://github.com/systemd/systemd/pull/12252 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use sscanf() for swaps parsingKarel Zak2019-04-081-46/+74
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use sscanf() for mountinfo parsingKarel Zak2019-04-081-91/+113
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use sscanf() for fstab parsingKarel Zak2019-04-081-67/+68
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve fs referencing in tablesTim Hildering2019-03-086-9/+32
| | | | | | | | | | | | | | | * Added member 'struct libmnt_table *tab' to libmnt_fs structure. * Added 'mnt_fs_get_table()'. * Removed overhead from 'mnt_table_{insert,move,remove}_fs(). * Added check to 'mnt_table_set_iter()' that entry is member of table. [kzak@redhat.com: - add to libmount.sys - add to docs - cleanup commit message - set fs->tab = NULL before mnt_unref_fs() in mnt_table_remove_fs()] Signed-off-by: Tim Hildering <hilderingt@posteo.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>