]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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>
2 years agolibmount: make __buffer_append_option() usable in entire lib
Karel Zak [Fri, 24 Jun 2022 14:52:46 +0000 (16:52 +0200)] 
libmount: make __buffer_append_option() usable in entire lib

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix mount hooks use
Karel Zak [Fri, 10 Jun 2022 08:24:10 +0000 (10:24 +0200)] 
libmount: fix mount hooks use

The function do_mount() is possible to call in loop, for example when
libmount try FS types ("mount -t foo,bar,ext4 /dev/sdc1 /mnt"). In
this case it's bad idea to call in the loop also hooks that do
non-mount operations.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add MNT_STAGE_PREP
Karel Zak [Fri, 10 Jun 2022 08:01:24 +0000 (10:01 +0200)] 
libmount: add MNT_STAGE_PREP

It's better to introduce a new stage to call hooks when all is
prepared rather than use MNT_STAGE_PREP_OPTIONS for all cases.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/mount-api-utils: add new syscalls
Karel Zak [Thu, 9 Jun 2022 11:01:52 +0000 (13:01 +0200)] 
include/mount-api-utils: add new syscalls

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/mount-api-utils: cleanup
Karel Zak [Thu, 9 Jun 2022 10:28:09 +0000 (12:28 +0200)] 
include/mount-api-utils: cleanup

* use SYS_* macros

* check for the syscalls in configure.ac

* use SYS_* macros for #ifdefs

* add "idmapping" to the list if libmount features

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/mount-api-utils: fix indention
Karel Zak [Thu, 9 Jun 2022 10:15:41 +0000 (12:15 +0200)] 
include/mount-api-utils: fix indention

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: accept X-mount.idmap=
Christian Brauner [Wed, 1 Jun 2022 13:52:07 +0000 (15:52 +0200)] 
libmount: accept X-mount.idmap=

This adds a new mount option X-mount.idmap. This mount option can be
used to create an idmapped mount.

An idmapped mount allows to change ownership of all files located under
a mount according to the ID-mapping associated with a user namespace.

The ownership change is tied to the lifetime and localized to the
relevant mount. The relevant ID-mapping can be specified in two ways:

* A user can specify the ID-mapping directly.
  The ID-mapping must be specified using the syntax
  id-type:id-mount:id-host:id-range
  Specifying "u" as the id-type prefix creates a UID-mapping, "g"
  creates a GID-mapping and omitting id-type or specifying "b"
  creates both a UID- and GID-mapping.
  The id-mount parameter indicates the starting ID in the new mount.
  The id-host parameter indicates the starting ID in the filesystem.
  The id-range parameter indicates how many IDs are to be mapped.
  It is possible to specify multiple ID-mappings.
  The individual ID-mappings must be separated by spaces.

  For example, the ID-mapping
  X-mount.idmap=u:1000:0:1 g:1001:1:2 5000:1000:2
  creates an idmapped mount where UID 0 is mapped to UID 1000, GID 1 is
  mapped to GUID 1001, GID 2 is mapped to GID 1002, UID and GID 1000 are
  mapped to 5000, and UID and GID 1001 are mapped to 5001 in the mount.

  When an ID-mapping is specified directly a new user namespace will be
  allocated with the requested ID-mapping.
  The newly created user namespace will be attached to the mount.

* A user can specify a user namespace file.
  The user namespace will then be attached to the mount and the
  ID-mapping of the user namespace will become the ID-mapping of the
  mount.
  For example, *X-mount.idmap=/proc/PID/ns/user* will attach the user
  namespace of the process PID to the mount.

Even more details about idmapped mounts can be found in the
mount_setattr(2) manpage of the linux-manpage project.

