]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agobuild-sys: add --disable-libmount-mountfd-support
Karel Zak [Tue, 22 Nov 2022 10:41:58 +0000 (11:41 +0100)] 
build-sys: add --disable-libmount-mountfd-support

We need to disable support for new kernel API in libmount to test the
old code on new kernels (or maybe also for conservative users).

The new configure option disable only mount(2)-like operations, the
another stuff (like IDs mapping) is not affected.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: add complex mount test
Karel Zak [Thu, 20 Oct 2022 08:56:59 +0000 (10:56 +0200)] 
tests: add complex mount test

This test check complex tasks when one mount(8) call modifies VFS flags,
propagation flags and do some operation (bind, move, ...).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: fix test file name
Karel Zak [Thu, 20 Oct 2022 07:32:37 +0000 (09:32 +0200)] 
tests: fix test file name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: add X-mount.subdir test
Karel Zak [Tue, 18 Oct 2022 10:37:09 +0000 (12:37 +0200)] 
tests: add X-mount.subdir test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (subdir) use new FD based API
Karel Zak [Tue, 18 Oct 2022 10:33:39 +0000 (12:33 +0200)] 
libmount: (subdir) use new FD based API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add inline function to access API file descritors
Karel Zak [Tue, 18 Oct 2022 09:38:45 +0000 (11:38 +0200)] 
libmount: add inline function to access API file descritors

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (owner) call hooks when all mount stuff is done
Karel Zak [Wed, 12 Oct 2022 11:00:12 +0000 (13:00 +0200)] 
libmount: (owner) call hooks when all mount stuff is done

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix new API code when use external helper
Karel Zak [Wed, 12 Oct 2022 10:23:48 +0000 (12:23 +0200)] 
libmount: fix new API code when use external helper

We don't want to call fsopen() or so if external /sbin/mount.<type>
helper is expected.

This patch also add fallback to propagation hook to open mount tree
if necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: improve context deinitialization
Karel Zak [Wed, 12 Oct 2022 10:23:37 +0000 (12:23 +0200)] 
libmount: improve context deinitialization

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: check for propagation-only in proper way
Karel Zak [Wed, 12 Oct 2022 09:15:25 +0000 (11:15 +0200)] 
libmount: check for propagation-only in proper way

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) fix mount by FS list/pattern for new API
Karel Zak [Mon, 10 Oct 2022 14:08:29 +0000 (16:08 +0200)] 
libmount: (mount) fix mount by FS list/pattern for new API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use AT_RECURSIVE only when clone tree
Karel Zak [Fri, 7 Oct 2022 10:18:03 +0000 (12:18 +0200)] 
libmount: use AT_RECURSIVE only when clone tree

It seems AT_RECURSIVE is usable for open_tree() only when
OPEN_TREE_CLONE specified too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use MOUNT_ATTR__ATIME
Karel Zak [Fri, 7 Oct 2022 09:26:07 +0000 (11:26 +0200)] 
libmount: (mount) use MOUNT_ATTR__ATIME

The atime related attributes for mount_setattr() requires MOUNT_ATTR__ATIME
in clear mask.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix mount -a to work with optlist
Karel Zak [Thu, 6 Oct 2022 10:02:41 +0000 (12:02 +0200)] 
libmount: fix mount -a to work with optlist

The original code uses libmnt_fs instance to store mount options. The
new uses libmnt_fs only for library API backward compatibility, but
internally it uses libmnt_optlist. Let's use optlist also to save
context template.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: don't refer optlist when copy libmnt_fs
Karel Zak [Thu, 6 Oct 2022 10:00:57 +0000 (12:00 +0200)] 
libmount: don't refer optlist when copy libmnt_fs

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix external helps call
Karel Zak [Tue, 4 Oct 2022 11:34:42 +0000 (13:34 +0200)] 
libmount: fix external helps call

