UL_CHECK_SYSCALL([move_mount])
UL_CHECK_SYSCALL([open_tree])
+AS_IF([test "x$ul_cv_syscall_fsconfig" = xno ||
+ test "x$ul_cv_syscall_fsmount" = xno ||
+ test "x$ul_cv_syscall_fsopen" = xno ||
+ test "x$ul_cv_syscall_fspick" = xno ||
+ test "x$ul_cv_syscall_mount_setattr" = xno ||
+ test "x$ul_cv_syscall_move_mount" = xno ||
+ test "x$ul_cv_syscall_open_tree" = xno],
+ [
+ have_mountfd_api="no"
+ ],[
+ have_mountfd_api="yes"
+ AC_DEFINE([HAVE_MOUNTFD_API], [1], [Define to 1 if you want mount API based on FDs.])
+ ])
+
AC_CHECK_FUNCS([isnan], [],
[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
[], [enable_libmount_support_mtab=no]
)
+AC_ARG_ENABLE([libmount-mountfd-support],
+ AS_HELP_STRING([--disable-libmount-mountfd-support], [do not use new mount API based on FDs]),
+ [], [enable_libmount_mountfd_support=check]
+)
+UL_BUILD_INIT([libmount_mountfd_support])
+UL_REQUIRES_BUILD([libmount_mountfd_support], [libmount])
+UL_REQUIRES_LINUX([libmount_mountfd_support])
+UL_REQUIRES_HAVE([libmount_mountfd_support], [mountfd_api], [mount FDs based API])
+AS_IF([test "x$build_libmount_mountfd_support" = xyes ], [
+ AC_DEFINE([USE_LIBMOUNT_MOUNTFD_SUPPORT], [1], [Enable support for new mount FD based kernel API])
+])
+
+
dnl
dnl libsmartcols
dnl
#ifndef UTIL_LINUX_MOUNT_API_UTILS
#define UTIL_LINUX_MOUNT_API_UTILS
-#if defined(__linux__)
+#ifdef HAVE_MOUNTFD_API
+
#include <sys/syscall.h>
#include <linux/mount.h>
}
#endif
-
-/*
- * UL_HAVE_MOUNT_API is used by applications to check that all new mount API is
- * avalable.
- */
-#if defined(SYS_open_tree) && \
- defined(SYS_mount_setattr) && \
- defined(SYS_move_mount) && \
- defined(SYS_fsconfig) && \
- defined(SYS_fsopen) && \
- defined(SYS_fsmount) && \
- defined(SYS_fspick)
-
-# define UL_HAVE_MOUNT_API 1
-#endif
-
-#endif /* __linux__ */
+#endif /* HAVE_MOUNTFD_API */
#endif /* UTIL_LINUX_MOUNT_API_UTILS */
# include <linux/nsfs.h>
#endif
-#ifdef UL_HAVE_MOUNT_API
+#ifdef HAVE_MOUNTFD_API
typedef enum idmap_type_t {
ID_TYPE_UID, /* uidmap entry */
.deinit = hookset_deinit
};
-#endif /* UL_HAVE_MOUNT_API */
+#endif /* HAVE_MOUNTFD_API */
#include "mountP.h"
#include <inttypes.h>
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
#define get_sysapi(_cxt) mnt_context_get_sysapi(_cxt)
.deinit = hookset_deinit
};
-#endif /* UL_HAVE_MOUNT_API */
+#endif /* USE_LIBMOUNT_MOUNTFD_SUPPORT */
assert(cxt);
assert(hs == &hookset_mount_legacy);
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
/* do nothing when a new __mount succesfully registred */
if (mnt_context_has_hook(cxt, &hookset_mount, 0, NULL))
return 0;
{
int rc = 0;
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
struct libmnt_sysapi *api;
api = mnt_context_get_sysapi(cxt);
#endif
&hookset_mkdir,
&hookset_subdir,
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
&hookset_mount,
#endif
&hookset_mount_legacy,
-#ifdef UL_HAVE_MOUNT_API
+#ifdef HAVE_MOUNTFD_API
&hookset_idmap,
#endif
&hookset_owner
extern uint64_t btrfs_get_default_subvol_id(const char *path);
#endif
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
/* fsconfig/fsopen based stuff */
struct libmnt_sysapi {
int fd_fs; /* FD from fsopen() or fspick() */
return 0;
}
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
static inline uint64_t flag_to_attr(unsigned long flag)
{
switch (flag) {
* Like mnt_optlist_get_flags() for VFS flags, but converts classic MS_* flags to
* new MOUNT_ATTR_*
*/
-#ifdef UL_HAVE_MOUNT_API
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *clr)
{
struct libmnt_iter itr;
{
return 0;
}
-#endif /* UL_HAVE_MOUNT_API */
+#endif /* USE_LIBMOUNT_MOUNTFD_SUPPORT */
int mnt_optlist_strdup_optstr(struct libmnt_optlist *ls, char **optstr,
const struct libmnt_optmap *map, unsigned int what)
#ifdef USE_LIBMOUNT_SUPPORT_NAMESPACES
"namespaces",
#endif
-#ifdef UL_HAVE_MOUNT_API
+#ifdef HAVE_MOUNTFD_API
"idmapping",
+#endif
+#ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
"fd-based-mount",
#endif
#if !defined(NDEBUG)