Commit Graph

452 Commits

Author SHA1 Message Date
Karel Zak 9104cd2850 libmount: use err.h in test
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-14 23:40:51 +02:00
Karel Zak 0b56c45956 libmount: don't ignore root fs on umount -a
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>
2013-05-14 10:32:56 +02:00
Karel Zak a21aa92fd4 libmount: use MS_SILENT for /{proc,etc}/filesystems
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>
2013-05-09 09:25:31 +02:00
Sami Kerola 69f1cad4ca libmount: (test) check writing to a file was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:40:27 +02:00
Yuri Chornoivan ef75bc880e Fix various typos 2013-04-26 12:50:03 +02:00
Karel Zak 2d87a7dc84 libmount: add debug message to guess FS function
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-12 15:04:57 +02:00
Karel Zak 4569bbeab7 libmount: fix mount.nfs segfault, rely on assert() rather than on nonnull
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>
2013-04-12 12:35:34 +02:00
Sami Kerola 9e01635e32 libmount, col: remove redundant null checks [smatch scan]
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>
2013-04-09 12:26:42 +02:00
Sami Kerola c9f63764dc various: fix shadow declarations [smatch scan]
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>
2013-04-09 12:19:25 +02:00
Ville Skyttä 58c41e15b3 Spelling fixes.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2013-04-08 17:06:55 +02:00
Karel Zak 1eb8539d3b libmount: use O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 16:14:03 +02:00
Karel Zak 39de73f5f1 libmount: add version and features to debug output
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-02 22:26:12 +02:00
Karel Zak 4cd271adc1 libmount: make mnt_table_find_* more robust [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:47:46 +01:00
Karel Zak 66c00f1f95 libmount: fix __mnt_optstr_append_option() nonull attribute [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:28:42 +01:00
Karel Zak b48d80fbe0 libmount: fix __mnt_cache_find_tag_value() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:22:31 +01:00
Karel Zak 17206c059d libmount: fix user-mount by root for mount.<type> helpers
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>
2013-03-26 16:05:07 +01:00
Karel Zak dcc15ce5af libmount: add mnt_table_find_mountpoint()
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>
2013-03-25 13:56:31 +01:00
Karel Zak ece5d1136b libmount: make libmount.h consistent with code
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>
2013-03-25 13:40:06 +01:00
Karel Zak 52a285bf4e libmount: umount crashes when trying to umount a non-mountpoint
Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-25 09:17:52 +01:00
Karel Zak 2029dbd9b1 docs: update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-15 15:18:22 +01:00
Karel Zak a3bb7e65c4 libmount: clean up header file
* 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>
2013-03-15 14:59:22 +01:00
Karel Zak 6a83f8ecd7 libmount: ignore name=value if only 'name' is expected
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>
2013-02-28 12:55:30 +01:00
Karel Zak 6506a86601 libmount: export umount mountpoint look up code
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26 14:19:05 +01:00
Karel Zak 2b90c471de libmount: don't prepare update for empty mtab/utab on umount
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26 14:17:42 +01:00
Karel Zak dad88cb357 libmount: optimize tab files parsing
- ignore empty files
 - ignore empty tables

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26 14:16:53 +01:00
Karel Zak 45b6445fe1 libmount: fix a mem leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18 12:59:33 +01:00
Karel Zak 190b5ee3d2 libmount: add missing MNT_ERR_AMBIFS
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>
2013-02-14 09:20:30 +01:00
Karel Zak 82a2c1600d libmount: correctly propagate ambivalent blkid probing results
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>
2013-02-13 12:36:10 +01:00
Karel Zak b8f2d06ed7 libmount: tags does not start with '/'
References: https://bugzilla.redhat.com/show_bug.cgi?id=909866
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-11 16:53:11 +01:00
Benno Schulenberg 123ddced43 textual: fix two misencodings in comments
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:05 +01:00
Karel Zak 56a21c9336 libmount: keep MS_PROPAGATION flags in mnt_context_set_mflags() result
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-15 16:08:41 +01:00
Karel Zak 6498ece0e7 libmount: allow to use propagation flags in fstab
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>
2013-01-15 13:55:29 +01:00
Karel Zak 4b9d67a23d libmount: add mnt_fs_get_propagation()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10 15:58:52 +01:00
Ondrej Oprala e47a19312f libmount: read optional mountinfo fields
[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>
2013-01-10 14:52:24 +01:00
Ondrej Oprala 0770effc00 libmount: fix regression test helper
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10 14:52:12 +01:00
Ondrej Oprala 701c69617e mount: add support for x-mount.mkdir[=<mode>] option
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>
2013-01-09 18:52:32 +01:00
Karel Zak fd73f46830 libmount; add recursive mkdir
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-09 18:05:08 +01:00
Karel Zak 51479069e1 libmount: fix typos
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12 21:02:11 +01:00
Karel Zak 6fc8122490 libmount: make mkstemp() more robust [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12 13:32:52 +01:00
Karel Zak cd79396704 libmount: don't use safe_getenv() for test
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10 13:31:08 +01:00
Bernhard Voelker 2c0ba1ce30 libmount: avoid endless loop in mnt_get_kernel_cmdline_option
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>
2012-12-10 13:15:19 +01:00
Karel Zak ba2bdf41c4 libmount: clean nonnull attribute usage
- 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>
2012-12-04 14:22:39 +01:00
Ondrej Oprala 90cd46cbbd libmount: add function attributes to private API
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-30 10:34:08 +01:00
Ondrej Oprala a639778557 libmount: add function attributes to public API
[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>
2012-11-30 10:34:01 +01:00
Karel Zak 1e7f2e6cf4 libmount: make debug stuff more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-26 12:19:02 +01:00
Karel Zak ec8121b103 libmount: correctly interpret '*' from /etc/filesystems
- 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>
2012-11-26 11:21:40 +01:00
Gleb Fotengauer-Malinovskiy bbf9ce79ec libmount: fix support of comma-separated fs types lists
# 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>
2012-11-16 10:31:49 +01:00
Karel Zak ae978c4d6c umount: (recursive) don't call umount(2) for already unmounted targets
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>
2012-11-15 16:44:07 +01:00
Karel Zak f3107fc244 libmount: don't reset NOSWAPMATCH context flag
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-15 16:42:05 +01:00
Karel Zak 224f5b92ac libmount: don't try to play with loopdevs if umount argument is really mountpoint
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-15 15:59:59 +01:00
Karel Zak 9be1607fa3 libmount: more robust tab filter usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-15 15:35:24 +01:00
Karel Zak 3da7f698c1 libmount: convert /dev/root from mountinfo to the device name
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-08 14:43:38 +01:00
Karel Zak f308ec19a7 libmount: add private mnt_get_kernel_cmdline_option()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-08 11:59:36 +01:00
Karel Zak b2cbe99f33 libmount: support loopdevs in mnt_table_is_fs_mounted()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-24 23:44:11 +02:00
Karel Zak 449a7646d0 libmount: tiny refactoring in mnt_table_is_fs_mounted()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 15:45:50 +02:00
Sami Kerola 913e43b8e2 libmount, eject: replace index() and rindex() with strrch() or strrchr()
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>
2012-10-22 10:13:32 +02:00
Raul Gutierrez Segales 39e119f5dc libmount: fixed comment about param
Signed-off-by: Raul Gutierrez Segales <rgs@itevenworks.net>
2012-10-15 17:13:23 +02:00
Karel Zak 6d5d2b5fd3 libmount: don't use umount optimization for -l or -f
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>
2012-10-15 11:10:50 +02:00
Karel Zak dc3ea13356 libmount: fix umount file.img
The umount optimization (commit 9cc03553f7)
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>
2012-10-05 20:38:49 +02:00
Gilles Espinasse 45683be543 textual: typo fixes
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
2012-10-02 10:24:26 +02:00
Karel Zak 1ae3d0d932 libmount: don't setup new loopdev on remount with regular mtab
[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>
2012-09-26 11:25:01 +02:00
Karel Zak ab6c01925c libmount: improve debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-25 17:04:21 +02:00
Karel Zak 4709c9e6a1 libmount: optimize mtab and utab parsing in umount
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>
2012-09-25 16:47:18 +02:00
Karel Zak 9af2433419 libmount: user-mounted loopback fs cannot be unmounted by user
Addresses: https://bugs.archlinux.org/task/31624
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-21 17:15:07 +02:00
Karel Zak e8cd181967 libmount: append loop option when automatically create loopdev
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>
2012-09-18 11:40:44 +02:00
Karel Zak 475c30d061 libmount: detach loopdev on umount if loop option in mtab
[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>
2012-09-18 11:22:17 +02:00
Karel Zak 4be900c51d libmount: don't remove user= when executed by root
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>
2012-09-12 14:27:12 +02:00
Karel Zak 3de77c2173 libmount: segfaults if neither /etc/filesystems nor/proc/filesystems exists
Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-12 11:57:19 +02:00
Ludwig Nussel 5cf05c7147 mount: losetup: remove obsolete encryption support
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>
2012-09-11 10:46:11 +02:00
Karel Zak c667aff93f libmount: improve mnt_table_get_root_fs() docs
Fix info about return value, improve description.

Reported-by: Amit <amit.uttam@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-10 10:30:11 +02:00
Karel Zak d39c2b438f libmount: use O_CLOEXEC everywhere
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-04 16:49:28 +02:00
Karel Zak c3085df65f libmount: remount does not add entry to mtab file
# 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>
2012-08-27 19:26:07 +02:00
Karel Zak 975e14bd4a libmount: rewrite mnt_table_is_fs_mounted() to be less aggressive
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>
2012-08-24 18:29:51 +02:00
Karel Zak d4baf92e50 build-sys: expand paths at make time
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>
2012-08-15 02:06:53 +02:00
Karel Zak 43ffdc82fa build-sys: don't compile lib{mount,blkid} tests when --disable-static specified
The tests often depend on private (non-API) library functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-02 20:19:14 +02:00
Karel Zak f1f9a46abd libmount: deduplicate SELinux mount options
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>
2012-08-01 17:52:22 +02:00
Karel Zak 6870636c7f libmount: add mnt_optstr_deduplicate_option()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-01 17:51:43 +02:00
Karel Zak 922e6775e0 build-sys: move tests to check_PROGRAMS
Thanks to Mike Frysinger.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-30 17:59:16 +02:00
Karel Zak aa8135f81b build-sys: add minisg COPYING files
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-27 00:56:28 +02:00
Sami Kerola 61d97775ef libmount: add noreturn function attribute
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26 13:51:29 +02:00
Sami Kerola 8228372b0e libmount: fix shadow declaration
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>
2012-07-26 11:09:38 +02:00
Karel Zak 3d660e74fc libmount: fix compiler warning [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:44:37 +02:00
Karel Zak 994871c59f libmount: check VFS mount options in mnt_diff_tables()
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>
2012-07-18 22:09:24 +02:00
Karel Zak e39cbb7603 libmount: allow to disable swap between source and target
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>
2012-07-17 21:57:22 +02:00
Karel Zak b11c9b7ee3 libmount: rename mnt_context_fstab_applied to mnt_context_tab_applied
The function is also usable in umount to detect is mtab has been
applied.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-12 17:43:34 +02:00
Bernhard Voelker 7007991f6f docs: fix typos found by misspellings
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>
2012-07-09 16:56:30 +02:00
Karel Zak f7f29b5640 libmount: save task ID for mountinfo tiles
Add new function mnt_fs_get_tid() to get task ID for the given filesystem.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-28 15:40:16 +02:00
Karel Zak 31a938ac38 build-sys: enable libmount and libblkid docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:54 +02:00
Karel Zak f38e5ff355 build-sys: cleanup .gitignore files
- move all binaries to top-level .gitignore
 - remove unnecessary */.gitignore files

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:54 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak bc94024d08 build-sys: convert libmount/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 17:49:37 +02:00
Karel Zak defa0710b6 lib/loopdev: use warn_unused_result forimportant functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-21 10:40:43 +02:00
Karel Zak 23966912fb libmount: improve ifdef HAVE_LIBSELINUX stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-19 16:19:18 +02:00
Karel Zak d5f9b6e5fb Merge branch '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit
* '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit:
  lsblk: use blkdev_scsi_type_to_name()
  blkdev: add blkdev_scsi_type_to_name()
  wipefs: use symbolic value for markup mode
  eject: inform if CD-ROM drive is not ready
  docs: clean up partx.8 manual
  include: fix void pointer arithmetics warnings
  sysfs: fix printf format warnings
  build: fix unused parameter warnings
  build: fix redundant redeclaration warnings
  include: fix spurious list.h warnings
  uuidd: use output redirection which works [checkbashisms]
  blkid: fix realloc memory leak [cppcheck]
  setarch: do not use -1 as array index [cppcheck]
2012-06-15 12:44:17 +02:00
Karel Zak 9d670a2ab4 libmount: make some string operations more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-15 12:26:05 +02:00
Petr Uzel 3cbc5a9559 libmount: fix trivial typos
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-06-15 11:52:13 +02:00
Petr Uzel bf15afd1e7 libmount: fix read before allocated buffer
valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux
....
==21359== Invalid read of size 1
==21359==    at 0x415AC6: mnt_optstr_remove_option_at (optstr.c:310)
==21359==    by 0x416358: mnt_optstr_apply_flags (optstr.c:716)
==21359==    by 0x40DFBF: mnt_context_prepare_mount (context_mount.c:86)
==21359==    by 0x40EB5A: mnt_context_mount (context_mount.c:782)
==21359==    by 0x4058B0: main (mount.c:918)
==21359==  Address 0x51cd5bf is 1 bytes before a block of size 10 alloc'd
==21359==    at 0x4C297CD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x4C29957: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x415780: __mnt_optstr_append_option (optstr.c:188)
==21359==    by 0x412822: mnt_fs_append_options (fs.c:764)
==21359==    by 0x409288: mnt_context_append_options (context.c:733)
==21359==    by 0x4053F0: main (mount.c:776)

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-06-15 11:52:10 +02:00
Petr Uzel 31821efc29 libmount: plug a memory leak in exec_helper()
valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux
....
==21359== 28 bytes in 1 blocks are definitely lost in loss record 1 of 1
==21359==    at 0x4C298B2: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x415780: __mnt_optstr_append_option (optstr.c:188)
==21359==    by 0x415CB5: mnt_optstr_set_option (optstr.c:387)
==21359==    by 0x40D778: do_mount (context_mount.c:192)
==21359==    by 0x40E6A9: mnt_context_do_mount (context_mount.c:685)
==21359==    by 0x40EB7B: mnt_context_mount (context_mount.c:786)
==21359==    by 0x4058B0: main (mount.c:918)

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-06-15 11:52:05 +02:00
Karel Zak e90e7401d0 libmount: don't use nosuid,noexec,nodev for cifs user=foo
mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux

is incorrectly translated to

   mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ...

The command mount(8) should be sensitive to "user" (without "=<name>")
only. The correct cifs command line is:

   mount.cifs -o user=root,password=linux

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 14:19:26 +02:00
Karel Zak 6b741564d8 libmount: don't generate empty option strings
mount -t foo something /mnt/test -o user=root,password=linux

generates

 "rw,noexec,nosuid,nodev,password=linux,,user=root"

options string for /sbin/mount.foo, the ",," is incorrect.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 11:38:53 +02:00
Sami Kerola 838c5f6bb8 build: fix unused parameter warnings
pager.c:203:14: warning: unused parameter 'argc' [-Wunused-parameter]
pager.c:203:26: warning: unused parameter 'argv' [-Wunused-parameter]

randutils.c:108:14: warning: unused parameter 'argc' [-Wunused-parameter]
randutils.c:108:26: warning: unused parameter 'argv' [-Wunused-parameter]

optstr.c:774:37: warning: unused parameter 'optstr' [-Wunused-parameter]
optstr.c:774:51: warning: unused parameter 'value' [-Wunused-parameter]
optstr.c:774:65: warning: unused parameter 'valsz' [-Wunused-parameter]
optstr.c:774:79: warning: unused parameter 'next' [-Wunused-parameter]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:51:35 +02:00
Sami Kerola 0e9b73d3fb build: fix redundant redeclaration warnings
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:51:35 +02:00
Dave Reisner 5e7b834002 libmount: trim leading commas from each options string
Fixes a bug in option string parsing wherein a line such as:

  ro,relatime,,nosuid,nodev

Will be seen as only the tokens "ro" and "relatime" after the parser
encounters a zero length (and erroneously declared NULL) option.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-05 15:40:11 +02:00
Bernhard Voelker 871ffd0960 Fix typos in comments and wall's man page
Culprits identified again by (newer) misspellings:

  $ git ls-files | misspellings -f - | grep -v '^po/'

* wall: Fix typo in man page.
* Fix typos in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-06-05 14:37:26 +02:00
Karel Zak 61f5ff6cb4 libmount: add MNT_ERR_MOUNTOPT
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-28 12:49:55 +02:00
Karel Zak 82756a747e libmount: add MNT_ERR_LOOPDEV
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-28 12:26:36 +02:00
Karel Zak dffdc98958 libmount: use stderr for initial debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-23 11:05:37 +02:00
Dave Reisner 7383ebceec libmount: Use binary search to compare pseudofs
It's the responsibility of anyone adding to this list in the future to
ensure that the list remains sorted.

While we're at it, expand this list of known pseudofs types.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-23 09:56:51 +02:00
Karel Zak fa705b5441 libmount: don't canonicalize target
Note that mountpoint (target_ paths in /proc/mounts and /proc/self/mountinfo
are always canonicalized by kernel.

 * for umount we don't have to canonicalize target
   by default if the mountpoint is found in /proc/self/mountinfo

 * in mnt_table_find_target() is unnecessary to canonicalize target paths
   if the table of the filesystems is read from /proc/self/mountinfo

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=820707
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-17 12:10:43 +02:00
Karel Zak 6257e44582 libmount: close device fd (to avoid mount(2) EBUSY)
libmount uses libblkid to detect filesystem type. Unfortunately, the
blkid probe struct is not freed before mount(2), it means that the
device is still open and mount(2) may return EBUSY.

We don't need persistent blkid stuff in libmount, so let's close
all immediately after device probing.

Reported-by: David Zeuthen <zeuthen@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-27 10:30:08 +02:00
Dave Reisner cd3d6c5bd0 libmount: expose mnt_get_mountpoint as external API 2012-04-26 09:38:02 +02:00
Karel Zak 677ff053f6 libmount: add mnt_table_find_devno()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-25 09:49:50 +02:00
Karel Zak 54a3d5eeec libmount: fix mnt_context_guess_fstype()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-25 09:05:24 +02:00
Karel Zak 47dea49b4c libmount: add special MNT_ERR_ codes
... to detect some situations where standard -errno is too generic.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-24 11:57:32 +02:00
Karel Zak ae5afe071f libmount: fix mount by pattern
mount /foo /bar

without entry in /etc/fstab the mount command tries all filesystems
from /{etc,proc}/filesystems. We should NOT call mount(2) more then
once if the syscall returns for example ENOENT, acceptable is only
EINVAL.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-24 11:52:04 +02:00
Bernhard Voelker 455fe9a075 Fix typos found by misspellings
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:

  $ git ls-files | grep -v ^po/ | misspellings -f -

* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-04-23 13:16:35 +02:00
Karel Zak cff632afc9 libmount: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:33:59 +02:00
Karel Zak 5d451abbbf libmount: add mnt_context_get_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 10:06:35 +02:00
Karel Zak e01c731992 libmount: add mnt_context_fstab_applied()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 11:36:32 +02:00
Karel Zak ce4dd666f4 libmount: add support to parse /proc/swaps
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-03 13:20:32 +02:00
Karel Zak 7104bedb78 libmount: clean up MNT_FMT_* usage in parser
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-03 11:32:12 +02:00
Dong Hao c7b0af96bc mount: fix recursively propagation mounting
Provide the recursive flag of propagation mounting. Recursive flag could
be used together with propagation flag.

[kzak@redhat.com: - add MS_SILENT to acceptable propagation flags,
                  - fix new code in libmount too]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Dong Hao <haodong@linux.vnet.ibm.com>
2012-03-21 12:35:54 +01:00
Karel Zak ce22ccd08c libmount: improve mnt_tables_is_mounted
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 11:22:09 +01:00
Karel Zak 1e1df43ca2 libmount: add configfs to pseudofs list
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 10:42:47 +01:00
Karel Zak 7293e97a42 libmount: fix "already mounted" detection on systems with mtab
For systems with regular mtab the fs->root should be ignored in
"already mounted" heuristic.

Reported-by: Matt Burgess <matthew@linuxfromscratch.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-09 13:11:24 +01:00
Dave Reisner bf91904c24 libmount: avoid infinite loop in child fs iteration
In early userspace, the rootfs is mounted with itself as its parent.
Example /proc/self/mountinfo:

1 1 0:1 / / rw - rootfs rootfs rw
14 1 0:3 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
15 1 0:13 / /sys rw,nosuid,nodev,noexec,relatime - sysfs sys rw
16 1 0:5 / /dev rw,nosuid,relatime - devtmpfs dev rw,size=506956k
17 1 0:14 / /run rw,nosuid,nodev,relatime - tmpfs run rw,mode=755

This causes an infinite loop in mnt_table_next_child_fs, and is
evidenced by a crash via infinite recursion in findmnt. Simply catch the
condition where the ID of the parent is the ID of the current fs we're
examining and skip over it to the next mount in the table.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 16:06:02 +01:00
Karel Zak 379e84390a libmount: cleanup flags usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-07 10:45:48 +01:00
Karel Zak 6699e742f2 libmount: add mnt_fs_streq_target() and export all mnt_fs_streq_*
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 15:53:55 +01:00
Karel Zak ab8c6e0569 libmount: add mnt_fs_streq_srcpath()
We have to be careful with "none" or another dummy sources for pseudo
filesystems. These strings should be canonicalized or compared as a
paths.

The function is not exported by library API.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 13:29:39 +01:00
Karel Zak 41d6af28c3 libmount: cosmetic changes around "none"
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 11:23:34 +01:00
Dave Reisner d0ce7c07e6 libmount: don't treat "none" differently
This causes more problems than it solves. In the latest edition:

  # mount -t proc none foo
  mount: foo: mount failed: Invalid argument

A check for source and target fails in mnt_context_apply_fstab()
because, even though they were indeed specified on the cmdline,
__mnt_fs_set_source_ptr() altered this and NULL'd out the source.

If you're able to mount this device via other means, other tools start
reporting oddities, such as mount's output:

  (null) on /foo type proc (rw,relatime)

or findmnt:

  TARGET      SOURCE FSTYPE OPTIONS
  /foo               proc   rw,relatime

Simply treat "none" like any other source when passed in.

[kzak@redhat.com: - don't translate NULL to "none" in mnt_fs_set_source()]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 09:48:23 +01:00
Sami Kerola f06b43285d build-sys: enhance readability of the autotools files
Several horizontal lists are turned to vertical, and sorted to
alphabetical order. Additionally spaces are converted to tabs where
ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-28 13:29:35 +01:00
Karel Zak 772cce373f libmount: allow empty source for mount(2) syscall
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797438
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-28 00:02:30 +01:00
Karel Zak 9bf9690114 libmount: use mount.<type> -s for NFS only
Unfortunately, it seems that for example mount.cifs don't care about
the API, so we need exception like the original mount(8).

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-27 16:44:38 +01:00
Karel Zak 6eba938376 libmount: canonicalize targets from fstab on mount -a
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-24 22:52:45 +01:00
Karel Zak ea371ea30e libmount: optimize for paths with tailing slash
mnt_table_find_target() canonicalizes paths by libmnt cache, but it's
overkill if the difference between paths is tailing slash only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-24 21:30:22 +01:00
Karel Zak 59e32a1f24 libmount: canonicalize all paths from (fs)tab
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797216
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-24 20:25:43 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak 94b0c44fb7 mount: distinguish between MS_COMMENT flags (netdev, nofail, ...)
Since util-linux 2.12h (year 2004) there is only one flag for all
dummy options like _netdev or nofail. Unfortunately it means that when
mount(8) composes the final mount options string for mtab (or for
mount.<type> helpers) the string is generated incorrectly.

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-23 15:16:17 +01:00
Karel Zak cad39614a6 libmount: clean up context docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-23 12:31:56 +01:00
Karel Zak 3fcf5e1b79 docs: update copyright years
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-22 13:07:14 +01:00
Karel Zak ee3140752f libmount: cleanup docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-22 13:02:17 +01:00
Dave Reisner a33df88c45 libmount: remove teaser proto for mnt_table_get_name
This function was never implemented, but the proto has existed since the
inception of the library. As the libmnt_table struct doesn't include a
member necessary to carry the name of the table, simply discard this
prototype. If ever a need to break ABI comes up, perhaps this could be
revisited.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-02-22 11:52:44 +01:00
Karel Zak 178537eda9 libmount: use #ifdef fr selinux specific variables
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-03 12:35:36 +01:00
Karel Zak a9ddf316c8 libmount: don't ignore chmod/own errors
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-02 14:39:02 +01:00
Karel Zak 383e7a2720 libmount: remove dead assigment
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-02 14:27:48 +01:00
Karel Zak 2af0a8390d libmount: consolidate sysconf() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 14:31:09 +01:00
Karel Zak 0113a20e93 libmount: make iter reset more robust [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:55:26 +01:00
Karel Zak 801401447b libmount: fix resource leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:38:18 +01:00
Karel Zak 4f69189fe7 libmount: fix resource leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:27:23 +01:00
Karel Zak ff7eba4d5e libmount: fix possible null dereferencing [coverity scan]
... let's keep Coverity analyzer happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:22:53 +01:00
Karel Zak b47b7b3afb libmount: fix negative returns [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:17:53 +01:00
Karel Zak 314f252226 libmount: fix checked-return [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:17:47 +01:00
Karel Zak d89670b515 libmount: fix context test logic
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-26 15:01:01 +01:00
Karel Zak 9bf51834fd libmount: fix leak in tabdiff test
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-26 14:47:48 +01:00
Karel Zak 53d911347d libmount: fix leak in tab parsing error code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-26 14:42:35 +01:00
Karel Zak 8dece03615 libmount: fix leak in tab_update.c test 2012-01-26 14:28:08 +01:00
Karel Zak 258ca2b241 libmount: fix buffer overflow and leaks in tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-26 14:17:28 +01:00
Karel Zak 5810d87097 libmount: don't pass comments=/x-* to mount.<type> helpers
This patch add a new flag MNT_NOHLPS for mount options map, options
with this flag will not be passed to /sbin/mount.<type> helpers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-25 17:14:24 +01:00
Karel Zak b82590ad46 blkid: move cache to /run on new systems
Why?

 * read-only root

 * /etc is pretty bad place for caches

 * all is usually cached by udev in /dev/disk/by-* and libblkid
   is able to use these symlinks

 * boot persistent cache is attractive for very small subset of
   Linux machines (and they already need extra udev tunning otherwise
   udev will probe all block devices during boot)

 * the default is possible to override in /etc/blkid.conf

The systems without /run directory will not be affected by this
change.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-25 13:20:37 +01:00
Karel Zak 9354fea342 libmount: remove fstab.d support
If you really need to store your configuration to a alternative files
then you have to explicitly specify the files or directories on
mount(8) command line by --fstab option.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-24 11:16:53 +01:00
Karel Zak 52f8362841 libmount: support dirs for mnt_table_parse_fstab(), add mnt_table_parse_dir()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 20:20:36 +01:00
Masatake YAMATO b28890b041 libmount: fix a potential memory leak at mnt_table_parse_dir
mnt_table_parse_dir in libmount/src/tab_parse.c calls
scandir, and then opendir. When the latter one, opendir is failed,
buffers allocated in scandir are not released.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2012-01-23 13:54:03 +01:00
Masatake YAMATO 9deeef8e47 libmount: Use filter arg of scandir* to pickup /etc/fstab.d/*.fstab files
This patch is based on my last patch:

     [PATCH 1/2] scandirat based mnt_table_parse_dir implementation

scandir* used in `mnt_table_parse_dir in libmount/src/tab_parse.c
can take filter function as an argument.

`mnt_table_parse_dir' picks up fstab files from namelist returned from
scandir* for itself. However, some parts of picking-up job can be done
in the filter function.

This patch introduces a new function `mnt_table_parse_dir_filter' to
share the code for picking-up job between two implementations of
`mnt_table_parse_dir_filter', scandir based and scandirat based.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2012-01-23 13:53:40 +01:00
Masatake YAMATO 485a8bfa98 libmount: scandirat based mnt_table_parse_dir implementation
In comment of `mnt_table_parse_dir' of libmount/src/tab_parse.c:

	/* TODO: it would be nice to have a scandir() implementation that
	 *       is able to use already opened directory */

Nowadays glibc provides `scandirat'. This patch implements `scandirat'
based `mnt_table_parse_dir'.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2012-01-23 13:52:51 +01:00
Karel Zak df51de6b37 libmount: export info about library features
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 12:27:01 +01:00
Karel Zak 0208ae2e0c libmount: fix bugs detected by [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 17:16:57 +01:00
Karel Zak b2ddfb59c1 libmount: fix compiler warnings [-Wuninitialized -Wformat]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:33:19 +01:00
Karel Zak 94283c9a77 libmount: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:31:45 +01:00
Karel Zak c1f3576e0a libmount: ignore "defaults" mount option
... thanks to regression test!

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:12:04 +01:00
Karel Zak 374fd21add libmount: add MNT_OMODE_NOTAB
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 14:35:10 +01:00
Karel Zak 98b1302ecf libmount: cleanup post-umount operations
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 13:15:01 +01:00
Karel Zak 07a67e6805 libmount: fix MS_BIND|MS_REC usage, improve some bitwise operations
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 12:29:27 +01:00
Karel Zak f9906424d4 libmount: add post-mount checks to detect ro/rw
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 12:09:36 +01:00
Karel Zak 8b470b20d7 libmount: avoid duplicate loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 11:28:05 +01:00
Karel Zak dc4dbbf188 libmount: allow to toggle ro/rw and mount again
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-13 16:27:50 +01:00
Karel Zak be3df3838a libmount: allow to use UUID and LABEL for owner/group mount options in fstab
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-13 14:37:09 +01:00
Karel Zak 8ab6accf01 libmount: add functions to export syscall/helpers status
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-13 13:01:18 +01:00
Karel Zak c851223602 libmount: fix auto-loopdev
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-12 21:51:00 +01:00
Karel Zak a10d6ad6f4 libmount: support umount /path/file.img
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-12 21:30:58 +01:00
Karel Zak 1e8c936978 libmount: make options in fstab optional
.. to be compatible with old mount(8).

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-12 16:52:32 +01:00
Karel Zak ecdba5ddfc build-sys: add --enable-new-mount
Now we have three versions of the mount(8) utility

 * old mount(8)
   --enable-mount [default]

 * old mount(8) linked with libmount
   This is this is necessary for systems without mtab file.
   --enable-libmount-mount

 - new mount(8)
   This is completely new pure-libmount based mount(8).
   --enable-new-mount

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 17:05:08 +01:00
Karel Zak dbae36fe40 libmount: add --pass-fd to samples/mount
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 16:17:06 +01:00
Karel Zak 1a7a421ed7 libmount: add support for encrypted loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 16:16:00 +01:00
s.p@orbitalfox.com b631e4d801 libmount: fixed a small typo 2012-01-04 11:37:49 +01:00
Dave Reisner b928ab01e0 libmount: fix typo in function name
Build broken in c70d9d7.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-02 16:56:12 +01:00
Karel Zak c70d9d768b libmount: consolidate MNT_FS_* code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 15:00:27 +01:00
Dave Reisner ee83edede1 libmount: avoid resolving pseudofs source on update
Similar to the previous commit, when mounting a pseudofs, trust the
source of the fs, as it cannot be matched to backing device on the
filesystem.

Similar situation, but slightly different bug:

  # mkdir /foo /root/foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # cd /root
  # mount -a
  # mount | grep /foo
  /root/foo on /foo type tmpfs (rw,relatime)

This fixes the pure libmount based mount utility, but the legacy mount
tool will still fail to handle this properly.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 14:27:09 +01:00
Karel Zak 16b8db49fe libmount; fix possible mem-leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 14:16:15 +01:00
Dave Reisner 14f66ad69a libmount: always trust the source of a pseudofs
Since nodev FSs have no backing block device, it's unreasonable to try
and resolve the source back to a path on the filesystem. Always trust
the source of the FS given in /etc/fstab to avoid remounting the device
when a directory of the same name exists in the current working
directory.

Example reproduction:

  # mkdir /foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # mount -a
  # cd /root; mkdir foo
  # mount -a
  # mount | grep /foo
  foo on /foo type tmpfs (rw,relatime)
  /root/foo on /foo type tmpfs (rw,relatime)

[kzak@redhat.com: - use fs->flags to detect pseudo FS]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 13:59:35 +01:00
Karel Zak 937266598f libmount: don't use "new" in header file
Reported-by: ben <benscott@nwlink.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-19 22:51:38 +01:00
Karel Zak d2c97887fe libmount: add support for mount -a --fork
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02 18:20:34 +01:00
Karel Zak ede8a60e05 libmount: add "+" prefix for options pattern (e.g findmnt -O)
Examples:

 * findmnt --fstab -O noauto
   Returns all entries where is not "auto" option (including entries
   with "noauto" option.

 * findmnt --fstab -O +noauto
   Returns all entries where is literally "noauto" option.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=758457
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 18:28:42 +01:00
Karel Zak 190c342a83 libmount: add -a to umount(8) sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:47:26 +01:00
Karel Zak 085f163b52 libmount: add mnt_context_umount_next()
This is "umount -a" backend.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:45:53 +01:00
Karel Zak b3f7a0ec3e libmount: improve verbose message
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:42:42 +01:00
Karel Zak db216e68fa libmount: add new exprimental umount(8)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 19:02:27 +01:00
Karel Zak 732a631126 include,optutils: add option_to_longopt()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 18:21:49 +01:00
Karel Zak e4c92d0617 libmount: use USAGE_* from mount(8) sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 18:06:21 +01:00
Karel Zak 6189ace369 libmount: add sanitize_env() to mount(8) sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 17:36:39 +01:00
Karel Zak 2492f71341 libmount: remove magic constatnt from mount(8)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 16:58:44 +01:00
Karel Zak b483debb64 libmount: fix compiler warning [-Wimplicit-function-declaration]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-28 10:19:32 +01:00
Karel Zak 1208915521 lib,match: split match_fstype() from libmount
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-15 15:17:19 +01:00
Petr Uzel 26e42d8123 libmount: fix trivial typos in debugging output
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-11-09 10:23:59 +01:00
Karel Zak 6107377322 libmount: fix chdir to parent for restricted (user) umounts
Reported-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-08 21:47:23 +01:00
Petr Uzel b106d05238 libmount: ignore tailing slash in netfs source paths
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=728480
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-08 16:25:01 +01:00
Karel Zak ff4c00f94a libmount: unable to umount nfs shares using the force option
Reported-by: Federico Simoncelli <fsimonce@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=745746
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-10-17 13:27:21 +02:00
Karel Zak 640fc1b819 build-sys: check scanf %ms modifier
Without the check libmount builds on systems that has older than 2.7
glibc are silently unsuccessful.  The missing %ms modifier will, at
least, result on such system missing output of findmnt and lsblk
commands.  If either %ms or %as modifiers are present the libmount
build is disabled.

Based on patch from: Sami Kerola <kerolasa@iki.fi>

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-10-10 14:42:40 +02:00
Karel Zak f0d3ff0a6f libmount: support -o loop=<devname>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-30 01:38:38 +02:00
Karel Zak 365e5a7c54 libmount: use loopdev debug facility
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-29 23:29:46 +02:00
Karel Zak b9fd334035 libmount: support {offset,sizelimit}= foor loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-29 20:50:08 +02:00
Karel Zak fd1eb7a729 libmount: add function to parse offsets/sizes 2011-09-29 17:48:03 +02:00
Petr Uzel 960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Francesco Cosoleto a03fd94b57 libmount: fix use of logical '&&' with constant operand
Found by clang.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-09-27 15:04:23 +02:00
Karel Zak 96bc8588b2 libmount: previously assumed null pointer [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 16:01:42 +02:00
Karel Zak 8726371fb8 libmount: variable dereferenced before check [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 15:33:04 +02:00
Karel Zak ad84aaaa6c libmount: redundant null check on calling free() [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 15:32:35 +02:00
Karel Zak 88d7d36ff2 libmount: use unsigned int for bitfields [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 15:28:56 +02:00
Karel Zak da9629917d docs: use .LGPL extension for file with GNU Lesser License
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 11:12:17 +02:00
Karel Zak fa25f2289c Merge branch 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit
* 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: remove duplicated text
  docs: require kernel support before accepting use of it
  docs: note about independent super block structs
  docs: add libmount & libblkid debug instructions
  Documentation: add debugging doc
  arch: start using arch as a usage() example
  docs: new file Documentation/release-schedule.txt
  docs: move setuid information from reame to hwclock.8
  docs: clean up old readme files
  docs: copy contributors from legacy files to AUTHORS
  docs: new file Documentation/howto-man-page.txt
  docs: new file Documentation/source-code-management.txt
  docs: new file Documentation/howto-contribute.txt
  docs: new file Documentation/howto-compilation.txt
  docs: tell what the Documentation/ is about
  docs: add usage() howto for contributors
  docs: Documentation directory added
  docs: remove README.clear
2011-08-31 11:04:15 +02:00
Sami Kerola ce0efc40a1 docs: remove duplicated text
Duplicate text is dealt by referring to license files. The `pg'
command does not need separated license file because the source
file has same text at top of it.

http://www.spinics.net/lists/util-linux-ng/msg05069.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-30 19:50:34 +02:00
Karel Zak 581a4ad92a libmount: fix debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-26 10:49:38 +02:00
Benno Schulenberg eaca47f7c6 libmount: cut up mount's help text into manageable chunks
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-16 10:16:35 +02:00
Davidlohr Bueso 19f411cbc6 grammar fixes
Correct grammar from "cannot found" to "cannot find".

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-08-15 14:28:21 +02:00
Sami Kerola f98d4f766e docs: Documentation directory added
Move readme, licence, change log, relese notes and other
supplementary files to a Documentation directory. This commit
does not change contents of any other but few Makefile.am files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-12 20:19:52 +02:00
Davidlohr Bueso ad2d0d8587 lib: [loopdev.c] correct trivial typo
Should say "failed to find" instead of "failed to found".

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-08-08 13:53:59 +02:00
Davidlohr Bueso ff62fc46b4 libmount: fix undefined sources
The path resolving function breaks when handling undefined sources
("none") used by pseudo-filesystems. The assertion is causing the
samples/mount program to abort:

dave@offbook:~/projects/util-linux-good/libmount/samples$ ./mount
/dev/sda3 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
lt-mount: cache.c:464: mnt_resolve_path: Assertion `path' failed.
Aborted

/etc/mtab:

/dev/sda3 / ext4 rw,errors=remount-ro,commit=0 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
...

Instead of this assert on NULL we can simply return NULL and let mnt_pretty_path do the work.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-08-08 13:53:46 +02:00
Karel Zak 854fa6d99f libmount: update list of pseudo-filesystems
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-08 13:10:34 +02:00
Karel Zak 7fc6d2b8f8 libmount: fix compiler warnings [-Wunused-parameter -Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-02 11:21:16 +02:00
Karel Zak 58ca4ed1b4 build-sys: remove and ignore generated files
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-28 13:47:56 +02:00
Karel Zak 3fe1b06aba build-sys: fix gtk-doc distclean
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 14:22:36 +02:00
Karel Zak de60d08e93 libmount: remove 'seclabel' on remount, improve for 2.6.39
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-25 15:54:16 +02:00
Karel Zak 9267c0991d libmount: improve apply_fstab debugging
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-25 15:36:44 +02:00
Karel Zak 799b96d957 libmount: add MOUNT_2.20 version to the API
The API is officially stable since 2.20.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-25 12:23:58 +02:00
Karel Zak 486d397297 libmount: remove unnecessary includes, mask API as stable
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-25 11:57:28 +02:00
Karel Zak e6ecd606ae libmount: clean up docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-25 10:42:08 +02:00
Karel Zak 63de90d44f libmount: cleanup docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-23 01:27:39 +02:00
Karel Zak b5962110d2 libmount: fix mtab update for "none" source
tab_parse.c:mnt_parse_mountinfo_line parses "none" in src as NULL,

tab_update.c:fprintf_mtab_fs sets m1 to NULL instead of "none" and
returns -ENOMEM
tab_update.c:update_table says "write entry failed: Success", as errno
hasn't been set, and gotos to leave, leaving mtab not updated.

Addresses-debian-bug: 634871
Reported-by: Tomas Janousek <tomi@nomi.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 21:24:20 +02:00
Karel Zak 5af0769de6 libmount: cleanup code for "none" source and fstype, fix mem leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 21:15:43 +02:00
Karel Zak 5dfc984392 libmount: minor fixes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-27 13:31:48 +02:00
Karel Zak 2576b4e782 libmount: allow to convert /dev/loopN to backing filename
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 16:06:27 +02:00
Karel Zak 117545721a libmount: cleanup return codes in mount sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 15:19:37 +02:00
Karel Zak 9f7472b0b8 libmount: add support for mount -a
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 15:07:55 +02:00
Karel Zak 679f59dde2 libmount: fix fstype caching
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 12:29:00 +02:00
Karel Zak 171b0fb491 libmount: rename in cache.c
* don't use mnt_ prefix for static functions

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 12:24:02 +02:00
Karel Zak 8eef6df790 libmount: clean up cache.c
* rename fields in the cache entry to be more readable...

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-23 12:19:30 +02:00
Karel Zak e5c5abaee3 libmount: add generic function to read table for context
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-22 13:34:47 +02:00
Karel Zak d84508cfbd libmount: allow to set parser callback to context
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-21 14:58:37 +02:00
Karel Zak 0164c24595 mountpoint: add new command
This is libmount based re-implementation of the mountpoint(1) command.
The original implementation is maintained in sysvinit suite.

The mountpoint(1) in util-linux is not enabled by default (for now) --
use --enable-mountpoint to enable the util.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-21 11:46:36 +02:00
Karel Zak 7f8b2bf3be libmount: add mount support for loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-10 15:39:56 +02:00