* always use rw/ro flags on helper command line
* don't return MNT_ERR_APPLYFLAGS, the flags are applied in post-mount stage

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (legacy) init regualer mount before propagation
Karel Zak [Tue, 4 Oct 2022 11:05:27 +0000 (13:05 +0200)] 
libmount: (legacy) init regualer mount before propagation

We have two ways how mount(2) is used, for propagation-only calls and
regular FS mount. The propagation-only code removes MS_PROPAGATION
flags from main mount options (=optlist), so any later decision about
propagation is impossible. We need to call propagation-only code as
the last thing. (Yes, new FD based mount(8) handles it better.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix compilation without new API
Karel Zak [Tue, 4 Oct 2022 09:59:52 +0000 (11:59 +0200)] 
libmount: fix compilation without new API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (libmount) update debug test
Karel Zak [Mon, 3 Oct 2022 13:44:04 +0000 (15:44 +0200)] 
tests: (libmount) update debug test

The debug mask is printed as 0x%06x number now.

References: 72e2f1ea8b7b90014118f4c9e55babb67528b986
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (libmount) remove unsupported test
Karel Zak [Mon, 3 Oct 2022 13:30:44 +0000 (15:30 +0200)] 
tests: (libmount) remove unsupported test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: initialize tb in is_mounted_same_loopfile()
Karel Zak [Mon, 3 Oct 2022 13:20:46 +0000 (15:20 +0200)] 
libmount: initialize tb in is_mounted_same_loopfile()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) implement remount by new Linux API
Karel Zak [Tue, 27 Sep 2022 10:56:57 +0000 (12:56 +0200)] 
libmount: (mount) implement remount by new Linux API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) create new FS instance by new Linux API
Karel Zak [Mon, 26 Sep 2022 13:22:57 +0000 (15:22 +0200)] 
libmount: (mount) create new FS instance by new Linux API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) support propagation by new kernel API
Karel Zak [Mon, 26 Sep 2022 07:45:04 +0000 (09:45 +0200)] 
libmount: (mount) support propagation by new kernel API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: support VFS flags attributes clear
Karel Zak [Thu, 22 Sep 2022 09:05:53 +0000 (11:05 +0200)] 
libmount: support VFS flags attributes clear

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) fix recursion
Karel Zak [Wed, 21 Sep 2022 16:01:05 +0000 (18:01 +0200)] 
libmount: (mount) fix recursion

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use independent hooks
Karel Zak [Wed, 21 Sep 2022 15:28:36 +0000 (17:28 +0200)] 
libmount: (mount) use independent hooks

It seems better to reuse functions (hooks) to implement various
ways the mount is done. For example, attach to the tree is used
for move, bind, and new mount; set VFS flags is usable for all
operations, etc.

Complete mount(8) is a set (chain) of hooks that is possible to mix to
get the wanted result.

The new API allow for example things like

mount --move /A /B -oro,noexec

because it's

- open_tree()
- mount_setattr()
- move_tree()

Note that the hooks allow extend it to new functionality  without core
code modification (for example, X-mount.idmap= append a new hook to
call another mount_setattr()).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove upper-case from debug message
Karel Zak [Wed, 21 Sep 2022 15:28:28 +0000 (17:28 +0200)] 
libmount: remove upper-case from debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add MOUNT_ATTR_NOSYMFOLLOW
Karel Zak [Wed, 21 Sep 2022 15:27:15 +0000 (17:27 +0200)] 
libmount: add MOUNT_ATTR_NOSYMFOLLOW

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) improve syscalls status handling
Karel Zak [Wed, 21 Sep 2022 09:39:13 +0000 (11:39 +0200)] 
libmount: (mount) improve syscalls status handling

The new kernel API is composed from more syscalls, but libmount
originally assumes one syscall and one place where we need to remember
return value of the syscall. It seems the best will be to set the
status after each mount related syscall call (fsopen(), move_mount(),
...) until we reach error or end of mount  process.

For better error messages the last failed mount related syscall name
will be recorded in cxt->syscall_name.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) support --move by new kernel API
Karel Zak [Wed, 21 Sep 2022 09:07:25 +0000 (11:07 +0200)] 
libmount: (mount) support --move by new kernel API