[kzak@redhat.com: - port Christian's patch to the new libmount hooks API]

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: improve debug messages
Karel Zak [Wed, 1 Jun 2022 13:21:55 +0000 (15:21 +0200)] 
libmount: improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove unnecessary declarations
Karel Zak [Tue, 31 May 2022 15:53:53 +0000 (17:53 +0200)] 
libmount: remove unnecessary declarations

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: check for mount_attr in linux/mount.h
Karel Zak [Tue, 31 May 2022 15:27:04 +0000 (17:27 +0200)] 
build-sys: check for mount_attr in linux/mount.h

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude: add mount-api-utils.h
Christian Brauner [Mon, 16 Aug 2021 14:45:17 +0000 (16:45 +0200)] 
include: add mount-api-utils.h

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolibmount: reimplement X-mount.{owner,group,mode}= by hooks
Karel Zak [Mon, 30 May 2022 09:47:32 +0000 (11:47 +0200)] 
libmount: reimplement X-mount.{owner,group,mode}= by hooks

* "prepare-options hook" parses {owner,group,mode}= options

* "mount-post hook" calls chmod/own

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: add missing files
Karel Zak [Mon, 30 May 2022 09:43:08 +0000 (11:43 +0200)] 
meson: add missing files

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove hooks initialization
Karel Zak [Mon, 30 May 2022 07:47:04 +0000 (09:47 +0200)] 
libmount: remove hooks initialization

The hookset initialization is unnecessary. It's enough to do the
initialization in the first hook (usually in the "prepare" stage).

This change safes memory and time.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: reimplement X-mount.subdir= by hooks
Karel Zak [Wed, 25 May 2022 12:01:52 +0000 (14:01 +0200)] 
libmount: reimplement X-mount.subdir= by hooks

* "prepare-target hook" checks for X-mount.subdir= and define pre-mount hook

* "mount-pre hook" unshares temporary directory, redirect the next
  mount(2) to this temporary directory

* "mount-post hook" binds subdirectory to the final target, umounts
  temporary directory

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mkdir) cannonicalize after mkdir
Karel Zak [Mon, 23 May 2022 10:58:08 +0000 (12:58 +0200)] 
libmount: (mkdir) cannonicalize after mkdir

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: move X-mount.mkdir to separate file
Karel Zak [Mon, 23 May 2022 10:15:29 +0000 (12:15 +0200)] 
libmount: move X-mount.mkdir to separate file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: move mount-only functions to context_mount.c
Karel Zak [Mon, 23 May 2022 09:45:57 +0000 (11:45 +0200)] 
libmount: move mount-only functions to context_mount.c

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: implement hooks for a legacy mount(2)
Karel Zak [Thu, 19 May 2022 11:55:43 +0000 (13:55 +0200)] 
libmount: implement hooks for a legacy mount(2)

* replaces context "addmounts" functionality with more generic hooks

* "hooksets" handles complex functionality by a set of hooks.

  During initialization (or later), the hookset can define
  arbitrary hook function(s). The library will call the functions from
  a specified place ("stage"). Now supported stages are
  prepare-options, pre-mount, mount, and post-mount.

  This solution looks complex at first glance, but it will help
  keep all extensions separated from core library code (IDs mapping,
  X-mount.chown/chmod, X-mount.subdir, etc.). It will also be possible to
  support multiple implementations for the same functionality (classic
  mount(2) vs. new fsmount(2)) without #ifdefs storms etc.

  Maybe later we can also use hooksets for external library modules
  (like verity support).

* __legacy-mount hookset implements support for the classic mount(2)
  syscall. Supported hooks:

  prepare-options - analyzes the current setting (libmnt_context)
    and setup other hooks when necessary

  mount - calls mount(2) for standard "/dev to /mnt" use-cases

  post-mount (two possible hooks):
      - calls mount(2) to modify propagation flags
      - calls mount(2) to implement bind-remount (mount --bind -oro)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch '1' of https://github.com/neheb/util-linux
Karel Zak [Mon, 2 Jan 2023 12:34:01 +0000 (13:34 +0100)] 
Merge branch '1' of https://github.com/neheb/util-linux

* '1' of https://github.com/neheb/util-linux:
  meson: fix option value

2 years agoMerge branch 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:32:58 +0000 (13:32 +0100)] 
Merge branch 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux

* 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux:
  libblkid: topology: probe diskseq
  libblkid: topology: allow setting of 64bit values
  lib/sysfs: allow parent redirect even for non-queue files
  blockdev: add support for ioctl BLKGETDISKSEQ
  libblkid: topology: add test
  tests: functions: allow partitions on loopdevs

2 years agoMerge branch 'cleanups' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:24:23 +0000 (13:24 +0100)] 
Merge branch 'cleanups' of https://github.com/t-8ch/util-linux

* 'cleanups' of https://github.com/t-8ch/util-linux:
  fadvise: fix parsing of option -V
  libblkid: zfs: remove unnecessary newline from debug messages
  libblkid: topology: constify some structures
  lib: sysfs: fix typo

2 years agoMerge branch 'umount-completion' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:08:29 +0000 (13:08 +0100)] 
Merge branch 'umount-completion' of https://github.com/t-8ch/util-linux

* 'umount-completion' of https://github.com/t-8ch/util-linux:
  umount: properly handle special characters in completion

2 years agoMerge branch 'blockdev' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:07:45 +0000 (13:07 +0100)] 
Merge branch 'blockdev' of https://github.com/t-8ch/util-linux

* 'blockdev' of https://github.com/t-8ch/util-linux:
  blockdev: add support for ioctl BLKGETDISKSEQ

2 years agoMerge branch 'part-csum' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:06:41 +0000 (13:06 +0100)] 
Merge branch 'part-csum' of https://github.com/t-8ch/util-linux

* 'part-csum' of https://github.com/t-8ch/util-linux:
  libblkid: bsd: add checksum support
  libblkid: sun: use generic checksum handling
  libblkid: sgi: use generic checksum handling
  libblkid: gpt: use generic checksum handling

