1dnl # 2dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED 3dnl # module. The is_owner_or_cap macro was replaced by 4dnl # inode_owner_or_capable 5dnl # 6AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [ 7 ZFS_LINUX_TEST_SRC([posix_acl_release], [ 8 #include <linux/cred.h> 9 #include <linux/fs.h> 10 #include <linux/posix_acl.h> 11 ], [ 12 struct posix_acl *tmp = posix_acl_alloc(1, 0); 13 posix_acl_release(tmp); 14 ], [], [ZFS_META_LICENSE]) 15]) 16 17AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [ 18 AC_MSG_CHECKING([whether posix_acl_release() is available]) 19 ZFS_LINUX_TEST_RESULT([posix_acl_release], [ 20 AC_MSG_RESULT(yes) 21 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1, 22 [posix_acl_release() is available]) 23 24 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only]) 25 ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [ 26 AC_MSG_RESULT(no) 27 ],[ 28 AC_MSG_RESULT(yes) 29 AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1, 30 [posix_acl_release() is GPL-only]) 31 ]) 32 ],[ 33 AC_MSG_RESULT(no) 34 ]) 35]) 36 37dnl # 38dnl # 3.14 API change, 39dnl # set_cached_acl() and forget_cached_acl() changed from inline to 40dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of 41dnl # posix_acl_release. In the latter case, we can always use them. 42dnl # 43AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [ 44 ZFS_LINUX_TEST_SRC([set_cached_acl], [ 45 #include <linux/cred.h> 46 #include <linux/fs.h> 47 #include <linux/posix_acl.h> 48 ], [ 49 struct inode *ip = NULL; 50 struct posix_acl *acl = posix_acl_alloc(1, 0); 51 set_cached_acl(ip, ACL_TYPE_ACCESS, acl); 52 forget_cached_acl(ip, ACL_TYPE_ACCESS); 53 ], [], [ZFS_META_LICENSE]) 54]) 55 56AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [ 57 AC_MSG_CHECKING([whether set_cached_acl() is usable]) 58 ZFS_LINUX_TEST_RESULT([set_cached_acl_license], [ 59 AC_MSG_RESULT(yes) 60 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1, 61 [set_cached_acl() is usable]) 62 ],[ 63 AC_MSG_RESULT(no) 64 ]) 65]) 66 67dnl # 68dnl # 3.1 API change, 69dnl # posix_acl_chmod() was added as the preferred interface. 70dnl # 71dnl # 3.14 API change, 72dnl # posix_acl_chmod() was changed to __posix_acl_chmod() 73dnl # 74AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [ 75 ZFS_LINUX_TEST_SRC([posix_acl_chmod], [ 76 #include <linux/fs.h> 77 #include <linux/posix_acl.h> 78 ],[ 79 posix_acl_chmod(NULL, 0, 0) 80 ]) 81 82 ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [ 83 #include <linux/fs.h> 84 #include <linux/posix_acl.h> 85 ],[ 86 __posix_acl_chmod(NULL, 0, 0) 87 ]) 88]) 89 90AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [ 91 AC_MSG_CHECKING([whether __posix_acl_chmod exists]) 92 ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [ 93 AC_MSG_RESULT(yes) 94 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, 95 [__posix_acl_chmod() exists]) 96 ],[ 97 AC_MSG_RESULT(no) 98 99 AC_MSG_CHECKING([whether posix_acl_chmod exists]) 100 ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [ 101 AC_MSG_RESULT(yes) 102 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, 103 [posix_acl_chmod() exists]) 104 ],[ 105 ZFS_LINUX_TEST_ERROR([posix_acl_chmod()]) 106 ]) 107 ]) 108]) 109 110dnl # 111dnl # 3.1 API change, 112dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t 113dnl # 114AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ 115 ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [ 116 #include <linux/fs.h> 117 #include <linux/posix_acl.h> 118 ],[ 119 umode_t tmp; 120 posix_acl_equiv_mode(NULL, &tmp); 121 ]) 122]) 123 124AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ 125 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t]) 126 ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [ 127 AC_MSG_RESULT(yes) 128 ],[ 129 ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()]) 130 ]) 131]) 132 133dnl # 134dnl # 4.8 API change, 135dnl # The function posix_acl_valid now must be passed a namespace. 136dnl # 137AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [ 138 ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [ 139 #include <linux/fs.h> 140 #include <linux/posix_acl.h> 141 ],[ 142 struct user_namespace *user_ns = NULL; 143 const struct posix_acl *acl = NULL; 144 int error; 145 146 error = posix_acl_valid(user_ns, acl); 147 ]) 148]) 149 150AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [ 151 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace]) 152 ZFS_LINUX_TEST_RESULT([posix_acl_valid_with_ns], [ 153 AC_MSG_RESULT(yes) 154 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1, 155 [posix_acl_valid() wants user namespace]) 156 ],[ 157 AC_MSG_RESULT(no) 158 ]) 159]) 160 161dnl # 162dnl # 3.1 API change, 163dnl # Check if inode_operations contains the function get_acl 164dnl # 165AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [ 166 ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [ 167 #include <linux/fs.h> 168 169 struct posix_acl *get_acl_fn(struct inode *inode, int type) 170 { return NULL; } 171 172 static const struct inode_operations 173 iops __attribute__ ((unused)) = { 174 .get_acl = get_acl_fn, 175 }; 176 ],[]) 177]) 178 179AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [ 180 AC_MSG_CHECKING([whether iops->get_acl() exists]) 181 ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [ 182 AC_MSG_RESULT(yes) 183 ],[ 184 ZFS_LINUX_TEST_ERROR([iops->get_acl()]) 185 ]) 186]) 187 188dnl # 189dnl # 3.14 API change, 190dnl # Check if inode_operations contains the function set_acl 191dnl # 192dnl # 5.12 API change, 193dnl # set_acl() added a user_namespace* parameter first 194dnl # 195AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [ 196 ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [ 197 #include <linux/fs.h> 198 199 int set_acl_fn(struct user_namespace *userns, 200 struct inode *inode, struct posix_acl *acl, 201 int type) { return 0; } 202 203 static const struct inode_operations 204 iops __attribute__ ((unused)) = { 205 .set_acl = set_acl_fn, 206 }; 207 ],[]) 208 ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [ 209 #include <linux/fs.h> 210 211 int set_acl_fn(struct inode *inode, struct posix_acl *acl, 212 int type) { return 0; } 213 214 static const struct inode_operations 215 iops __attribute__ ((unused)) = { 216 .set_acl = set_acl_fn, 217 }; 218 ],[]) 219]) 220 221AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [ 222 AC_MSG_CHECKING([whether iops->set_acl() exists]) 223 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [ 224 AC_MSG_RESULT(yes) 225 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists]) 226 AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args]) 227 ],[ 228 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [ 229 AC_MSG_RESULT(yes) 230 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args]) 231 ],[ 232 AC_MSG_RESULT(no) 233 ]) 234 ]) 235]) 236 237dnl # 238dnl # 4.7 API change, 239dnl # The kernel get_acl will now check cache before calling i_op->get_acl and 240dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that 241dnl # anymore. 242dnl # 243AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [ 244 ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [ 245 #include <linux/fs.h> 246 ],[ 247 void *sentinel __attribute__ ((unused)) = 248 uncached_acl_sentinel(NULL); 249 ]) 250]) 251 252AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [ 253 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists]) 254 ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [ 255 AC_MSG_RESULT(yes) 256 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, 257 [uncached_acl_sentinel() exists]) 258 ],[ 259 AC_MSG_RESULT(no) 260 ]) 261]) 262 263dnl # 264dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t. 265dnl # It's an atomic_t on older kernels. 266dnl # 267AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [ 268 ZFS_LINUX_TEST_SRC([acl_refcount], [ 269 #include <linux/backing-dev.h> 270 #include <linux/refcount.h> 271 #include <linux/posix_acl.h> 272 ],[ 273 struct posix_acl acl; 274 refcount_t *r __attribute__ ((unused)) = &acl.a_refcount; 275 ]) 276]) 277 278AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [ 279 AC_MSG_CHECKING([whether posix_acl has refcount_t]) 280 ZFS_LINUX_TEST_RESULT([acl_refcount], [ 281 AC_MSG_RESULT(yes) 282 AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t]) 283 ],[ 284 AC_MSG_RESULT(no) 285 ]) 286]) 287 288AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [ 289 ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE 290 ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE 291 ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD 292 ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T 293 ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS 294 ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL 295 ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL 296 ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE 297 ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT 298]) 299 300AC_DEFUN([ZFS_AC_KERNEL_ACL], [ 301 ZFS_AC_KERNEL_POSIX_ACL_RELEASE 302 ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE 303 ZFS_AC_KERNEL_POSIX_ACL_CHMOD 304 ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T 305 ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS 306 ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL 307 ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL 308 ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE 309 ZFS_AC_KERNEL_ACL_HAS_REFCOUNT 310]) 311