summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: use err.h in testKarel Zak2013-05-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't ignore root fs on umount -aKarel Zak2013-05-141-4/+1Star
| | | | | | | | | | The release v2.22 (the new umount) introduces a regression when root fs is excluded from umount --all. There is not reason for this exception. The libmount should be smart enough to disable mtab update after rootfs umount. Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use MS_SILENT for /{proc,etc}/filesystemsKarel Zak2013-05-091-1/+3
| | | | | | | | mount(8) needs to be doing silent mounts when doing this brute forcing or when the filesystem is not explicitly specified. Reported-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (test) check writing to a file was successfulSami Kerola2013-04-261-1/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Fix various typosYuri Chornoivan2013-04-261-1/+1
|
* libmount: add debug message to guess FS functionKarel Zak2013-04-121-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mount.nfs segfault, rely on assert() rather than on nonnullKarel Zak2013-04-1210-156/+202
| | | | | | | | | | | | | | | | | We use mnt_optstr_append_option(&o, mnt_fs_get_vfs_options(fs), NULL); in mount.nfs, unfortunately mnt_optstr_append_option() has been marked ass nonnull(1, 2). That's wrong because append and prepend should robust enough to accept NULL as option name. The patch also removes almost all __attribute__((nonnull). It seems better to rely on assert() to have usable feedback. In many cases (nonnull) is premature optimization for the library. This attribute makes sense for things like strlen() or so... Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=948274 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount, col: remove redundant null checks [smatch scan]Sami Kerola2013-04-091-4/+2Star
| | | | | | | | libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free() Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* various: fix shadow declarations [smatch scan]Sami Kerola2013-04-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one libmount/src/tab.c:970:26: originally declared here misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one misc-utils/findmnt.c:473:14: originally declared here fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one fdisks/fdiskdoslabel.c:180:20: originally declared here fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:578:16: originally declared here fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here [kzak@redhat.com: - don't use local 'tmp' in findmnt.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* Spelling fixes.Ville Skyttä2013-04-081-2/+2
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* libmount: use O_CLOEXECKarel Zak2013-04-034-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add version and features to debug outputKarel Zak2013-04-021-3/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make mnt_table_find_* more robust [coverity scan]Karel Zak2013-03-271-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix __mnt_optstr_append_option() nonull attribute [coverity scan]Karel Zak2013-03-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix __mnt_cache_find_tag_value() [coverity scan]Karel Zak2013-03-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix user-mount by root for mount.<type> helpersKarel Zak2013-03-261-0/+22
| | | | | | | | Append options like "exec" "suid" and "dev" to mount.<type> helpers command line if the options are in fstab. This is relevant for root user who calls mount(8) for fstab entries with "user,exec" etc. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_find_mountpoint()Karel Zak2013-03-256-1/+83
| | | | | | | | This is more robust implementation of mnt_get_mountpoint() that does not ignore bind mountpoints (mount --bind /mnt /mnt) as it does not depend on st_dev numbers. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make libmount.h consistent with codeKarel Zak2013-03-251-16/+8Star
| | | | | | | | The function with nonnull attribute are silently optimized by gcc so all "if (foo)" are removed if the "foo" is expected as non-null. It make the code less usable and robust in some situations. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: umount crashes when trying to umount a non-mountpointKarel Zak2013-03-253-3/+6
| | | | | Reported-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: update yearKarel Zak2013-03-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: clean up header fileKarel Zak2013-03-153-186/+144Star
| | | | | | | | | | | * don't teach people C by header files, so use warn_unused_result attribute only on places where we return allocated memory (to avoid leaks in applications). * merge multiple function attributes to the one list to make it usable with gtk-doc Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: ignore name=value if only 'name' is expectedKarel Zak2013-02-281-1/+21
| | | | | | | | | | | | For example mount /srv/www /mnt -o rw,group=woven,dev,suid the group= should not be interpreted as userspace mount option, because umount(8) expects 'group' (without =<value>). Reported-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: export umount mountpoint look up codeKarel Zak2013-02-263-25/+61
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't prepare update for empty mtab/utab on umountKarel Zak2013-02-261-3/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: optimize tab files parsingKarel Zak2013-02-263-20/+33
| | | | | | | - ignore empty files - ignore empty tables Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix a mem leakKarel Zak2013-02-181-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add missing MNT_ERR_AMBIFSKarel Zak2013-02-141-0/+1
| | | | | | | Sorry, the last commit into libmount has been incomplete. Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: correctly propagate ambivalent blkid probing resultsKarel Zak2013-02-133-15/+39
| | | | | | | | libmount ignores "ambivalent probing result" from libblkid and tries filesystems /etc/filesystems. This is incorrect behavior. Reported-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: tags does not start with '/'Karel Zak2013-02-111-1/+1
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=909866 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix two misencodings in commentsBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libmount: keep MS_PROPAGATION flags in mnt_context_set_mflags() resultKarel Zak2013-01-151-0/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to use propagation flags in fstabKarel Zak2013-01-156-20/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux kernel does not allow to change more than one propagation flag by one mount(2) syscall. The flags also cannot be mixed with another mount options. It means that the propagation flags cannot be stored in /etc/fstab, manual "mount --make-* <mountpoint>" is always necessary after successful mount. Painful... This patch implements additional mount(2) after previous successful mount(2) (or exec /sbin/mount.<type>). For example: mount /dev/sda1 /A -o private,unbindable,ro or fstab entry: /dev/sda1 /A auto ro,private,unbindable is implemented by three mount(2) calls: - 1st mounts /dev/sda1 with MS_RDONLY - 2nd sets MS_PRIVATE flag - 3rd sets MS_UNBINDABLE flag. It's the same as as to manually call: mount /dev/sda1 /A -o ro mount --make-private /A mount --make-unbindable /A This solution is not atomic, and umount(2) is not called if propagation flags are not successfully applied, only error is returned. This change does not affect libmount API, so one beautiful day when mount(2) syscall will be improved we can drop this nasty patch. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_fs_get_propagation()Karel Zak2013-01-104-0/+39
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: read optional mountinfo fieldsOndrej Oprala2013-01-106-0/+26
| | | | | | | | | | [kzak@redhat.com: - rename struct member and functions from "propagation" to "optional fields" - split the original patch - fix parser] Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix regression test helperOndrej Oprala2013-01-101-2/+2
| | | | | Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add support for x-mount.mkdir[=<mode>] optionOndrej Oprala2013-01-091-0/+52
| | | | | | | | | If the target directory (mountpoint) does not exist then mount(8) will create it before mount.<type> is executed or mount(2) syscall is called. Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount; add recursive mkdirKarel Zak2013-01-092-0/+54
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>