Files
mirror_zfs/config/kernel-acl.m4
T

217 lines
5.9 KiB
Plaintext
Raw Normal View History

dnl # SPDX-License-Identifier: CDDL-1.0
2013-10-28 09:22:15 -07:00
dnl #
dnl # 3.1 API change,
2019-11-12 08:59:06 -08:00
dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t
2013-10-28 09:22:15 -07:00
dnl #
2019-10-01 12:50:34 -07:00
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
2013-10-28 09:22:15 -07:00
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
umode_t tmp;
2019-11-12 08:59:06 -08:00
posix_acl_equiv_mode(NULL, &tmp);
2019-10-01 12:50:34 -07:00
])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
2013-10-28 09:22:15 -07:00
AC_MSG_RESULT(yes)
],[
2019-11-12 08:59:06 -08:00
ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()])
2013-10-28 09:22:15 -07:00
])
])
dnl #
dnl # 7.0 API change
dnl # posix_acl_to_xattr() now allocates and returns the value.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_TO_XATTR_ALLOC], [
ZFS_LINUX_TEST_SRC([posix_acl_to_xattr_alloc], [
#include <linux/fs.h>
#include <linux/posix_acl_xattr.h>
], [
struct user_namespace *ns = NULL;
struct posix_acl *acl = NULL;
size_t size = 0;
gfp_t gfp = 0;
void *xattr = NULL;
xattr = posix_acl_to_xattr(ns, acl, &size, gfp);
])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_TO_XATTR_ALLOC], [
AC_MSG_CHECKING([whether posix_acl_to_xattr() allocates its result]);
ZFS_LINUX_TEST_RESULT([posix_acl_to_xattr_alloc], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_ACL_TO_XATTR_ALLOC, 1,
[posix_acl_to_xattr() allocates its result])
], [
AC_MSG_RESULT(no)
])
])
2013-10-28 09:22:15 -07:00
dnl #
dnl # 3.1 API change,
dnl # Check if inode_operations contains the function get_acl
dnl #
2021-09-09 09:38:35 -07:00
dnl # 5.15 API change,
dnl # Added the bool rcu argument to get_acl for rcu path walk.
dnl #
dnl # 6.2 API change,
dnl # get_acl() was renamed to get_inode_acl()
dnl #
2019-10-01 12:50:34 -07:00
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
2013-10-28 09:22:15 -07:00
#include <linux/fs.h>
static struct posix_acl *get_acl_fn(struct inode *inode, int type)
2013-10-28 09:22:15 -07:00
{ return NULL; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.get_acl = get_acl_fn,
};
2019-10-01 12:50:34 -07:00
],[])
2021-09-09 09:38:35 -07:00
ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
#include <linux/fs.h>
static struct posix_acl *get_acl_fn(struct inode *inode, int type,
2021-09-09 09:38:35 -07:00
bool rcu) { return NULL; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.get_acl = get_acl_fn,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
#include <linux/fs.h>
static struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
bool rcu) { return NULL; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.get_inode_acl = get_inode_acl_fn,
};
],[])
2019-10-01 12:50:34 -07:00
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
AC_MSG_CHECKING([whether iops->get_acl() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
2013-10-28 09:22:15 -07:00
AC_MSG_RESULT(yes)
2021-09-09 09:38:35 -07:00
AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
2013-10-28 09:22:15 -07:00
],[
2021-09-09 09:38:35 -07:00
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
],[
ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()])
],[
ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()])
])
2021-09-09 09:38:35 -07:00
])
2013-10-28 09:22:15 -07:00
])
])
2016-11-09 10:37:17 -08:00
dnl #
dnl # 5.12 API change,
dnl # set_acl() added a user_namespace* parameter first
dnl #
dnl # 6.2 API change,
dnl # set_acl() second paramter changed to a struct dentry *
dnl #
dnl # 6.3 API change,
dnl # set_acl() first parameter changed to struct mnt_idmap *
dnl #
2019-10-01 12:50:34 -07:00
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
ZFS_LINUX_TEST_SRC([inode_operations_set_acl_mnt_idmap_dentry], [
#include <linux/fs.h>
static int set_acl_fn(struct mnt_idmap *idmap,
struct dentry *dent, struct posix_acl *acl,
int type) { return 0; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.set_acl = set_acl_fn,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns_dentry], [
#include <linux/fs.h>
static int set_acl_fn(struct user_namespace *userns,
struct dentry *dent, struct posix_acl *acl,
int type) { return 0; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.set_acl = set_acl_fn,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
#include <linux/fs.h>
static int set_acl_fn(struct user_namespace *userns,
struct inode *inode, struct posix_acl *acl,
int type) { return 0; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.set_acl = set_acl_fn,
};
],[])
2019-10-01 12:50:34 -07:00
ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
2016-11-09 10:37:17 -08:00
#include <linux/fs.h>
static int set_acl_fn(struct inode *inode, struct posix_acl *acl,
2019-10-01 12:50:34 -07:00
int type) { return 0; }
2016-11-09 10:37:17 -08:00
static const struct inode_operations
iops __attribute__ ((unused)) = {
.set_acl = set_acl_fn,
};
2019-10-01 12:50:34 -07:00
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
2024-08-04 09:47:34 +10:00
AC_MSG_CHECKING([whether iops->set_acl() with 4 args exists])
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
2016-11-09 10:37:17 -08:00
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
2016-11-09 10:37:17 -08:00
],[
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_mnt_idmap_dentry], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_ACL_IDMAP_DENTRY, 1,
[iops->set_acl() takes 4 args, arg1 is struct mnt_idmap *])
],[
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
[iops->set_acl() takes 4 args, arg2 is struct dentry *])
],[
2024-08-04 09:47:34 +10:00
AC_MSG_RESULT(no)
])
])
2016-11-09 10:37:17 -08:00
])
])
2019-10-01 12:50:34 -07:00
AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_SRC_POSIX_ACL_TO_XATTR_ALLOC
2019-10-01 12:50:34 -07:00
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
])
AC_DEFUN([ZFS_AC_KERNEL_ACL], [
ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_POSIX_ACL_TO_XATTR_ALLOC
2019-10-01 12:50:34 -07:00
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
])