* support --move in new mount implementation

* remember errno from mount related failed syscalls

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add MS_MOVE to options map
Karel Zak [Wed, 21 Sep 2022 09:03:54 +0000 (11:03 +0200)] 
libmount: add MS_MOVE to options map

libmount originally had in the options map only options that are
possible to use in fstab. Now we use the map to verify and
classify all mount options, so MS_MOVE is necessary there too.

The patch also add a new MNT_NOFSTAB option flag, not used for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) improve code
Karel Zak [Wed, 21 Sep 2022 08:14:21 +0000 (10:14 +0200)] 
libmount: (mount) improve code

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: initial support for new FD based mount kernel API
Karel Zak [Tue, 20 Sep 2022 11:53:40 +0000 (13:53 +0200)] 
libmount: initial support for new FD based mount kernel API

For now it supports -obind and -obind,<flags> operations.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: support MOUNT_ATTR_ and rbind in optlist,
Karel Zak [Tue, 20 Sep 2022 11:52:35 +0000 (13:52 +0200)] 
libmount: support MOUNT_ATTR_ and rbind in optlist,

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove unnecessary include
Karel Zak [Tue, 20 Sep 2022 11:51:30 +0000 (13:51 +0200)] 
libmount: remove unnecessary include

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: new stuff to header file
Karel Zak [Tue, 20 Sep 2022 11:50:40 +0000 (13:50 +0200)] 
libmount: new stuff to header file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add info about support for new mount syscalls
Karel Zak [Tue, 20 Sep 2022 11:44:02 +0000 (13:44 +0200)] 
libmount: add info about support for new mount syscalls

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/mount-api-utils: use standard uint64_t
Karel Zak [Tue, 20 Sep 2022 11:40:56 +0000 (13:40 +0200)] 
include/mount-api-utils: use standard uint64_t

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix mflags
Karel Zak [Tue, 20 Sep 2022 08:26:20 +0000 (10:26 +0200)] 
libmount: fix mflags

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: cleanup comments for hooks
Karel Zak [Thu, 8 Sep 2022 11:08:15 +0000 (13:08 +0200)] 
libmount: cleanup comments for hooks

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (verity) rewrite to use hookset API
Karel Zak [Thu, 8 Sep 2022 10:37:52 +0000 (12:37 +0200)] 
libmount: (verity) rewrite to use hookset API

* initialize only when relevant verity.* options detected

* setup verity device by prepare-source hook

* add post-mount hook to setup deferred deactivation

* deactivate the device on error (when de-initialize the hookset)

* call dlopen/dlclose only once, share symbols between all hooks

* remove verity specific code from rest of libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (verity) rewrite dlopen use
Karel Zak [Wed, 7 Sep 2022 08:41:47 +0000 (10:41 +0200)] 
libmount: (verity) rewrite dlopen use

* use verity_call() macro to hide the way how libcryptsetup is used

* don't play with function pointers for standard linked libcryptsetup

* move all dlopen related code to the one function

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) NULL optstr is not error
Karel Zak [Tue, 6 Sep 2022 10:09:19 +0000 (12:09 +0200)] 
libmount: (optlist) NULL optstr is not error

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) fix ro/rw use
Karel Zak [Fri, 26 Aug 2022 09:29:02 +0000 (11:29 +0200)] 
libmount: (optlist) fix ro/rw use

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) use cache also for flags
Karel Zak [Fri, 26 Aug 2022 09:10:11 +0000 (11:10 +0200)] 
libmount: (optlist) use cache also for flags

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove unused context variables
Karel Zak [Fri, 26 Aug 2022 08:25:04 +0000 (10:25 +0200)] 
libmount: remove unused context variables

