summaryrefslogtreecommitdiffstats
path: root/libmount/src/init.c
Commit message (Collapse)AuthorAgeFilesLines
* libmount: cleanup licenses sections in the filesKarel Zak2018-08-161-3/+8
| | | | | | | | | * add SPDX-License-Identifier (see https://spdx.org/licenses/) * add "This file part of libmount from util-linux project." * use proper text for LGPL-2.1-or-later * use the same texts everywhere Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-171-1/+1
| | | | | | | Let's make it possible to use debug.h without environment variables. Suggested-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libmount: add loop to debug outputKarel Zak2016-02-161-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: handle btrfs default subvolume mountStanislav Brabec2016-01-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mounting btrfs volume without subvol= and subvolid=, and the btrfs volume has default subvolume defined, mount() mounts the default subvolume and not the volume root as other filesystems do. To handle this situation correctly (for example for "mount -a"), libmount has to be capable to detect default subvolume. Add btrfs.c and btrfs.h that implement needed functions. This patch adds mnt_table_find_target_with_option() to the library API. Known problems not covered by this patch: - Use of subvolid= in fstab is not yet handled. - Use of type auto in combination with subvol= in fstab is not yet handled. - Use of btrfs in loop devices, where image file is specified in fstab is not yet handled (use of /dev/loop0 in fstab works). - If fstab uses subvol=, and subvol path changes since last "mount -a", subsequent "mount -a" will not recognize that it is already mounted, and it will attempt to mount it second time. To fix it, libmount should remember subvolid in time of mount (subvolid is unique for the subvolume, subvol is not). - mountinfo contains subvol and subvolid since kernel 4.2. Before kernel 4.2, there is no reasonable way to solve this situation. (One would create temporary mount point, mount the default, call needed ioctl() to determine what was mounted, deduce the default subvolume, compare it with subvolume of mounted volume, unmount and return result.) How to reproduce: truncate -s1G btrfs_test.img mkdir -p btrfs_mnt /sbin/mkfs.btrfs -f -d single -m single ./btrfs_test.img mount -o loop btrfs_test.img btrfs_mnt pushd . cd btrfs_mnt mkdir -p d0/dd0/ddd0 cd d0/dd0/ddd0 touch file{1..5} btrfs subvol create s1 cd s1 touch file{1..5} mkdir -p d1/dd1/ddd1 cd d1/dd1/ddd1 btrfs subvol create s2 rid=$(btrfs inspect rootid s2) echo new default $rid btrfs subvol get-default . btrfs subvol set-default $rid . popd umount btrfs_mnt losetup /dev/loop0 $PWD/btrfs_test.img echo "/dev/loop0 $PWD/btrfs_mnt btrfs defaults 0 0" >>/etc/fstab mount -a mount -a umount btrfs_mnt sed -i "/\/dev\/loop0/d" /etc/fstab losetup -d /dev/loop0 rm btrfs_test.img rmdir btrfs_mnt Current behavior: mount: /dev/loop0 is already mounted or /root/btrfs_mnt busy /dev/loop0 is already mounted on /root/btrfs_mnt Expected behavior is to ignore already mounted FS. [kzak@redhat.com: - make 'var' optional for mnt_table_find_target_with_option(), - add mnt_table_find_target_with_option() to symbols table and docs - add "btrfs" string between supported debug modes - minor coding style changes] Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Cc: David Štěrba <dsterba@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: typo fixesKir Kolyshkin2015-09-031-1/+1
| | | | | | I was reading the code and found these mountinfo typos. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
* libmount: add new libmnt_monitor APIKarel Zak2014-12-051-0/+2
| | | | | | | | | | | | It's usually enough to us [e]poll() to monitor kernel mount table, but there is no way how to monitor changes in userspace mount options (e.g. _netdev). The management of these mount options is completely hidden in libmount and /rub/mount/utab is private libmount file. This patch introduces new libmnt_mount API to monitor also userspace mount table. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: cleanup libmount debug testKarel Zak2014-11-031-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: clean up debug, add help debug maskKarel Zak2014-11-031-13/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: cleanup masksKarel Zak2014-08-131-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libs/debug: accept human readable names for _DEBUG=Ondrej Oprala2014-08-131-1/+43
| | | | | | | | | | For example $ LIBMOUNT_DEBUG=tab,cache findmnt to debug only TAB and CACHE subsystem. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use new debug functionsKarel Zak2014-03-211-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* clean up redundant macros and definesOndrej Oprala2014-03-131-1/+1
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: further debug.h integrationOndrej Oprala2014-03-131-14/+2Star
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: Get rid of an unnecessary checkNamhyung Kim2013-09-261-1/+1
| | | | | | | libmount_debug_mask was OR'ed to MNT_DEBUG_INIT so it should be non-null. Thus the check is pointless. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* libmount: fix typosOndrej Oprala2013-08-051-6/+6
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: add version and features to debug outputKarel Zak2013-04-021-3/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use stderr for initial debug messageKarel Zak2012-05-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove unnecessary includes, mask API as stableKarel Zak2011-07-251-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use top-level directory for libmount rather than shlibs/mountKarel Zak2011-06-091-0/+46
Signed-off-by: Karel Zak <kzak@redhat.com>