1 AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
3 dnl # 3.9 (to 4.9) API change,
5 dnl # A new version of iops->rename() was added (rename2) that takes a flag
6 dnl # argument (to support renameat2). However this separate function was
7 dnl # merged back into iops->rename() in Linux 4.9.
9 ZFS_LINUX_TEST_SRC([inode_operations_rename2], [
11 int rename2_fn(struct inode *sip, struct dentry *sdp,
12 struct inode *tip, struct dentry *tdp,
13 unsigned int flags) { return 0; }
15 static const struct inode_operations
16 iops __attribute__ ((unused)) = {
17 .rename2 = rename2_fn,
24 dnl # iops->rename2() merged into iops->rename(), and iops->rename() now
27 ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
29 int rename_fn(struct inode *sip, struct dentry *sdp,
30 struct inode *tip, struct dentry *tdp,
31 unsigned int flags) { return 0; }
33 static const struct inode_operations
34 iops __attribute__ ((unused)) = {
40 dnl # EL7 compatibility
42 dnl # EL7 has backported renameat2 support, but it's done by defining a
43 dnl # separate iops wrapper structure that takes the .renameat2 function.
45 ZFS_LINUX_TEST_SRC([dir_inode_operations_wrapper_rename2], [
47 int rename2_fn(struct inode *sip, struct dentry *sdp,
48 struct inode *tip, struct dentry *tdp,
49 unsigned int flags) { return 0; }
51 static const struct inode_operations_wrapper
52 iops __attribute__ ((unused)) = {
53 .rename2 = rename2_fn,
58 dnl # 5.12 API change,
60 dnl # Linux 5.12 introduced passing struct user_namespace* as the first
61 dnl # argument of the rename() and other inode_operations members.
63 ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
65 int rename_fn(struct user_namespace *user_ns, struct inode *sip,
66 struct dentry *sdp, struct inode *tip, struct dentry *tdp,
67 unsigned int flags) { return 0; }
69 static const struct inode_operations
70 iops __attribute__ ((unused)) = {
76 dnl # 6.3 API change - the first arg is now struct mnt_idmap*
78 ZFS_LINUX_TEST_SRC([inode_operations_rename_mnt_idmap], [
80 int rename_fn(struct mnt_idmap *idmap, struct inode *sip,
81 struct dentry *sdp, struct inode *tip, struct dentry *tdp,
82 unsigned int flags) { return 0; }
84 static const struct inode_operations
85 iops __attribute__ ((unused)) = {
91 AC_DEFUN([ZFS_AC_KERNEL_RENAME], [
92 AC_MSG_CHECKING([whether iops->rename() takes struct mnt_idmap*])
93 ZFS_LINUX_TEST_RESULT([inode_operations_rename_mnt_idmap], [
95 AC_DEFINE(HAVE_IOPS_RENAME_IDMAP, 1,
96 [iops->rename() takes struct mnt_idmap*])
98 AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*])
99 ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [
101 AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1,
102 [iops->rename() takes struct user_namespace*])
106 AC_MSG_CHECKING([whether iops->rename2() exists])
107 ZFS_LINUX_TEST_RESULT([inode_operations_rename2], [
109 AC_DEFINE(HAVE_RENAME2, 1, [iops->rename2() exists])
113 AC_MSG_CHECKING([whether iops->rename() wants flags])
114 ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
116 AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
117 [iops->rename() wants flags])
121 AC_MSG_CHECKING([whether struct inode_operations_wrapper takes .rename2()])
122 ZFS_LINUX_TEST_RESULT([dir_inode_operations_wrapper_rename2], [
124 AC_DEFINE(HAVE_RENAME2_OPERATIONS_WRAPPER, 1,
125 [struct inode_operations_wrapper takes .rename2()])