xref: /freebsd/sys/contrib/openzfs/config/kernel-idmap_mnt_api.m4 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1dnl #
2dnl # 5.12 API
3dnl #
4dnl # Check if APIs for idmapped mount are available
5dnl #
6AC_DEFUN([ZFS_AC_KERNEL_SRC_IDMAP_MNT_API], [
7        ZFS_LINUX_TEST_SRC([idmap_mnt_api], [
8                #include <linux/fs.h>
9        ],[
10		int fs_flags = 0;
11		fs_flags |= FS_ALLOW_IDMAP;
12        ])
13])
14
15AC_DEFUN([ZFS_AC_KERNEL_IDMAP_MNT_API], [
16        AC_MSG_CHECKING([whether APIs for idmapped mount are present])
17        ZFS_LINUX_TEST_RESULT([idmap_mnt_api], [
18                AC_MSG_RESULT([yes])
19                AC_DEFINE(HAVE_IDMAP_MNT_API, 1,
20                    [APIs for idmapped mount are present])
21        ],[
22                AC_MSG_RESULT([no])
23        ])
24])
25
26dnl #
27dnl # 6.8 decouples mnt_idmap from user_namespace. This is all internal
28dnl # to mnt_idmap so we can't detect it directly, but we detect a related
29dnl # change as use that as a signal.
30dnl #
31AC_DEFUN([ZFS_AC_KERNEL_SRC_IDMAP_NO_USERNS], [
32	ZFS_LINUX_TEST_SRC([idmap_no_userns], [
33		#include <linux/uidgid.h>
34	], [
35		struct uid_gid_map *map = NULL;
36		map_id_down(map, 0);
37	])
38])
39
40
41AC_DEFUN([ZFS_AC_KERNEL_IDMAP_NO_USERNS], [
42	AC_MSG_CHECKING([whether idmapped mounts have a user namespace])
43	ZFS_LINUX_TEST_RESULT([idmap_no_userns], [
44		AC_MSG_RESULT([yes])
45		AC_DEFINE(HAVE_IDMAP_NO_USERNS, 1,
46			[mnt_idmap does not have user_namespace])
47	], [
48		AC_MSG_RESULT([no])
49	])
50])
51