summaryrefslogtreecommitdiffstats
path: root/libmount/src/btrfs.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>
* misc: remove stray semicolonsSami Kerola2017-06-141-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: btrfs, remove unused setter functionsRuediger Meier2017-06-141-4/+0Star
| | | | | | | We have never used them since introduced in 2cd28fc8. clang compiler warned about it. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* 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: don't include libio.hRuediger Meier2016-03-071-1/+1
| | | | | | | This include was added just one month ago in 5a971329 but I don't see what it was good for. It's missing in musl libc. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libmount: cleanup btrfs.c headerKarel Zak2016-01-261-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: consolidate btrfs stuff, make it more portableKarel Zak2016-01-261-9/+81
| | | | | | | | | - add --with-btrfs (enabled by default) - check for linux/btrfs.h - add "btrfs" to libmount features list (see mount -V) - #ifdef HAVE_BTRFS_SUPPORT for all btrfs stuff in libmount Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: handle btrfs default subvolume mountStanislav Brabec2016-01-261-0/+102
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>