]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-rename.m4
FreeBSD: Add zfs_link_create() error handling
[mirror_zfs.git] / config / kernel-rename.m4
CommitLineData
e2a82961 1AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
dbf6108b
AS
2 dnl #
3 dnl # 3.9 (to 4.9) API change,
4 dnl #
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.
8 dnl #
9 ZFS_LINUX_TEST_SRC([inode_operations_rename2], [
10 #include <linux/fs.h>
a41d0b29 11 static int rename2_fn(struct inode *sip, struct dentry *sdp,
dbf6108b
AS
12 struct inode *tip, struct dentry *tdp,
13 unsigned int flags) { return 0; }
14
15 static const struct inode_operations
16 iops __attribute__ ((unused)) = {
17 .rename2 = rename2_fn,
18 };
19 ],[])
20
e2a82961
CK
21 dnl #
22 dnl # 4.9 API change,
dbf6108b
AS
23 dnl #
24 dnl # iops->rename2() merged into iops->rename(), and iops->rename() now
25 dnl # wants flags.
e2a82961
CK
26 dnl #
27 ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
b8d9e264 28 #include <linux/fs.h>
a41d0b29 29 static int rename_fn(struct inode *sip, struct dentry *sdp,
b8d9e264
CC
30 struct inode *tip, struct dentry *tdp,
31 unsigned int flags) { return 0; }
32
33 static const struct inode_operations
34 iops __attribute__ ((unused)) = {
35 .rename = rename_fn,
36 };
608f8749 37 ],[])
e2a82961 38
dbf6108b
AS
39 dnl #
40 dnl # EL7 compatibility
41 dnl #
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.
44 dnl #
45 ZFS_LINUX_TEST_SRC([dir_inode_operations_wrapper_rename2], [
46 #include <linux/fs.h>
a41d0b29 47 static int rename2_fn(struct inode *sip, struct dentry *sdp,
dbf6108b
AS
48 struct inode *tip, struct dentry *tdp,
49 unsigned int flags) { return 0; }
50
51 static const struct inode_operations_wrapper
52 iops __attribute__ ((unused)) = {
53 .rename2 = rename2_fn,
54 };
55 ],[])
56
e2a82961
CK
57 dnl #
58 dnl # 5.12 API change,
59 dnl #
dbf6108b
AS
60 dnl # Linux 5.12 introduced passing struct user_namespace* as the first
61 dnl # argument of the rename() and other inode_operations members.
e2a82961
CK
62 dnl #
63 ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
64 #include <linux/fs.h>
a41d0b29 65 static int rename_fn(struct user_namespace *user_ns, struct inode *sip,
e2a82961
CK
66 struct dentry *sdp, struct inode *tip, struct dentry *tdp,
67 unsigned int flags) { return 0; }
68
69 static const struct inode_operations
70 iops __attribute__ ((unused)) = {
71 .rename = rename_fn,
72 };
73 ],[])
d4dc53da
YY
74
75 dnl #
76 dnl # 6.3 API change - the first arg is now struct mnt_idmap*
77 dnl #
78 ZFS_LINUX_TEST_SRC([inode_operations_rename_mnt_idmap], [
79 #include <linux/fs.h>
a41d0b29 80 static int rename_fn(struct mnt_idmap *idmap, struct inode *sip,
d4dc53da
YY
81 struct dentry *sdp, struct inode *tip, struct dentry *tdp,
82 unsigned int flags) { return 0; }
83
84 static const struct inode_operations
85 iops __attribute__ ((unused)) = {
86 .rename = rename_fn,
87 };
88 ],[])
608f8749
BB
89])
90
e2a82961 91AC_DEFUN([ZFS_AC_KERNEL_RENAME], [
d4dc53da
YY
92 AC_MSG_CHECKING([whether iops->rename() takes struct mnt_idmap*])
93 ZFS_LINUX_TEST_RESULT([inode_operations_rename_mnt_idmap], [
b8d9e264 94 AC_MSG_RESULT(yes)
d4dc53da
YY
95 AC_DEFINE(HAVE_IOPS_RENAME_IDMAP, 1,
96 [iops->rename() takes struct mnt_idmap*])
b8d9e264 97 ],[
d4dc53da
YY
98 AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*])
99 ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [
e2a82961 100 AC_MSG_RESULT(yes)
d4dc53da
YY
101 AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1,
102 [iops->rename() takes struct user_namespace*])
e2a82961
CK
103 ],[
104 AC_MSG_RESULT(no)
dbf6108b 105
d4dc53da
YY
106 AC_MSG_CHECKING([whether iops->rename2() exists])
107 ZFS_LINUX_TEST_RESULT([inode_operations_rename2], [
dbf6108b 108 AC_MSG_RESULT(yes)
d4dc53da 109 AC_DEFINE(HAVE_RENAME2, 1, [iops->rename2() exists])
dbf6108b
AS
110 ],[
111 AC_MSG_RESULT(no)
112
d4dc53da
YY
113 AC_MSG_CHECKING([whether iops->rename() wants flags])
114 ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
dbf6108b 115 AC_MSG_RESULT(yes)
d4dc53da
YY
116 AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
117 [iops->rename() wants flags])
dbf6108b
AS
118 ],[
119 AC_MSG_RESULT(no)
d4dc53da
YY
120
121 AC_MSG_CHECKING([whether struct inode_operations_wrapper takes .rename2()])
122 ZFS_LINUX_TEST_RESULT([dir_inode_operations_wrapper_rename2], [
123 AC_MSG_RESULT(yes)
124 AC_DEFINE(HAVE_RENAME2_OPERATIONS_WRAPPER, 1,
125 [struct inode_operations_wrapper takes .rename2()])
126 ],[
127 AC_MSG_RESULT(no)
128 ])
dbf6108b
AS
129 ])
130 ])
e2a82961 131 ])
b8d9e264
CC
132 ])
133])