]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Refactor inode_owner_or_capable() autotools check
authorRichard Yao <ryao@gentoo.org>
Wed, 30 Apr 2014 02:42:09 +0000 (22:42 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 1 May 2014 17:06:49 +0000 (10:06 -0700)
We need inode_owner_or_capable() for ZFS file attributes in addition to
xattrs, so it should go into its own file. This moves it into its own
file and changes it to be more comprehensive. It will now fail if no
known good API is detected.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1691

config/kernel-is_owner_or_cap.m4 [new file with mode: 0644]
config/kernel-xattr-handler.m4

diff --git a/config/kernel-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4
new file mode 100644 (file)
index 0000000..da07e58
--- /dev/null
@@ -0,0 +1,36 @@
+dnl #
+dnl # 2.6.39 API change,
+dnl # The is_owner_or_cap() macro was renamed to inode_owner_or_capable(),
+dnl # This is used for permission checks in the xattr and file attribute call
+dnl # paths.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
+       AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               struct inode *ip = NULL;
+               (void) inode_owner_or_capable(ip);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
+                   [inode_owner_or_capable() exists])
+       ],[
+               AC_MSG_RESULT(no)
+               AC_MSG_CHECKING([whether is_owner_or_cap() exists])
+               ZFS_LINUX_TRY_COMPILE([
+                       #include <linux/fs.h>
+                       #include <linux/sched.h>
+               ],[
+                       struct inode *ip = NULL;
+                       (void) is_owner_or_cap(ip);
+               ],[
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE(HAVE_IS_OWNER_OR_CAP, 1,
+                           [is_owner_or_cap() exists])
+               ],[
+                       AC_MSG_ERROR(no - Please file a bug report at
+                           https://github.com/zfsonlinux/zfs/issues/new)
+               ])
+       ])
+])
index 2ba2fcbcd2e2ab21e4911567856dccf45863b4d2..1374f791705ba5fc97fbb52ab7801f15d469760f 100644 (file)
@@ -134,22 +134,3 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
        ])
 ])
 
-dnl #
-dnl # 2.6.39 API change,
-dnl # The is_owner_or_cap() macro was replaced by inode_owner_or_capable(),
-dnl # this is used for permission checks in the xattr call paths.
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
-       AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
-       ZFS_LINUX_TRY_COMPILE([
-               #include <linux/fs.h>
-       ],[
-               inode_owner_or_capable(NULL);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
-                   [inode_owner_or_capable() exists])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-])