]> git.ipfire.org Git - thirdparty/util-linux.git/commit
include/mount-api-utils: add statmount and listmount
authorKarel Zak <kzak@redhat.com>
Wed, 14 Aug 2024 13:33:44 +0000 (15:33 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Jan 2025 12:57:42 +0000 (13:57 +0100)
commitded434a63f3eee7fd7805b18d6c9bb912016c3c8
treeef93d9e465bd3d3baa7342227bd88fafb445e487
parentbc750375c3be262e994ac59cb09ed95dc7173cda
include/mount-api-utils: add statmount and listmount

* Make the includes and ifdefs in the file more generic, to cover
  other interfaces besides just HAVE_MOUNTFD_API.

* Add #ifdef HAVE_STATMOUNT_API to the header file.

* Add fallbacks for statmount and listmount masks and flags.

* Add a local definition of the structs mnt_id_req and statmount.

  We do not want to depend on kernel headers for now, as all of this is
  still under development. Installed headers may provide old versions,
  and a solution based on #ifdef will still require local definition of
  the structs.

* Add wrappers for the statmount() and listmount() syscalls.

* Add sys_statmount(), a wrapper for statmount() that reallocates the
  statmount buffer (on EOVERFLOW errno) if it is not large enough.

Note that for now, we are directly using syscalls and do not require
libc support for statmount() and listmount(). The kernel API is very
extensible, as it is based on structs rather than syscall arguments.
Therefore, I doubt we will see any libc support in the near future.

The code uses the "ul_" prefix for locally defined variables and
functions to prevent conflicts with kernel headers and potential
future versions of libc.

Signed-off-by: Karel Zak <kzak@redhat.com>
include/mount-api-utils.h