diff mbox series

[v4,03/13] Add listmount/statmount fallback declarations

Message ID 20240909-listmount_statmount-v4-3-39558204ddf0@suse.com
State Accepted
Headers show
Series statmount/listmount testing suites | expand

Commit Message

Andrea Cervesato Sept. 9, 2024, 10 a.m. UTC
From: Andrea Cervesato <andrea.cervesato@suse.com>

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 configure.ac         |  4 +++
 include/lapi/mount.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

Comments

Cyril Hrubis Oct. 2, 2024, 2:12 p.m. UTC | #1
Hi!
> diff --git a/configure.ac b/configure.ac
> index ebbf49e28..3dca7c646 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -114,6 +114,7 @@ AC_CHECK_FUNCS_ONCE([ \
>      io_uring_register \
>      io_uring_enter \
>      kcmp \
> +    listmount \
>      mallinfo \
>      mallinfo2 \
>      mallopt \
> @@ -143,6 +144,7 @@ AC_CHECK_FUNCS_ONCE([ \
>      setns \
>      sigpending \
>      splice \
> +    statmount \
>      statx \
>      stime \
>      sync_file_range \

These two checks shouldn't be here because we do not use them at all and
just define cunstom wrappers later on.

> @@ -246,6 +248,8 @@ AC_CHECK_TYPES([struct mount_attr],,,[
>  
>  AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>])
>  AC_CHECK_TYPES([struct cachestat],,,[#include <sys/mman.h>])
> +AC_CHECK_TYPES([struct mnt_id_req],,,[#include <linux/mount.h>])
> +AC_CHECK_TYPES([struct statmount],,,[#include <linux/mount.h>])
>  
>  # Tools knobs
>  
> diff --git a/include/lapi/mount.h b/include/lapi/mount.h
> index c1af944fe..01a0fd2d6 100644
> --- a/include/lapi/mount.h
> +++ b/include/lapi/mount.h
> @@ -2,12 +2,15 @@
>  /*
>   * Copyright (c) Linux Test Project, 2015-2022
>   * Copyright (c) 2015 Cui Bixuan <cuibixuan@huawei.com>
> + * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
>   */
>  
>  #ifndef LAPI_MOUNT_H__
>  #define LAPI_MOUNT_H__
>  
> +#include <stdint.h>
>  #include <sys/mount.h>
> +#include "config.h"
>  
>  #ifndef MS_REC
>  # define MS_REC 16384
> @@ -37,4 +40,71 @@
>  # define MS_NOSYMFOLLOW 256
>  #endif
>  
> +#ifndef HAVE_STRUCT_MNT_ID_REQ
> +struct mnt_id_req {
> +	uint32_t size;
> +	uint32_t spare;
> +	uint64_t mnt_id;
> +	uint64_t param;
> +};
> +#endif
> +
> +#ifndef HAVE_STRUCT_STATMOUNT
> +struct statmount {
> +	uint32_t size;
> +	uint32_t __spare1;
> +	uint64_t mask;
> +	uint32_t sb_dev_major;
> +	uint32_t sb_dev_minor;
> +	uint64_t sb_magic;
> +	uint32_t sb_flags;
> +	uint32_t fs_type;
> +	uint64_t mnt_id;
> +	uint64_t mnt_parent_id;
> +	uint32_t mnt_id_old;
> +	uint32_t mnt_parent_id_old;
> +	uint64_t mnt_attr;
> +	uint64_t mnt_propagation;
> +	uint64_t mnt_peer_group;
> +	uint64_t mnt_master;
> +	uint64_t propagate_from;
> +	uint32_t mnt_root;
> +	uint32_t mnt_point;
> +	uint64_t __spare2[50];
> +	char str[];
> +};
> +#endif
> +
> +#ifndef MNT_ID_REQ_SIZE_VER0
> +# define MNT_ID_REQ_SIZE_VER0 24
> +#endif
> +
> +#ifndef STATMOUNT_SB_BASIC
> +# define STATMOUNT_SB_BASIC 0x00000001U
> +#endif
> +
> +#ifndef STATMOUNT_MNT_BASIC
> +# define STATMOUNT_MNT_BASIC 0x00000002U
> +#endif
> +
> +#ifndef STATMOUNT_PROPAGATE_FROM
> +# define STATMOUNT_PROPAGATE_FROM 0x00000004U
> +#endif
> +
> +#ifndef STATMOUNT_MNT_ROOT
> +# define STATMOUNT_MNT_ROOT 0x00000008U
> +#endif
> +
> +#ifndef STATMOUNT_MNT_POINT
> +# define STATMOUNT_MNT_POINT 0x00000010U
> +#endif
> +
> +#ifndef STATMOUNT_FS_TYPE
> +# define STATMOUNT_FS_TYPE 0x00000020U
> +#endif
> +
> +#ifndef LSMT_ROOT
> +# define LSMT_ROOT 0xffffffffffffffff
> +#endif
> +
>  #endif /* LAPI_MOUNT_H__ */

The rest looks fine:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index ebbf49e28..3dca7c646 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,7 @@  AC_CHECK_FUNCS_ONCE([ \
     io_uring_register \
     io_uring_enter \
     kcmp \
+    listmount \
     mallinfo \
     mallinfo2 \
     mallopt \
@@ -143,6 +144,7 @@  AC_CHECK_FUNCS_ONCE([ \
     setns \
     sigpending \
     splice \
+    statmount \
     statx \
     stime \
     sync_file_range \
@@ -246,6 +248,8 @@  AC_CHECK_TYPES([struct mount_attr],,,[
 
 AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>])
 AC_CHECK_TYPES([struct cachestat],,,[#include <sys/mman.h>])
+AC_CHECK_TYPES([struct mnt_id_req],,,[#include <linux/mount.h>])
+AC_CHECK_TYPES([struct statmount],,,[#include <linux/mount.h>])
 
 # Tools knobs
 
diff --git a/include/lapi/mount.h b/include/lapi/mount.h
index c1af944fe..01a0fd2d6 100644
--- a/include/lapi/mount.h
+++ b/include/lapi/mount.h
@@ -2,12 +2,15 @@ 
 /*
  * Copyright (c) Linux Test Project, 2015-2022
  * Copyright (c) 2015 Cui Bixuan <cuibixuan@huawei.com>
+ * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
  */
 
 #ifndef LAPI_MOUNT_H__
 #define LAPI_MOUNT_H__
 
+#include <stdint.h>
 #include <sys/mount.h>
+#include "config.h"
 
 #ifndef MS_REC
 # define MS_REC 16384
@@ -37,4 +40,71 @@ 
 # define MS_NOSYMFOLLOW 256
 #endif
 
+#ifndef HAVE_STRUCT_MNT_ID_REQ
+struct mnt_id_req {
+	uint32_t size;
+	uint32_t spare;
+	uint64_t mnt_id;
+	uint64_t param;
+};
+#endif
+
+#ifndef HAVE_STRUCT_STATMOUNT
+struct statmount {
+	uint32_t size;
+	uint32_t __spare1;
+	uint64_t mask;
+	uint32_t sb_dev_major;
+	uint32_t sb_dev_minor;
+	uint64_t sb_magic;
+	uint32_t sb_flags;
+	uint32_t fs_type;
+	uint64_t mnt_id;
+	uint64_t mnt_parent_id;
+	uint32_t mnt_id_old;
+	uint32_t mnt_parent_id_old;
+	uint64_t mnt_attr;
+	uint64_t mnt_propagation;
+	uint64_t mnt_peer_group;
+	uint64_t mnt_master;
+	uint64_t propagate_from;
+	uint32_t mnt_root;
+	uint32_t mnt_point;
+	uint64_t __spare2[50];
+	char str[];
+};
+#endif
+
+#ifndef MNT_ID_REQ_SIZE_VER0
+# define MNT_ID_REQ_SIZE_VER0 24
+#endif
+
+#ifndef STATMOUNT_SB_BASIC
+# define STATMOUNT_SB_BASIC 0x00000001U
+#endif
+
+#ifndef STATMOUNT_MNT_BASIC
+# define STATMOUNT_MNT_BASIC 0x00000002U
+#endif
+
+#ifndef STATMOUNT_PROPAGATE_FROM
+# define STATMOUNT_PROPAGATE_FROM 0x00000004U
+#endif
+
+#ifndef STATMOUNT_MNT_ROOT
+# define STATMOUNT_MNT_ROOT 0x00000008U
+#endif
+
+#ifndef STATMOUNT_MNT_POINT
+# define STATMOUNT_MNT_POINT 0x00000010U
+#endif
+
+#ifndef STATMOUNT_FS_TYPE
+# define STATMOUNT_FS_TYPE 0x00000020U
+#endif
+
+#ifndef LSMT_ROOT
+# define LSMT_ROOT 0xffffffffffffffff
+#endif
+
 #endif /* LAPI_MOUNT_H__ */