All replaced by optlist container.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (umount) use optlist
Karel Zak [Fri, 26 Aug 2022 08:19:14 +0000 (10:19 +0200)] 
libmount: (umount) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use optlist to get infor about MS_REC
Karel Zak [Fri, 26 Aug 2022 08:18:14 +0000 (10:18 +0200)] 
libmount: use optlist to get infor about  MS_REC

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) add is_recursive shortcut
Karel Zak [Fri, 26 Aug 2022 08:17:30 +0000 (10:17 +0200)] 
libmount: (optlist) add is_recursive shortcut

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (docs) mark mnt_optstr_apply_flags() as deprecated
Karel Zak [Fri, 26 Aug 2022 07:24:50 +0000 (09:24 +0200)] 
libmount: (docs) mark mnt_optstr_apply_flags() as deprecated

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (umount) use optlist when evaluate permissions
Karel Zak [Thu, 25 Aug 2022 12:33:32 +0000 (14:33 +0200)] 
libmount: (umount) use optlist when evaluate permissions

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (umount) use optlist for umount helper setup
Karel Zak [Thu, 25 Aug 2022 12:17:45 +0000 (14:17 +0200)] 
libmount: (umount) use optlist for umount helper setup

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optstr) remove unused function
Karel Zak [Wed, 24 Aug 2022 18:22:14 +0000 (20:22 +0200)] 
libmount: (optstr) remove unused function

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (umount) use optlist to keep options
Karel Zak [Wed, 24 Aug 2022 18:21:45 +0000 (20:21 +0200)] 
libmount: (umount) use optlist to keep options

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: keep context fs and optlist synchronized
Karel Zak [Wed, 24 Aug 2022 14:54:10 +0000 (16:54 +0200)] 
libmount: keep context fs and optlist synchronized

The new code uses cxt->optlist to maintain mount options, but for backward
compatibility and for some stuff in the library we need to keep context->fs
up to date with the optlist. It seems the best is to to keep it on-demand
and automatic.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (context) ask for utab path only once
Karel Zak [Wed, 24 Aug 2022 15:10:37 +0000 (17:10 +0200)] 
libmount: (context) ask for utab path only once

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (owner) use optlist for X-mount options
Karel Zak [Tue, 23 Aug 2022 12:24:47 +0000 (14:24 +0200)] 
libmount: (owner) use optlist for X-mount options

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (idmap) use optlist
Karel Zak [Tue, 23 Aug 2022 12:13:10 +0000 (14:13 +0200)] 
libmount: (idmap) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) make sure flags are initialized
Karel Zak [Tue, 23 Aug 2022 12:00:57 +0000 (14:00 +0200)] 
libmount: (optlist) make sure flags are initialized

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (legacy mount) use optlist
Karel Zak [Tue, 23 Aug 2022 11:42:27 +0000 (13:42 +0200)] 
libmount: (legacy mount) use optlist

* rename hookdata "mountflags" to "flags"

* don't use directly cxt->mountflags, always use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) add function to access option's map
Karel Zak [Tue, 23 Aug 2022 11:42:16 +0000 (13:42 +0200)] 
libmount: (optlist) add function to access option's map

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) add is_silent shortcut
Karel Zak [Tue, 23 Aug 2022 11:18:54 +0000 (13:18 +0200)] 
libmount: (optlist) add is_silent shortcut

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) remove last mountflags use
Karel Zak [Tue, 23 Aug 2022 11:08:52 +0000 (13:08 +0200)] 
libmount: (mount) remove last mountflags use

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (context) don't use mount flags directly
Karel Zak [Tue, 23 Aug 2022 11:00:42 +0000 (13:00 +0200)] 
libmount: (context) don't use mount flags directly

* use optlist API rather than directly mountflags.

* don't care about MS_RDONLY for mnt_update_* interface. It's
  unnecessary, the interface uses mount options (strings).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (verity) use optlist
