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 105AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ 106 dnl # 107 dnl # 4.7 API change, 108 dnl # The xattr_handler->get() callback was changed to take both 109 dnl # dentry and inode. 110 dnl # 111 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode]) 112 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [ 113 AC_MSG_RESULT(yes) 114 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1, 115 [xattr_handler->get() wants both dentry and inode]) 116 ],[ 117 dnl # 118 dnl # 4.4 API change, 119 dnl # The xattr_handler->get() callback was changed to take a 120 dnl # attr_handler, and handler_flags argument was removed and 121 dnl # should be accessed by handler->flags. 122 dnl # 123 AC_MSG_RESULT(no) 124 AC_MSG_CHECKING( 125 [whether xattr_handler->get() wants xattr_handler]) 126 ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [ 127 AC_MSG_RESULT(yes) 128 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1, 129 [xattr_handler->get() wants xattr_handler]) 130 ],[ 131 dnl # 132 dnl # 2.6.33 API change, 133 dnl # The xattr_handler->get() callback was changed 134 dnl # to take a dentry instead of an inode, and a 135 dnl # handler_flags argument was added. 136 dnl # 137 AC_MSG_RESULT(no) 138 AC_MSG_CHECKING( 139 [whether xattr_handler->get() wants dentry]) 140 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [ 141 AC_MSG_RESULT(yes) 142 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, 143 [xattr_handler->get() wants dentry]) 144 ],[ 145 ZFS_LINUX_TEST_ERROR([xattr get()]) 146 ]) 147 ]) 148 ]) 149]) 150 151dnl # 152dnl # Supported xattr handler set() interfaces checked newest to oldest. 153dnl # 154AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ 155 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ 156 #include <linux/xattr.h> 157 158 int set(const struct xattr_handler *handler, 159 struct dentry *dentry, struct inode *inode, 160 const char *name, const void *buffer, 161 size_t size, int flags) 162 { return 0; } 163 static const struct xattr_handler 164 xops __attribute__ ((unused)) = { 165 .set = set, 166 }; 167 ],[]) 168 169 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [ 170 #include <linux/xattr.h> 171 172 int set(const struct xattr_handler *handler, 173 struct dentry *dentry, const char *name, 174 const void *buffer, size_t size, int flags) 175 { return 0; } 176 static const struct xattr_handler 177 xops __attribute__ ((unused)) = { 178 .set = set, 179 }; 180 ],[]) 181 182 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [ 183 #include <linux/xattr.h> 184 185 int set(struct dentry *dentry, const char *name, 186 const void *buffer, size_t size, int flags, 187 int handler_flags) { return 0; } 188 static const struct xattr_handler 189 xops __attribute__ ((unused)) = { 190 .set = set, 191 }; 192 ],[]) 193]) 194 195AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ 196 dnl # 197 dnl # 4.7 API change, 198 dnl # The xattr_handler->set() callback was changed to take both 199 dnl # dentry and inode. 200 dnl # 201 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) 202 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ 203 AC_MSG_RESULT(yes) 204 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, 205 [xattr_handler->set() wants both dentry and inode]) 206 ],[ 207 dnl # 208 dnl # 4.4 API change, 209 dnl # The xattr_handler->set() callback was changed to take a 210 dnl # xattr_handler, and handler_flags argument was removed and 211 dnl # should be accessed by handler->flags. 212 dnl # 213 AC_MSG_RESULT(no) 214 AC_MSG_CHECKING( 215 [whether xattr_handler->set() wants xattr_handler]) 216 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ 217 AC_MSG_RESULT(yes) 218 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, 219 [xattr_handler->set() wants xattr_handler]) 220 ],[ 221 dnl # 222 dnl # 2.6.33 API change, 223 dnl # The xattr_handler->set() callback was changed 224 dnl # to take a dentry instead of an inode, and a 225 dnl # handler_flags argument was added. 226 dnl # 227 AC_MSG_RESULT(no) 228 AC_MSG_CHECKING( 229 [whether xattr_handler->set() wants dentry]) 230 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ 231 AC_MSG_RESULT(yes) 232 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, 233 [xattr_handler->set() wants dentry]) 234 ],[ 235 ZFS_LINUX_TEST_ERROR([xattr set()]) 236 ]) 237 ]) 238 ]) 239]) 240 241dnl # 242dnl # Supported xattr handler list() interfaces checked newest to oldest. 243dnl # 244AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [ 245 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [ 246 #include <linux/xattr.h> 247 248 bool list(struct dentry *dentry) { return 0; } 249 static const struct xattr_handler 250 xops __attribute__ ((unused)) = { 251 .list = list, 252 }; 253 ],[]) 254 255 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [ 256 #include <linux/xattr.h> 257 258 size_t list(const struct xattr_handler *handler, 259 struct dentry *dentry, char *list, size_t list_size, 260 const char *name, size_t name_len) { return 0; } 261 static const struct xattr_handler 262 xops __attribute__ ((unused)) = { 263 .list = list, 264 }; 265 ],[]) 266 267 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [ 268 #include <linux/xattr.h> 269 270 size_t list(struct dentry *dentry, 271 char *list, size_t list_size, 272 const char *name, size_t name_len, 273 int handler_flags) { return 0; } 274 static const struct xattr_handler 275 xops __attribute__ ((unused)) = { 276 .list = list, 277 }; 278 ],[]) 279]) 280 281AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ 282 dnl # 4.5 API change, 283 dnl # The xattr_handler->list() callback was changed to take only a 284 dnl # dentry and it only needs to return if it's accessible. 285 AC_MSG_CHECKING([whether xattr_handler->list() wants simple]) 286 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [ 287 AC_MSG_RESULT(yes) 288 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1, 289 [xattr_handler->list() wants simple]) 290 ],[ 291 dnl # 292 dnl # 4.4 API change, 293 dnl # The xattr_handler->list() callback was changed to take a 294 dnl # xattr_handler, and handler_flags argument was removed 295 dnl # and should be accessed by handler->flags. 296 dnl # 297 AC_MSG_RESULT(no) 298 AC_MSG_CHECKING( 299 [whether xattr_handler->list() wants xattr_handler]) 300 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [ 301 AC_MSG_RESULT(yes) 302 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1, 303 [xattr_handler->list() wants xattr_handler]) 304 ],[ 305 dnl # 306 dnl # 2.6.33 API change, 307 dnl # The xattr_handler->list() callback was changed 308 dnl # to take a dentry instead of an inode, and a 309 dnl # handler_flags argument was added. 310 dnl # 311 AC_MSG_RESULT(no) 312 AC_MSG_CHECKING( 313 [whether xattr_handler->list() wants dentry]) 314 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [ 315 AC_MSG_RESULT(yes) 316 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, 317 [xattr_handler->list() wants dentry]) 318 ],[ 319 ZFS_LINUX_TEST_ERROR([xattr list()]) 320 ]) 321 ]) 322 ]) 323]) 324 325dnl # 326dnl # 3.7 API change, 327dnl # The posix_acl_{from,to}_xattr functions gained a new 328dnl # parameter: user_ns 329dnl # 330AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [ 331 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [ 332 #include <linux/cred.h> 333 #include <linux/fs.h> 334 #include <linux/posix_acl_xattr.h> 335 ],[ 336 posix_acl_from_xattr(&init_user_ns, NULL, 0); 337 ]) 338]) 339 340AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ 341 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns]) 342 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [ 343 AC_MSG_RESULT(yes) 344 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, 345 [posix_acl_from_xattr() needs user_ns]) 346 ],[ 347 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()]) 348 ]) 349]) 350 351dnl # 352dnl # 4.9 API change, 353dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are 354dnl # removed. xattr operations will directly go through sb->s_xattr. 355dnl # 356AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [ 357 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [ 358 #include <linux/fs.h> 359 #include <linux/xattr.h> 360 361 static const struct inode_operations 362 iops __attribute__ ((unused)) = { 363 .setxattr = generic_setxattr 364 }; 365 ],[]) 366]) 367 368AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [ 369 AC_MSG_CHECKING([whether generic_setxattr() exists]) 370 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [ 371 AC_MSG_RESULT(yes) 372 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1, 373 [generic_setxattr() exists]) 374 ],[ 375 AC_MSG_RESULT(no) 376 ]) 377]) 378 379AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [ 380 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER 381 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME 382 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET 383 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET 384 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST 385 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS 386 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR 387]) 388 389AC_DEFUN([ZFS_AC_KERNEL_XATTR], [ 390 ZFS_AC_KERNEL_CONST_XATTR_HANDLER 391 ZFS_AC_KERNEL_XATTR_HANDLER_NAME 392 ZFS_AC_KERNEL_XATTR_HANDLER_GET 393 ZFS_AC_KERNEL_XATTR_HANDLER_SET 394 ZFS_AC_KERNEL_XATTR_HANDLER_LIST 395 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS 396 ZFS_AC_KERNEL_GENERIC_SETXATTR 397]) 398