1dnl # 2dnl # 2.6.35 API change, 3dnl # The 'struct xattr_handler' was constified in the generic 4dnl # super_block structure. 5dnl # 6AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER], [ 7 ZFS_LINUX_TEST_SRC([const_xattr_handler], [ 8 #include <linux/fs.h> 9 #include <linux/xattr.h> 10 11 const struct xattr_handler xattr_test_handler = { 12 .prefix = "test", 13 .get = NULL, 14 .set = NULL, 15 }; 16 17 const struct xattr_handler *xattr_handlers[] = { 18 &xattr_test_handler, 19 }; 20 21 const struct super_block sb __attribute__ ((unused)) = { 22 .s_xattr = xattr_handlers, 23 }; 24 ],[]) 25]) 26 27AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [ 28 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler]) 29 ZFS_LINUX_TEST_RESULT([const_xattr_handler], [ 30 AC_MSG_RESULT([yes]) 31 ],[ 32 ZFS_LINUX_TEST_ERROR([const xattr_handler]) 33 ]) 34]) 35 36dnl # 37dnl # 4.5 API change, 38dnl # struct xattr_handler added new member "name". 39dnl # xattr_handler which matches to whole name rather than prefix should use 40dnl # "name" instead of "prefix", e.g. "system.posix_acl_access" 41dnl # 42AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME], [ 43 ZFS_LINUX_TEST_SRC([xattr_handler_name], [ 44 #include <linux/xattr.h> 45 46 static const struct xattr_handler 47 xops __attribute__ ((unused)) = { 48 .name = XATTR_NAME_POSIX_ACL_ACCESS, 49 }; 50 ],[]) 51]) 52 53AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [ 54 AC_MSG_CHECKING([whether xattr_handler has name]) 55 ZFS_LINUX_TEST_RESULT([xattr_handler_name], [ 56 AC_MSG_RESULT(yes) 57 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, 58 [xattr_handler has name]) 59 ],[ 60 AC_MSG_RESULT(no) 61 ]) 62]) 63 64dnl # 65dnl # Supported xattr handler get() interfaces checked newest to oldest. 66dnl # 67AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [ 68 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode], [ 69 #include <linux/xattr.h> 70 71 int get(const struct xattr_handler *handler, 72 struct dentry *dentry, struct inode *inode, 73 const char *name, void *buffer, size_t size) { return 0; } 74 static const struct xattr_handler 75 xops __attribute__ ((unused)) = { 76 .get = get, 77 }; 78 ],[]) 79 80 ZFS_LINUX_TEST_SRC([xattr_handler_get_xattr_handler], [ 81 #include <linux/xattr.h> 82 83 int get(const struct xattr_handler *handler, 84 struct dentry *dentry, const char *name, 85 void *buffer, size_t size) { return 0; } 86 static const struct xattr_handler 87 xops __attribute__ ((unused)) = { 88 .get = get, 89 }; 90 ],[]) 91 92 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [ 93 #include <linux/xattr.h> 94 95 int get(struct dentry *dentry, const char *name, 96 void *buffer, size_t size, int handler_flags) 97 { return 0; } 98 static const struct xattr_handler 99 xops __attribute__ ((unused)) = { 100 .get = get, 101 }; 102 ],[]) 103 104 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [ 105 #include <linux/xattr.h> 106 107 int get(const struct xattr_handler *handler, 108 struct dentry *dentry, struct inode *inode, 109 const char *name, void *buffer, 110 size_t size, int flags) { return 0; } 111 static const struct xattr_handler 112 xops __attribute__ ((unused)) = { 113 .get = get, 114 }; 115 ],[]) 116]) 117 118AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ 119 dnl # 120 dnl # 4.7 API change, 121 dnl # The xattr_handler->get() callback was changed to take both 122 dnl # dentry and inode. 123 dnl # 124 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode]) 125 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [ 126 AC_MSG_RESULT(yes) 127 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1, 128 [xattr_handler->get() wants both dentry and inode]) 129 ],[ 130 dnl # 131 dnl # 4.4 API change, 132 dnl # The xattr_handler->get() callback was changed to take a 133 dnl # attr_handler, and handler_flags argument was removed and 134 dnl # should be accessed by handler->flags. 135 dnl # 136 AC_MSG_RESULT(no) 137 AC_MSG_CHECKING( 138 [whether xattr_handler->get() wants xattr_handler]) 139 ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [ 140 AC_MSG_RESULT(yes) 141 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1, 142 [xattr_handler->get() wants xattr_handler]) 143 ],[ 144 dnl # 145 dnl # 2.6.33 API change, 146 dnl # The xattr_handler->get() callback was changed 147 dnl # to take a dentry instead of an inode, and a 148 dnl # handler_flags argument was added. 149 dnl # 150 AC_MSG_RESULT(no) 151 AC_MSG_CHECKING( 152 [whether xattr_handler->get() wants dentry]) 153 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [ 154 AC_MSG_RESULT(yes) 155 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, 156 [xattr_handler->get() wants dentry]) 157 ],[ 158 dnl # 159 dnl # Android API change, 160 dnl # The xattr_handler->get() callback was 161 dnl # changed to take dentry, inode and flags. 162 dnl # 163 AC_MSG_RESULT(no) 164 AC_MSG_CHECKING( 165 [whether xattr_handler->get() wants dentry and inode and flags]) 166 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode_flags], [ 167 AC_MSG_RESULT(yes) 168 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE_FLAGS, 1, 169 [xattr_handler->get() wants dentry and inode and flags]) 170 ],[ 171 ZFS_LINUX_TEST_ERROR([xattr get()]) 172 ]) 173 ]) 174 ]) 175 ]) 176]) 177 178dnl # 179dnl # Supported xattr handler set() interfaces checked newest to oldest. 180dnl # 181AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ 182 ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [ 183 #include <linux/xattr.h> 184 185 int set(const struct xattr_handler *handler, 186 struct user_namespace *mnt_userns, 187 struct dentry *dentry, struct inode *inode, 188 const char *name, const void *buffer, 189 size_t size, int flags) 190 { return 0; } 191 static const struct xattr_handler 192 xops __attribute__ ((unused)) = { 193 .set = set, 194 }; 195 ],[]) 196 197 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ 198 #include <linux/xattr.h> 199 200 int set(const struct xattr_handler *handler, 201 struct dentry *dentry, struct inode *inode, 202 const char *name, const void *buffer, 203 size_t size, int flags) 204 { return 0; } 205 static const struct xattr_handler 206 xops __attribute__ ((unused)) = { 207 .set = set, 208 }; 209 ],[]) 210 211 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [ 212 #include <linux/xattr.h> 213 214 int set(const struct xattr_handler *handler, 215 struct dentry *dentry, const char *name, 216 const void *buffer, size_t size, int flags) 217 { return 0; } 218 static const struct xattr_handler 219 xops __attribute__ ((unused)) = { 220 .set = set, 221 }; 222 ],[]) 223 224 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [ 225 #include <linux/xattr.h> 226 227 int set(struct dentry *dentry, const char *name, 228 const void *buffer, size_t size, int flags, 229 int handler_flags) { return 0; } 230 static const struct xattr_handler 231 xops __attribute__ ((unused)) = { 232 .set = set, 233 }; 234 ],[]) 235]) 236 237AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ 238 dnl # 239 dnl # 5.12 API change, 240 dnl # The xattr_handler->set() callback was changed to 8 arguments, and 241 dnl # struct user_namespace* was inserted as arg #2 242 dnl # 243 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace]) 244 ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [ 245 AC_MSG_RESULT(yes) 246 AC_DEFINE(HAVE_XATTR_SET_USERNS, 1, 247 [xattr_handler->set() takes user_namespace]) 248 ],[ 249 dnl # 250 dnl # 4.7 API change, 251 dnl # The xattr_handler->set() callback was changed to take both 252 dnl # dentry and inode. 253 dnl # 254 AC_MSG_RESULT(no) 255 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) 256 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ 257 AC_MSG_RESULT(yes) 258 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, 259 [xattr_handler->set() wants both dentry and inode]) 260 ],[ 261 dnl # 262 dnl # 4.4 API change, 263 dnl # The xattr_handler->set() callback was changed to take a 264 dnl # xattr_handler, and handler_flags argument was removed and 265 dnl # should be accessed by handler->flags. 266 dnl # 267 AC_MSG_RESULT(no) 268 AC_MSG_CHECKING( 269 [whether xattr_handler->set() wants xattr_handler]) 270 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ 271 AC_MSG_RESULT(yes) 272 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, 273 [xattr_handler->set() wants xattr_handler]) 274 ],[ 275 dnl # 276 dnl # 2.6.33 API change, 277 dnl # The xattr_handler->set() callback was changed 278 dnl # to take a dentry instead of an inode, and a 279 dnl # handler_flags argument was added. 280 dnl # 281 AC_MSG_RESULT(no) 282 AC_MSG_CHECKING( 283 [whether xattr_handler->set() wants dentry]) 284 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ 285 AC_MSG_RESULT(yes) 286 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, 287 [xattr_handler->set() wants dentry]) 288 ],[ 289 ZFS_LINUX_TEST_ERROR([xattr set()]) 290 ]) 291 ]) 292 ]) 293 ]) 294]) 295 296dnl # 297dnl # Supported xattr handler list() interfaces checked newest to oldest. 298dnl # 299AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [ 300 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [ 301 #include <linux/xattr.h> 302 303 bool list(struct dentry *dentry) { return 0; } 304 static const struct xattr_handler 305 xops __attribute__ ((unused)) = { 306 .list = list, 307 }; 308 ],[]) 309 310 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [ 311 #include <linux/xattr.h> 312 313 size_t list(const struct xattr_handler *handler, 314 struct dentry *dentry, char *list, size_t list_size, 315 const char *name, size_t name_len) { return 0; } 316 static const struct xattr_handler 317 xops __attribute__ ((unused)) = { 318 .list = list, 319 }; 320 ],[]) 321 322 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [ 323 #include <linux/xattr.h> 324 325 size_t list(struct dentry *dentry, 326 char *list, size_t list_size, 327 const char *name, size_t name_len, 328 int handler_flags) { return 0; } 329 static const struct xattr_handler 330 xops __attribute__ ((unused)) = { 331 .list = list, 332 }; 333 ],[]) 334]) 335 336AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ 337 dnl # 4.5 API change, 338 dnl # The xattr_handler->list() callback was changed to take only a 339 dnl # dentry and it only needs to return if it's accessible. 340 AC_MSG_CHECKING([whether xattr_handler->list() wants simple]) 341 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [ 342 AC_MSG_RESULT(yes) 343 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1, 344 [xattr_handler->list() wants simple]) 345 ],[ 346 dnl # 347 dnl # 4.4 API change, 348 dnl # The xattr_handler->list() callback was changed to take a 349 dnl # xattr_handler, and handler_flags argument was removed 350 dnl # and should be accessed by handler->flags. 351 dnl # 352 AC_MSG_RESULT(no) 353 AC_MSG_CHECKING( 354 [whether xattr_handler->list() wants xattr_handler]) 355 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [ 356 AC_MSG_RESULT(yes) 357 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1, 358 [xattr_handler->list() wants xattr_handler]) 359 ],[ 360 dnl # 361 dnl # 2.6.33 API change, 362 dnl # The xattr_handler->list() callback was changed 363 dnl # to take a dentry instead of an inode, and a 364 dnl # handler_flags argument was added. 365 dnl # 366 AC_MSG_RESULT(no) 367 AC_MSG_CHECKING( 368 [whether xattr_handler->list() wants dentry]) 369 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [ 370 AC_MSG_RESULT(yes) 371 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, 372 [xattr_handler->list() wants dentry]) 373 ],[ 374 ZFS_LINUX_TEST_ERROR([xattr list()]) 375 ]) 376 ]) 377 ]) 378]) 379 380dnl # 381dnl # 3.7 API change, 382dnl # The posix_acl_{from,to}_xattr functions gained a new 383dnl # parameter: user_ns 384dnl # 385AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [ 386 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [ 387 #include <linux/cred.h> 388 #include <linux/fs.h> 389 #include <linux/posix_acl_xattr.h> 390 ],[ 391 posix_acl_from_xattr(&init_user_ns, NULL, 0); 392 ]) 393]) 394 395AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ 396 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns]) 397 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [ 398 AC_MSG_RESULT(yes) 399 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, 400 [posix_acl_from_xattr() needs user_ns]) 401 ],[ 402 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()]) 403 ]) 404]) 405 406dnl # 407dnl # 4.9 API change, 408dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are 409dnl # removed. xattr operations will directly go through sb->s_xattr. 410dnl # 411AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [ 412 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [ 413 #include <linux/fs.h> 414 #include <linux/xattr.h> 415 416 static const struct inode_operations 417 iops __attribute__ ((unused)) = { 418 .setxattr = generic_setxattr 419 }; 420 ],[]) 421]) 422 423AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [ 424 AC_MSG_CHECKING([whether generic_setxattr() exists]) 425 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [ 426 AC_MSG_RESULT(yes) 427 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1, 428 [generic_setxattr() exists]) 429 ],[ 430 AC_MSG_RESULT(no) 431 ]) 432]) 433 434AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [ 435 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER 436 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME 437 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET 438 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET 439 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST 440 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS 441 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR 442]) 443 444AC_DEFUN([ZFS_AC_KERNEL_XATTR], [ 445 ZFS_AC_KERNEL_CONST_XATTR_HANDLER 446 ZFS_AC_KERNEL_XATTR_HANDLER_NAME 447 ZFS_AC_KERNEL_XATTR_HANDLER_GET 448 ZFS_AC_KERNEL_XATTR_HANDLER_SET 449 ZFS_AC_KERNEL_XATTR_HANDLER_LIST 450 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS 451 ZFS_AC_KERNEL_GENERIC_SETXATTR 452]) 453