Karel Zak [Tue, 23 Aug 2022 10:39:47 +0000 (12:39 +0200)] 
libmount: (verity) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: rename libmount loopdev code file
Karel Zak [Tue, 23 Aug 2022 09:58:37 +0000 (11:58 +0200)] 
build-sys: rename libmount loopdev code file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: reimplement loop= by hooks
Karel Zak [Tue, 23 Aug 2022 09:55:51 +0000 (11:55 +0200)] 
libmount: reimplement loop= by hooks

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (owner) remove if-before-free
Karel Zak [Tue, 23 Aug 2022 09:13:56 +0000 (11:13 +0200)] 
libmount: (owner) remove if-before-free

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (loopdev) use optlist
Karel Zak [Mon, 22 Aug 2022 13:10:23 +0000 (15:10 +0200)] 
libmount: (loopdev) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) add new shortcuts, fix add_flags()
Karel Zak [Mon, 22 Aug 2022 13:08:33 +0000 (15:08 +0200)] 
libmount: (optlist) add new shortcuts, fix add_flags()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mkdir) simplify X-mount.mkdir check
Karel Zak [Fri, 19 Aug 2022 16:44:00 +0000 (18:44 +0200)] 
libmount: (mkdir) simplify X-mount.mkdir check

It's enough to check for the option, it's unnecessary to check also flags.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (subdir) use optlist
Karel Zak [Fri, 19 Aug 2022 16:43:26 +0000 (18:43 +0200)] 
libmount: (subdir) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mkdir) use optlist
Karel Zak [Fri, 19 Aug 2022 09:32:55 +0000 (11:32 +0200)] 
libmount: (mkdir) use optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) keep mnt_optlist_get_optstr() less verbose
Karel Zak [Fri, 19 Aug 2022 09:32:35 +0000 (11:32 +0200)] 
libmount: (optlist) keep mnt_optlist_get_optstr() less verbose

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: optimize built-in options map use
Karel Zak [Fri, 19 Aug 2022 08:58:51 +0000 (10:58 +0200)] 
libmount: optimize built-in options map use

Let's keep the maps in libmnt_context to reduce
mnt_get_builtin_optmap() calls and to simplify code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove unused variable
Karel Zak [Fri, 19 Aug 2022 08:28:24 +0000 (10:28 +0200)] 
libmount: remove unused variable

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use optlist for mount(2) options and flags
Karel Zak [Thu, 18 Aug 2022 11:46:38 +0000 (13:46 +0200)] 
libmount: (mount) use optlist for mount(2) options and flags

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) consolidate filter use
Karel Zak [Thu, 18 Aug 2022 11:46:28 +0000 (13:46 +0200)] 
libmount: (optlist) consolidate filter use

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optstr) remove unnecessary code
Karel Zak [Thu, 18 Aug 2022 10:58:41 +0000 (12:58 +0200)] 
libmount: (optstr) remove unnecessary code

Replaced by optlist.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use optlist to generate options for mount.<type> helpers
Karel Zak [Thu, 18 Aug 2022 10:53:08 +0000 (12:53 +0200)] 
libmount: use optlist to generate options for mount.<type> helpers

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) filter by optmap masks
Karel Zak [Thu, 18 Aug 2022 10:38:44 +0000 (12:38 +0200)] 
libmount: (optlist) filter by optmap masks

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) add mnt_optlist_strdup_optstr()
Karel Zak [Thu, 18 Aug 2022 10:27:09 +0000 (12:27 +0200)] 
libmount: (optlist) add mnt_optlist_strdup_optstr()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) de-duplicate when apply MS_SECURE
Karel Zak [Thu, 18 Aug 2022 10:04:43 +0000 (12:04 +0200)] 
libmount: (mount) de-duplicate when apply MS_SECURE

The options string "users,exec" is "users,nodev,nosuid,noexec,exec",
the option "noexec" is unnecessary here. The last option is the winner
("exec" in this case).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) de-duplicate also according to invert mask
Karel Zak [Thu, 18 Aug 2022 09:59:08 +0000 (11:59 +0200)] 
libmount: (optlist) de-duplicate also according to invert mask

