summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: fix typosKarel Zak2012-12-121-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make mkstemp() more robust [coverity scan]Karel Zak2012-12-121-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use safe_getenv() for testKarel Zak2012-12-101-1/+1
| | | | | Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: avoid endless loop in mnt_get_kernel_cmdline_optionBernhard Voelker2012-12-101-3/+1Star
| | | | | | | | | | | The above function infloops when the name to search for can only be found at the beginning of /proc/cmdline but doesn't match, e.g. when searching for "ro" in "root=/dev/sda1 quiet vga=0x31a". * libmount/src/utils.c (mnt_get_kernel_cmdline_option): Replace while by for loop to ensure the pointer p is incremented. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* libmount: clean nonnull attribute usageKarel Zak2012-12-0411-321/+192Star
| | | | | | | | | | - use __attribute__((nonnull) for functions where we not able to return an return code ("is", "has" and some "get" functions). - use __attribute__((nonnull) for small functions where we always modify any of the function argument (some mnt_optstr_* functions) Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add function attributes to private APIOndrej Oprala2012-11-304-52/+93
| | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add function attributes to public APIOndrej Oprala2012-11-301-243/+584
| | | | | | | | [kzak@redhat.com: - use __ul prefix in public API, - define minimal requirement gcc 3.4] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make debug stuff more robustKarel Zak2012-11-261-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: correctly interpret '*' from /etc/filesystemsKarel Zak2012-11-262-6/+26
| | | | | | | | | | | - single line with '*' in /etc/filesystems means that libmount has to read /proc/filesystems, otherwise /proc/filesystems has to be ignored - mount(2) ENODEV is no reason to break the do_mount_by_pattern() loop when trying to mount by /{etc,proc}/filesystems Reported-by: NeilBrown <neilb@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix support of comma-separated fs types listsGleb Fotengauer-Malinovskiy2012-11-162-7/+13
| | | | | | | | | | | | | | | | # grep cdrom /etc/fstab /dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0 # mount /media/cdrom mount: unknown filesystem type 'udf,iso9660' # mount -t udf,iso9660 /dev/sr0 /media/cdrom mount: /dev/sr0 is write-protected, mounting read-only [kzak@redhat.com: - add some comments - don't try to found external helpers for the types] Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: (recursive) don't call umount(2) for already unmounted targetsKarel Zak2012-11-151-5/+9
| | | | | | | | | In the umount --recursive we follow entries from mountinfo, but the entries maybe already obsolete. Especially if the hierarchy of the mountpoints contains shared subtrees and umount(2) for one entry may generate umount for some other entry too. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't reset NOSWAPMATCH context flagKarel Zak2012-11-151-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't try to play with loopdevs if umount argument is really ↵Karel Zak2012-11-151-3/+6
| | | | | | mountpoint Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: more robust tab filter usageKarel Zak2012-11-152-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: convert /dev/root from mountinfo to the device nameKarel Zak2012-11-081-5/+40
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add private mnt_get_kernel_cmdline_option()Karel Zak2012-11-082-0/+93
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: support loopdevs in mnt_table_is_fs_mounted()Karel Zak2012-10-241-2/+28
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: tiny refactoring in mnt_table_is_fs_mounted()Karel Zak2012-10-231-27/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount, eject: replace index() and rindex() with strrch() or strrchr()Sami Kerola2012-10-221-2/+2
| | | | | | | | | | Both index() and rindex() are legacy functions which may be withdrawn in a future. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fixed comment about paramRaul Gutierrez Segales2012-10-151-1/+1
| | | | Signed-off-by: Raul Gutierrez Segales <rgs@itevenworks.net>
* libmount: don't use umount optimization for -l or -fKarel Zak2012-10-151-1/+3
| | | | | | | | | | The options -l (lazy) and -f (force) means that the mountpoint may be unreadable (for example because NFS server is unreadable). So we should not try to be smart in this case and we should try to minimize number of situations when stat() or readlink() is used for the mountpoint. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix umount file.imgKarel Zak2012-10-051-6/+10
| | | | | | | | The umount optimization (commit 9cc03553f7b8494c7193024eec6e13b903eb2eec) has to be disabled if the umount argument is not a directory. Reported-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: typo fixesGilles Espinasse2012-10-022-3/+3
| | | | Signed-off-by: Gilles Espinasse <g.esp@free.fr>
* libmount: don't setup new loopdev on remount with regular mtabKarel Zak2012-09-261-2/+2
| | | | | | | | | | | | | | | | | | [chroot-i486] root:/tmp$ mount -oloop /tmp/blob /tmp/mnt [chroot-i486] root:/tmp$ mount -o remount,loop,ro /tmp/mnt [chroot-i486] root:/tmp$ mount /dev/loop0 on /tmp/mnt type ext2 (ro,loop) [chroot-i486] root:/tmp$ losetup -a /dev/loop0: [2051]:306957 (/tmp/blob) /dev/loop1: [0005]:2218 (/dev/loop0) [chroot-i486] root:/tmp$ umount /tmp/mnt umount: /tmp/mnt: filesystem umounted, but mount(8) failed: Device or resource busy [chroot-i486] root:/tmp$ losetup -d /dev/loop1 [chroot-i486] root:/tmp$ losetup -d /dev/loop0 Reported-by: g.esp@free.fr Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve debug messageKarel Zak2012-09-251-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: optimize mtab and utab parsing in umountKarel Zak2012-09-254-1/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create 8000 NFS mountpoints: #!/bin/bash mount=/tmp/mount if [ ! -d $mount ]; then mkdir -p $mount fi for dir in {1..8000}; do if [ ! -d $mount/$dir ]; then mkdir -p $mount/$dir fi echo mount $dir mount -t nfs 127.0.0.1:/ $mount/$dir done old version: time ./umount /tmp/mount/2255 real 0m1.254s user 0m1.002s sys 0m0.238s new version: time ./umount /tmp/mount/2244 real 0m0.332s user 0m0.111s sys 0m0.218s Reported-by: chenditang <chendt.fnst@cn.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: user-mounted loopback fs cannot be unmounted by userKarel Zak2012-09-211-1/+1
| | | | | Addresses: https://bugs.archlinux.org/task/31624 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: append loop option when automatically create loopdevKarel Zak2012-09-181-1/+5
| | | | | | | | | The loop option is optional, mount(8) is able to detect that the source path is regular file (image) with known filesystem -- then a loop device is automatically created. In this case we have to store "loop" option to mtab on systems without autoclear loopdev flag. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: detach loopdev on umount if loop option in mtabKarel Zak2012-09-181-0/+4
| | | | | | | | | | | | | [chroot-i486] root:/$ mount --version mount from util-linux 2.22 (libmount 2.22.0: debug) [chroot-i486] root:/$ losetup -a [chroot-i486] root:/$ mount -oloop /tmp/foo_fs /tmp/bar_dir [chroot-i486] root:/$ umount /tmp/foo_fs [chroot-i486] root:/$ losetup -a /dev/loop0: [2051]:387175 (/tmp/foo_fs) Reported-by: g.esp@free.fr Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't remove user= when executed by rootKarel Zak2012-09-121-8/+4Star
| | | | | | | | | | | | | | The original mount(8) allows to store arbitrary user= option to mtab file if called by root user. For example: # mount -f foo /bar -t xxx -o rw,user=kzak the new mount removes the 'user=' and 'users' options at all for root user. This is regression. The original functionality is necessary by 'sshfs' where fuse writes to mtab file by mount(8). Reported-by: Juergen Daubert <jue@jue.li> (and 'horrorStruck' on IRC) Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: segfaults if neither /etc/filesystems nor/proc/filesystems existsKarel Zak2012-09-122-0/+7
| | | | | Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: losetup: remove obsolete encryption supportLudwig Nussel2012-09-111-18/+4Star
| | | | | | | | | | | | | | | kernel cryptoloop is deprecated since ages and support for cryptoloop in util-linux is incomplete/broken. - no password hashing - last 8 bit of key are always set to zero - no binary keys possible (stops reading key at \n and \0) In the past some Distros added the above features with patches. So remove cryptoloop support from util-linux completely to make sure people won't try using it. Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve mnt_table_get_root_fs() docsKarel Zak2012-09-101-1/+12
| | | | | | | Fix info about return value, improve description. Reported-by: Amit <amit.uttam@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use O_CLOEXEC everywhereKarel Zak2012-09-042-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remount does not add entry to mtab fileKarel Zak2012-08-271-12/+15
| | | | | | | | | | | | # mount -n -o ro /dev/sda1 / # mount -o remount,rw /dev/sda1 / For the backward compatibility the command mount(8) should to add a new entry to the file /etc/mtab on remount if the original entry not found (because previous mount has been called with -n). Reported-by: <frinnst> on IRC Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: rewrite mnt_table_is_fs_mounted() to be less aggressiveKarel Zak2012-08-242-24/+52
| | | | | | | | | The old implementation always canonicalizes target (mountpoint) path. It's better to postpone this operation until the path is really necessary (usually it's unnecessary), because readlink() on mountpoint may trigger automounts. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: expand paths at make timeKarel Zak2012-08-151-1/+2
| | | | | | | | | | | | | autoconf docs about *dir variables (e.g bindir): ... A corollary is that you should not use these variables except in makefiles... ...you should not rely on AC_CONFIG_FILES to replace bindir and friends in your shell scripts and other files; instead, let make manage their replacement. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: don't compile lib{mount,blkid} tests when --disable-static specifiedKarel Zak2012-08-021-0/+3
| | | | | | The tests often depend on private (non-API) library functions. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: deduplicate SELinux mount optionsKarel Zak2012-08-011-0/+9
| | | | | | | | | | We already have a clue about SELinux specific mount options in libmount, so it makes sense to deduplicate the options as Linux kernel does not support duplicate SELinux options. (SELinux kernel stuff somehow ignores standard Linux mount conventions...) Requested-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_optstr_deduplicate_option()Karel Zak2012-08-014-9/+74
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move tests to check_PROGRAMSKarel Zak2012-07-301-1/+1
| | | | | | Thanks to Mike Frysinger. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add minisg COPYING filesKarel Zak2012-07-271-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add noreturn function attributeSami Kerola2012-07-261-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix shadow declarationSami Kerola2012-07-261-1/+1
| | | | | | | libmount/src/tab_update.c:203:8: warning: declaration of 'rc' shadows a previous local [-Wshadow] libmount/src/tab_update.c:159:6: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix compiler warning [-Wsign-compare]Karel Zak2012-07-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: check VFS mount options in mnt_diff_tables()Karel Zak2012-07-181-3/+5
| | | | | | | | | | | | | after "-o remount,ro" in unshared namespace is the original VFS entry still read-write: original: 42 21 8:2 / /boot rw,relatime - ext4 /dev/sda2 ro,user_xattr,acl,barrier=1,data=ordered unshared + ro remount: 78 51 8:2 / /boot ro,relatime - ext4 /dev/sda2 ro,user_xattr,acl,barrier=1,data=ordered Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to disable swap between source and targetKarel Zak2012-07-176-4/+37
| | | | | | | | | | | | | | | | | | | | | In some cases (for example if only one mount argument is given) may be mount request ambivalent: # mount /foo and fstab: /dev/sda5 /foo rw 0 0 /foo /bar bind 0 0 The libmount allows to swap between source and target (if source is not LABEL or UUID) by default. The new function mnt_context_disable_swapmatch() allows to disable this feature. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: rename mnt_context_fstab_applied to mnt_context_tab_appliedKarel Zak2012-07-124-6/+6
| | | | | | | The function is also usable in umount to detect is mtab has been applied. Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix typos found by misspellingsBernhard Voelker2012-07-092-2/+2
| | | | | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * Documentation/releases/v2.18-ReleaseNotes: Fix typo in news entry. * NEWS: Likewise. * config/texinfo.tex: Fix typo in comments. * libmount/src/context.c: Fix typo in comment. * libmount/src/fs.c: Likewise. * login-utils/login.c: Likewise. * login-utils.su.1: Fix typo in man page. * sys-utils/chcpu.c: Fix typo in error message. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* libmount: save task ID for mountinfo tilesKarel Zak2012-06-285-3/+57
| | | | | | Add new function mnt_fs_get_tid() to get task ID for the given filesystem. Signed-off-by: Karel Zak <kzak@redhat.com>