Skip to content

Commit

Permalink
Refactor inode_owner_or_capable() autotools check
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ryao committed Apr 30, 2014
1 parent de39ec1 commit 1ca617a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
32 changes: 32 additions & 0 deletions config/kernel-is_owner_or_cap.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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;
inode_owner_or_capable(ip);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, [inode_owner_or_capable() exists])

This comment has been minimized.

Copy link
@behlendorf

behlendorf Apr 30, 2014

Mind the 80 char limit.

],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether is_owner_or_cap() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct inode *ip = NULL;
is_owner_or_cap(ip);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_IS_OWNER_OR_CAP, 1, [is_owner_or_cap() exists])

This comment has been minimized.

Copy link
@behlendorf

behlendorf Apr 30, 2014

Mind the 80 char limit.

],[
AC_MSG_ERROR(no; file a bug report with ZFSOnLinux)

This comment has been minimized.

Copy link
@behlendorf

behlendorf Apr 30, 2014

This ones optional, but it might be nice to include a link for where they can file the bug. The easier we make it the more likely we are to get bug reports.

https://github.com/zfsonlinux/zfs/issues/new

])
])
])
19 changes: 0 additions & 19 deletions config/kernel-xattr-handler.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
])

0 comments on commit 1ca617a

Please sign in to comment.