The last option is the winner, it means "noexec,exec" is "exec".

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) improve cache and filtering
Karel Zak [Thu, 18 Aug 2022 08:58:33 +0000 (10:58 +0200)] 
libmount: (optlist) improve cache and filtering

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use optlist from options processing
Karel Zak [Thu, 18 Aug 2022 07:51:57 +0000 (09:51 +0200)] 
libmount: (mount) use optlist from options processing

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) extend functionality
Karel Zak [Thu, 18 Aug 2022 07:39:19 +0000 (09:39 +0200)] 
libmount: (optlist) extend functionality

* remember MS_REMOUNT and add mnt_optlist_is_remount()

* fix opt->external use

* add possibility to filter options for mnt_optlist_get_*()

* allow to set/get values

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use optlist in permission evaluation
Karel Zak [Mon, 15 Aug 2022 15:33:40 +0000 (17:33 +0200)] 
libmount: use optlist in permission evaluation

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (context) use default options maps
Karel Zak [Mon, 15 Aug 2022 15:32:40 +0000 (17:32 +0200)] 
libmount: (context) use default options maps

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) improve mnt_optlist_insert_flags()
Karel Zak [Mon, 15 Aug 2022 15:30:59 +0000 (17:30 +0200)] 
libmount: (optlist) improve mnt_optlist_insert_flags()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add mnt_optlist_remove_flags() and mnt_opt_set_external()
Karel Zak [Thu, 14 Jul 2022 09:00:45 +0000 (11:00 +0200)] 
libmount: add mnt_optlist_remove_flags() and mnt_opt_set_external()

- add mnt_optlist_remove_flags() to make it easy to work with flags
- add mnt_opt_set_external() to hidde unnecessary options
- clean up private library header file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: use optlist to detect propagation changes
Karel Zak [Thu, 14 Jul 2022 08:59:32 +0000 (10:59 +0200)] 
libblkid: use optlist to detect propagation changes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: apply fstab options to context optlist
Karel Zak [Wed, 13 Jul 2022 14:04:58 +0000 (16:04 +0200)] 
libmount: apply fstab options to context optlist

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use optlist to set/get options in mount context
Karel Zak [Tue, 28 Jun 2022 11:55:47 +0000 (13:55 +0200)] 
libmount: use optlist to set/get options in mount context

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: improve optlist
Karel Zak [Tue, 28 Jun 2022 11:52:34 +0000 (13:52 +0200)] 
libmount: improve optlist

* cache already generated mount strings

* add mnt_optlist_merge_opts() to de-duplicate mount options

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (optlist) support merged optlist
Karel Zak [Tue, 28 Jun 2022 08:43:30 +0000 (10:43 +0200)] 
libmount: (optlist) support merged optlist

For backward compatibility in mnt_context_* interface we need a way how
to work independently with mount flags and mount options. The library
merges all the options and flags later during mnt_context_prepare_*.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add optlist tests
Karel Zak [Mon, 27 Jun 2022 17:40:38 +0000 (19:40 +0200)] 
libmount: add optlist tests

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add libmnt_optlist
Karel Zak [Fri, 24 Jun 2022 16:15:25 +0000 (18:15 +0200)] 
libmount: add libmnt_optlist

Now libmount internally keeps mount options as strings or flags. This
commit adds a new container to keep parsed mount options in memory.
We need:

 * the same mount options could be mapped to the different mount options
   maps (for example "nosuid" to classic MS_NOSUID or new MOUNT_ATTR_NOSUID)

 * easy to sync flags and strings (e.g. conversion from MS_NOSUID to
   "nosuid" and vice-versa).

 * double linked list is easy to use in while() when browse all options

 * easy to filter options by specific map (MS_*, userspace, etc.)

 * don't hardcode options maps in options parser, support 3th-party
   maps (for example for extensions like dm-verity, etc.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix possible leaks on error
Karel Zak [Fri, 24 Jun 2022 15:09:41 +0000 (17:09 +0200)] 
libmount: fix possible leaks on error

Signed-off-by: Karel Zak <kzak@redhat.com>