]> git.proxmox.com Git - mirror_zfs.git/blobdiff - config/kernel-xattr-handler.m4
Stop runtime pointer modifications in autotools checks
[mirror_zfs.git] / config / kernel-xattr-handler.m4
index 325c960df6e476010cef315ad28651e36b5e0cd4..943f9033c34a4225033ae0d94a14bcb4f356881a 100644 (file)
@@ -18,10 +18,11 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER],
                const struct xattr_handler *xattr_handlers[] = {
                        &xattr_test_handler,
                };
-       ],[
-               struct super_block sb __attribute__ ((unused));
 
-               sb.s_xattr = xattr_handlers;
+               const struct super_block sb __attribute__ ((unused)) = {
+                       .s_xattr = xattr_handlers,
+               };
+       ],[
        ],[
                AC_MSG_RESULT([yes])
                AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
@@ -40,12 +41,14 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
        AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
        ZFS_LINUX_TRY_COMPILE([
                #include <linux/xattr.h>
-       ],[
-               int (*get)(struct dentry *dentry, const char *name,
-                   void *buffer, size_t size, int handler_flags) = NULL;
-               struct xattr_handler xops __attribute__ ((unused));
 
-               xops.get = get;
+               int get(struct dentry *dentry, const char *name,
+                   void *buffer, size_t size, int handler_flags) { return 0; }
+               static const struct xattr_handler
+                   xops __attribute__ ((unused)) = {
+                       .get = get,
+               };
+       ],[
        ],[
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_DENTRY_XATTR_GET, 1,
@@ -64,13 +67,15 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
        AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
        ZFS_LINUX_TRY_COMPILE([
                #include <linux/xattr.h>
-       ],[
-               int (*set)(struct dentry *dentry, const char *name,
-                   const void *buffer, size_t size, int flags,
-                   int handler_flags) = NULL;
-               struct xattr_handler xops __attribute__ ((unused));
 
-               xops.set = set;
+               int set(struct dentry *dentry, const char *name,
+                   const void *buffer, size_t size, int flags,
+                   int handler_flags) { return 0; }
+               static const struct xattr_handler
+                   xops __attribute__ ((unused)) = {
+                       .set = set,
+               };
+       ],[
        ],[
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_DENTRY_XATTR_SET, 1,