2 years agoMerge branch 'lsns-ioctl-check' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:05:13 +0000 (13:05 +0100)] 
Merge branch 'lsns-ioctl-check' of https://github.com/t-8ch/util-linux

* 'lsns-ioctl-check' of https://github.com/t-8ch/util-linux:
  Revert "tests: use KNOWN_FAIL for lsns/ioctl_ns"

2 years agoMerge branch 'lsblk-nvme' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 2 Jan 2023 12:04:38 +0000 (13:04 +0100)] 
Merge branch 'lsblk-nvme' of https://github.com/mbroz/util-linux

* 'lsblk-nvme' of https://github.com/mbroz/util-linux:
  Update email.
  lsblk: add revision output to --nvme list
  lsblk: read firmware revision from udev

2 years agoMerge branch 'stat-parsing' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 12:02:51 +0000 (13:02 +0100)] 
Merge branch 'stat-parsing' of https://github.com/t-8ch/util-linux

* 'stat-parsing' of https://github.com/t-8ch/util-linux:
  procfs: get_stat_nth: handle braces in process name
  lib: procfs: add parsing cmd containing newline
  lib: procfs: add unittests
  lib: procfs: prefix support for tests
  lib: procfs: fix error message during test
  lib: procfs: fix typo in argument specification
  lib: procfs: clarify name of procfs_process_get_data_for()

2 years agoMerge branch 'mmc' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 11:44:57 +0000 (12:44 +0100)] 
Merge branch 'mmc' of https://github.com/t-8ch/util-linux

* 'mmc' of https://github.com/t-8ch/util-linux:
  lsblk: add mmc transport

2 years agoMerge branch 'address_bits' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Jan 2023 11:44:23 +0000 (12:44 +0100)] 
Merge branch 'address_bits' of https://github.com/t-8ch/util-linux

* 'address_bits' of https://github.com/t-8ch/util-linux:
  setarch: use kernel address size if possible
  sysfs: add helper for /sys/kernel/address_bits

2 years agoMerge branch 'bst/hwclock-ret-param-get' of https://github.com/Bastian-Krause/util...
Karel Zak [Mon, 2 Jan 2023 11:24:18 +0000 (12:24 +0100)] 
Merge branch 'bst/hwclock-ret-param-get' of https://github.com/Bastian-Krause/util-linux

* 'bst/hwclock-ret-param-get' of https://github.com/Bastian-Krause/util-linux:
  hwclock: fix return value on successful --param-get

2 years agoMerge branch 'meson-debian' of https://github.com/zeha/util-linux
Karel Zak [Mon, 2 Jan 2023 11:23:11 +0000 (12:23 +0100)] 
Merge branch 'meson-debian' of https://github.com/zeha/util-linux

* 'meson-debian' of https://github.com/zeha/util-linux:
  meson: install uuidd.rc with -Dsysvinit=enabled
  meson: fix pkg-config name of libaudit
  meson: fix build with -Dselinux=enabled

2 years agoMerge branch 'misc-utils-rename-documentation' of https://github.com/ChickenProp...
Karel Zak [Mon, 2 Jan 2023 11:22:11 +0000 (12:22 +0100)] 
Merge branch 'misc-utils-rename-documentation' of https://github.com/ChickenProp/util-linux

* 'misc-utils-rename-documentation' of https://github.com/ChickenProp/util-linux:
  rename.1: document edge cases.

2 years agomeson: fix option value
Rosen Penev [Sun, 1 Jan 2023 20:25:47 +0000 (12:25 -0800)] 
meson: fix option value

This is a boolean, not a string.

Found with muon analyze.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agolibblkid: topology: probe diskseq
Thomas Weißschuh [Wed, 28 Dec 2022 01:47:08 +0000 (01:47 +0000)] 
libblkid: topology: probe diskseq

2 years agolibblkid: topology: allow setting of 64bit values
Thomas Weißschuh [Wed, 28 Dec 2022 01:45:46 +0000 (01:45 +0000)] 
libblkid: topology: allow setting of 64bit values

2 years agolib/sysfs: allow parent redirect even for non-queue files
Thomas Weißschuh [Wed, 28 Dec 2022 01:41:42 +0000 (01:41 +0000)] 
lib/sysfs: allow parent redirect even for non-queue files

We will also need this redirect for other sysfs files.

2 years agoblockdev: add support for ioctl BLKGETDISKSEQ
Thomas Weißschuh [Tue, 27 Dec 2022 00:28:53 +0000 (00:28 +0000)] 
blockdev: add support for ioctl BLKGETDISKSEQ

2 years agoblockdev: add support for ioctl BLKGETDISKSEQ
Thomas Weißschuh [Tue, 27 Dec 2022 00:28:53 +0000 (00:28 +0000)] 
blockdev: add support for ioctl BLKGETDISKSEQ

2 years agofadvise: fix parsing of option -V
Thomas Weißschuh [Sun, 25 Dec 2022 13:23:34 +0000 (13:23 +0000)] 
fadvise: fix parsing of option -V