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 static 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 static 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 static 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 static 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_mnt_idmap], [ 183 #include <linux/xattr.h> 184 185 static int set(const struct xattr_handler *handler, 186 struct mnt_idmap *idmap, 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_userns], [ 198 #include <linux/xattr.h> 199 200 static int set(const struct xattr_handler *handler, 201 struct user_namespace *mnt_userns, 202 struct dentry *dentry, struct inode *inode, 203 const char *name, const void *buffer, 204 size_t size, int flags) 205 { return 0; } 206 static const struct xattr_handler 207 xops __attribute__ ((unused)) = { 208 .set = set, 209 }; 210 ],[]) 211 212 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ 213 #include <linux/xattr.h> 214 215 static int set(const struct xattr_handler *handler, 216 struct dentry *dentry, struct inode *inode, 217 const char *name, const void *buffer, 218 size_t size, int flags) 219 { return 0; } 220 static const struct xattr_handler 221 xops __attribute__ ((unused)) = { 222 .set = set, 223 }; 224 ],[]) 225 226 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [ 227 #include <linux/xattr.h> 228 229 static int set(const struct xattr_handler *handler, 230 struct dentry *dentry, const char *name, 231 const void *buffer, size_t size, int flags) 232 { return 0; } 233 static const struct xattr_handler 234 xops __attribute__ ((unused)) = { 235 .set = set, 236 }; 237 ],[]) 238 239 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [ 240 #include <linux/xattr.h> 241 242 static int set(struct dentry *dentry, const char *name, 243 const void *buffer, size_t size, int flags, 244 int handler_flags) { return 0; } 245 static const struct xattr_handler 246 xops __attribute__ ((unused)) = { 247 .set = set, 248 }; 249 ],[]) 250]) 251 252AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ 253 dnl # 254 dnl # 5.12 API change, 255 dnl # The xattr_handler->set() callback was changed to 8 arguments, and 256 dnl # struct user_namespace* was inserted as arg #2 257 dnl # 258 dnl # 6.3 API change, 259 dnl # The xattr_handler->set() callback 2nd arg is now struct mnt_idmap * 260 dnl # 261 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and mnt_idmap]) 262 ZFS_LINUX_TEST_RESULT([xattr_handler_set_mnt_idmap], [ 263 AC_MSG_RESULT(yes) 264 AC_DEFINE(HAVE_XATTR_SET_IDMAP, 1, 265 [xattr_handler->set() takes mnt_idmap]) 266 ], [ 267 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace]) 268 ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [ 269 AC_MSG_RESULT(yes) 270 AC_DEFINE(HAVE_XATTR_SET_USERNS, 1, 271 [xattr_handler->set() takes user_namespace]) 272 ],[ 273 dnl # 274 dnl # 4.7 API change, 275 dnl # The xattr_handler->set() callback was changed to take both 276 dnl # dentry and inode. 277 dnl # 278 AC_MSG_RESULT(no) 279 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) 280 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ 281 AC_MSG_RESULT(yes) 282 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, 283 [xattr_handler->set() wants both dentry and inode]) 284 ],[ 285 dnl # 286 dnl # 4.4 API change, 287 dnl # The xattr_handler->set() callback was changed to take a 288 dnl # xattr_handler, and handler_flags argument was removed and 289 dnl # should be accessed by handler->flags. 290 dnl # 291 AC_MSG_RESULT(no) 292 AC_MSG_CHECKING( 293 [whether xattr_handler->set() wants xattr_handler]) 294 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ 295 AC_MSG_RESULT(yes) 296 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, 297 [xattr_handler->set() wants xattr_handler]) 298 ],[ 299 dnl # 300 dnl # 2.6.33 API change, 301 dnl # The xattr_handler->set() callback was changed 302 dnl # to take a dentry instead of an inode, and a 303 dnl # handler_flags argument was added. 304 dnl # 305 AC_MSG_RESULT(no) 306 AC_MSG_CHECKING( 307 [whether xattr_handler->set() wants dentry]) 308 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ 309 AC_MSG_RESULT(yes) 310 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, 311 [xattr_handler->set() wants dentry]) 312 ],[ 313 ZFS_LINUX_TEST_ERROR([xattr set()]) 314 ]) 315 ]) 316 ]) 317 ]) 318 ]) 319]) 320 321dnl # 322dnl # Supported xattr handler list() interfaces checked newest to oldest. 323dnl # 324AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [ 325 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [ 326 #include <linux/xattr.h> 327 328 static bool list(struct dentry *dentry) { return 0; } 329 static const struct xattr_handler 330 xops __attribute__ ((unused)) = { 331 .list = list, 332 }; 333 ],[]) 334 335 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [ 336 #include <linux/xattr.h> 337 338 static size_t list(const struct xattr_handler *handler, 339 struct dentry *dentry, char *list, size_t list_size, 340 const char *name, size_t name_len) { return 0; } 341 static const struct xattr_handler 342 xops __attribute__ ((unused)) = { 343 .list = list, 344 }; 345 ],[]) 346 347 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [ 348 #include <linux/xattr.h> 349 350 static size_t list(struct dentry *dentry, 351 char *list, size_t list_size, 352 const char *name, size_t name_len, 353 int handler_flags) { return 0; } 354 static const struct xattr_handler 355 xops __attribute__ ((unused)) = { 356 .list = list, 357 }; 358 ],[]) 359]) 360 361AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ 362 dnl # 4.5 API change, 363 dnl # The xattr_handler->list() callback was changed to take only a 364 dnl # dentry and it only needs to return if it's accessible. 365 AC_MSG_CHECKING([whether xattr_handler->list() wants simple]) 366 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [ 367 AC_MSG_RESULT(yes) 368 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1, 369 [xattr_handler->list() wants simple]) 370 ],[ 371 dnl # 372 dnl # 4.4 API change, 373 dnl # The xattr_handler->list() callback was changed to take a 374 dnl # xattr_handler, and handler_flags argument was removed 375 dnl # and should be accessed by handler->flags. 376 dnl # 377 AC_MSG_RESULT(no) 378 AC_MSG_CHECKING( 379 [whether xattr_handler->list() wants xattr_handler]) 380 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [ 381 AC_MSG_RESULT(yes) 382 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1, 383 [xattr_handler->list() wants xattr_handler]) 384 ],[ 385 dnl # 386 dnl # 2.6.33 API change, 387 dnl # The xattr_handler->list() callback was changed 388 dnl # to take a dentry instead of an inode, and a 389 dnl # handler_flags argument was added. 390 dnl # 391 AC_MSG_RESULT(no) 392 AC_MSG_CHECKING( 393 [whether xattr_handler->list() wants dentry]) 394 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [ 395 AC_MSG_RESULT(yes) 396 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, 397 [xattr_handler->list() wants dentry]) 398 ],[ 399 ZFS_LINUX_TEST_ERROR([xattr list()]) 400 ]) 401 ]) 402 ]) 403]) 404 405dnl # 406dnl # 3.7 API change, 407dnl # The posix_acl_{from,to}_xattr functions gained a new 408dnl # parameter: user_ns 409dnl # 410AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [ 411 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [ 412 #include <linux/cred.h> 413 #include <linux/fs.h> 414 #include <linux/posix_acl_xattr.h> 415 ],[ 416 posix_acl_from_xattr(&init_user_ns, NULL, 0); 417 ]) 418]) 419 420AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ 421 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns]) 422 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [ 423 AC_MSG_RESULT(yes) 424 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, 425 [posix_acl_from_xattr() needs user_ns]) 426 ],[ 427 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()]) 428 ]) 429]) 430 431dnl # 432dnl # 4.9 API change, 433dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are 434dnl # removed. xattr operations will directly go through sb->s_xattr. 435dnl # 436AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [ 437 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [ 438 #include <linux/fs.h> 439 #include <linux/xattr.h> 440 441 static const struct inode_operations 442 iops __attribute__ ((unused)) = { 443 .setxattr = generic_setxattr 444 }; 445 ],[]) 446]) 447 448AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [ 449 AC_MSG_CHECKING([whether generic_setxattr() exists]) 450 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [ 451 AC_MSG_RESULT(yes) 452 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1, 453 [generic_setxattr() exists]) 454 ],[ 455 AC_MSG_RESULT(no) 456 ]) 457]) 458 459AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [ 460 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER 461 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME 462 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET 463 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET 464 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST 465 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS 466 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR 467]) 468 469AC_DEFUN([ZFS_AC_KERNEL_XATTR], [ 470 ZFS_AC_KERNEL_CONST_XATTR_HANDLER 471 ZFS_AC_KERNEL_XATTR_HANDLER_NAME 472 ZFS_AC_KERNEL_XATTR_HANDLER_GET 473 ZFS_AC_KERNEL_XATTR_HANDLER_SET 474 ZFS_AC_KERNEL_XATTR_HANDLER_LIST 475 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS 476 ZFS_AC_KERNEL_GENERIC_SETXATTR 477]) 478