1AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [ 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> 11 int rename2_fn(struct inode *sip, struct dentry *sdp, 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 21 dnl # 22 dnl # 4.9 API change, 23 dnl # 24 dnl # iops->rename2() merged into iops->rename(), and iops->rename() now 25 dnl # wants flags. 26 dnl # 27 ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [ 28 #include <linux/fs.h> 29 int rename_fn(struct inode *sip, struct dentry *sdp, 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 }; 37 ],[]) 38 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> 47 int rename2_fn(struct inode *sip, struct dentry *sdp, 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 57 dnl # 58 dnl # 5.12 API change, 59 dnl # 60 dnl # Linux 5.12 introduced passing struct user_namespace* as the first 61 dnl # argument of the rename() and other inode_operations members. 62 dnl # 63 ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [ 64 #include <linux/fs.h> 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; } 68 69 static const struct inode_operations 70 iops __attribute__ ((unused)) = { 71 .rename = rename_fn, 72 }; 73 ],[]) 74]) 75 76AC_DEFUN([ZFS_AC_KERNEL_RENAME], [ 77 AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*]) 78 ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [ 79 AC_MSG_RESULT(yes) 80 AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1, 81 [iops->rename() takes struct user_namespace*]) 82 ],[ 83 AC_MSG_RESULT(no) 84 85 AC_MSG_CHECKING([whether iops->rename2() exists]) 86 ZFS_LINUX_TEST_RESULT([inode_operations_rename2], [ 87 AC_MSG_RESULT(yes) 88 AC_DEFINE(HAVE_RENAME2, 1, [iops->rename2() exists]) 89 ],[ 90 AC_MSG_RESULT(no) 91 92 AC_MSG_CHECKING([whether iops->rename() wants flags]) 93 ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [ 94 AC_MSG_RESULT(yes) 95 AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, 96 [iops->rename() wants flags]) 97 ],[ 98 AC_MSG_RESULT(no) 99 100 AC_MSG_CHECKING([whether struct inode_operations_wrapper takes .rename2()]) 101 ZFS_LINUX_TEST_RESULT([dir_inode_operations_wrapper_rename2], [ 102 AC_MSG_RESULT(yes) 103 AC_DEFINE(HAVE_RENAME2_OPERATIONS_WRAPPER, 1, 104 [struct inode_operations_wrapper takes .rename2()]) 105 ],[ 106 AC_MSG_RESULT(no) 107 ]) 108 ]) 109 ]) 110 ]) 111]) 112