The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/config/kernel-acl.m4

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 dnl #
    2 dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED
    3 dnl # module.  The is_owner_or_cap macro was replaced by
    4 dnl # inode_owner_or_capable
    5 dnl #
    6 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
    7         ZFS_LINUX_TEST_SRC([posix_acl_release], [
    8                 #include <linux/cred.h>
    9                 #include <linux/fs.h>
   10                 #include <linux/posix_acl.h>
   11         ], [
   12                 struct posix_acl *tmp = posix_acl_alloc(1, 0);
   13                 posix_acl_release(tmp);
   14         ], [], [ZFS_META_LICENSE])
   15 ])
   16 
   17 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
   18         AC_MSG_CHECKING([whether posix_acl_release() is available])
   19         ZFS_LINUX_TEST_RESULT([posix_acl_release], [
   20                 AC_MSG_RESULT(yes)
   21                 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
   22                     [posix_acl_release() is available])
   23 
   24                 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
   25                 ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [
   26                         AC_MSG_RESULT(no)
   27                 ],[
   28                         AC_MSG_RESULT(yes)
   29                         AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1,
   30                             [posix_acl_release() is GPL-only])
   31                 ])
   32         ],[
   33                 AC_MSG_RESULT(no)
   34         ])
   35 ])
   36 
   37 dnl #
   38 dnl # 3.14 API change,
   39 dnl # set_cached_acl() and forget_cached_acl() changed from inline to
   40 dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
   41 dnl # posix_acl_release. In the latter case, we can always use them.
   42 dnl #
   43 AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [
   44         ZFS_LINUX_TEST_SRC([set_cached_acl], [
   45                 #include <linux/cred.h>
   46                 #include <linux/fs.h>
   47                 #include <linux/posix_acl.h>
   48         ], [
   49                 struct inode *ip = NULL;
   50                 struct posix_acl *acl = posix_acl_alloc(1, 0);
   51                 set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
   52                 forget_cached_acl(ip, ACL_TYPE_ACCESS);
   53         ], [], [ZFS_META_LICENSE])
   54 ])
   55 
   56 AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
   57         AC_MSG_CHECKING([whether set_cached_acl() is usable])
   58         ZFS_LINUX_TEST_RESULT([set_cached_acl_license], [
   59                 AC_MSG_RESULT(yes)
   60                 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
   61                     [set_cached_acl() is usable])
   62         ],[
   63                 AC_MSG_RESULT(no)
   64         ])
   65 ])
   66 
   67 dnl #
   68 dnl # 3.1 API change,
   69 dnl # posix_acl_chmod() was added as the preferred interface.
   70 dnl #
   71 dnl # 3.14 API change,
   72 dnl # posix_acl_chmod() was changed to __posix_acl_chmod()
   73 dnl #
   74 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [
   75         ZFS_LINUX_TEST_SRC([posix_acl_chmod], [
   76                 #include <linux/fs.h>
   77                 #include <linux/posix_acl.h>
   78         ],[
   79                 posix_acl_chmod(NULL, 0, 0)
   80         ])
   81 
   82         ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [
   83                 #include <linux/fs.h>
   84                 #include <linux/posix_acl.h>
   85         ],[
   86                 __posix_acl_chmod(NULL, 0, 0)
   87         ])
   88 ])
   89 
   90 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
   91         AC_MSG_CHECKING([whether __posix_acl_chmod exists])
   92         ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
   93                 AC_MSG_RESULT(yes)
   94                 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1,
   95                     [__posix_acl_chmod() exists])
   96         ],[
   97                 AC_MSG_RESULT(no)
   98 
   99                 AC_MSG_CHECKING([whether posix_acl_chmod exists])
  100                 ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [
  101                         AC_MSG_RESULT(yes)
  102                         AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1,
  103                             [posix_acl_chmod() exists])
  104                 ],[
  105                         ZFS_LINUX_TEST_ERROR([posix_acl_chmod()])
  106                 ])
  107         ])
  108 ])
  109 
  110 dnl #
  111 dnl # 3.1 API change,
  112 dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t
  113 dnl #
  114 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
  115         ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
  116                 #include <linux/fs.h>
  117                 #include <linux/posix_acl.h>
  118         ],[
  119                 umode_t tmp;
  120                 posix_acl_equiv_mode(NULL, &tmp);
  121         ])
  122 ])
  123 
  124 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
  125         AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
  126         ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
  127                 AC_MSG_RESULT(yes)
  128         ],[
  129                 ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()])
  130         ])
  131 ])
  132 
  133 dnl #
  134 dnl # 4.8 API change,
  135 dnl # The function posix_acl_valid now must be passed a namespace.
  136 dnl #
  137 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [
  138         ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [
  139                 #include <linux/fs.h>
  140                 #include <linux/posix_acl.h>
  141         ],[
  142                 struct user_namespace *user_ns = NULL;
  143                 const struct posix_acl *acl = NULL;
  144                 int error;
  145 
  146                 error = posix_acl_valid(user_ns, acl);
  147         ])
  148 ])
  149 
  150 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
  151         AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
  152         ZFS_LINUX_TEST_RESULT([posix_acl_valid_with_ns], [
  153                 AC_MSG_RESULT(yes)
  154                 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
  155                     [posix_acl_valid() wants user namespace])
  156         ],[
  157                 AC_MSG_RESULT(no)
  158         ])
  159 ])
  160 
  161 dnl #
  162 dnl # 3.1 API change,
  163 dnl # Check if inode_operations contains the function get_acl
  164 dnl #
  165 dnl # 5.15 API change,
  166 dnl # Added the bool rcu argument to get_acl for rcu path walk.
  167 dnl #
  168 dnl # 6.2 API change,
  169 dnl # get_acl() was renamed to get_inode_acl()
  170 dnl #
  171 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
  172         ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
  173                 #include <linux/fs.h>
  174 
  175                 struct posix_acl *get_acl_fn(struct inode *inode, int type)
  176                     { return NULL; }
  177 
  178                 static const struct inode_operations
  179                     iops __attribute__ ((unused)) = {
  180                         .get_acl = get_acl_fn,
  181                 };
  182         ],[])
  183 
  184         ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
  185                 #include <linux/fs.h>
  186 
  187                 struct posix_acl *get_acl_fn(struct inode *inode, int type,
  188                     bool rcu) { return NULL; }
  189 
  190                 static const struct inode_operations
  191                     iops __attribute__ ((unused)) = {
  192                         .get_acl = get_acl_fn,
  193                 };
  194         ],[])
  195 
  196         ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
  197                 #include <linux/fs.h>
  198 
  199                 struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
  200                     bool rcu) { return NULL; }
  201 
  202                 static const struct inode_operations
  203                     iops __attribute__ ((unused)) = {
  204                         .get_inode_acl = get_inode_acl_fn,
  205                 };
  206         ],[])
  207 ])
  208 
  209 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
  210         AC_MSG_CHECKING([whether iops->get_acl() exists])
  211         ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
  212                 AC_MSG_RESULT(yes)
  213                 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
  214         ],[
  215                 ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
  216                         AC_MSG_RESULT(yes)
  217                         AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
  218                 ],[
  219                         ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [
  220                                 AC_MSG_RESULT(yes)
  221                                 AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()])
  222                         ],[
  223                                 ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()])
  224                         ])
  225                 ])
  226         ])
  227 ])
  228 
  229 dnl #
  230 dnl # 3.14 API change,
  231 dnl # Check if inode_operations contains the function set_acl
  232 dnl #
  233 dnl # 5.12 API change,
  234 dnl # set_acl() added a user_namespace* parameter first
  235 dnl #
  236 dnl # 6.2 API change,
  237 dnl # set_acl() second paramter changed to a struct dentry *
  238 dnl #
  239 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
  240         ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns_dentry], [
  241                 #include <linux/fs.h>
  242 
  243                 int set_acl_fn(struct user_namespace *userns,
  244                     struct dentry *dent, struct posix_acl *acl,
  245                     int type) { return 0; }
  246 
  247                 static const struct inode_operations
  248                     iops __attribute__ ((unused)) = {
  249                         .set_acl = set_acl_fn,
  250                 };
  251         ],[])
  252         ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
  253                 #include <linux/fs.h>
  254 
  255                 int set_acl_fn(struct user_namespace *userns,
  256                     struct inode *inode, struct posix_acl *acl,
  257                     int type) { return 0; }
  258 
  259                 static const struct inode_operations
  260                     iops __attribute__ ((unused)) = {
  261                         .set_acl = set_acl_fn,
  262                 };
  263         ],[])
  264         ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
  265                 #include <linux/fs.h>
  266 
  267                 int set_acl_fn(struct inode *inode, struct posix_acl *acl,
  268                     int type) { return 0; }
  269 
  270                 static const struct inode_operations
  271                     iops __attribute__ ((unused)) = {
  272                         .set_acl = set_acl_fn,
  273                 };
  274         ],[])
  275 ])
  276 
  277 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
  278         AC_MSG_CHECKING([whether iops->set_acl() exists])
  279         ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
  280                 AC_MSG_RESULT(yes)
  281                 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
  282                 AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
  283         ],[
  284                 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
  285                         AC_MSG_RESULT(yes)
  286                         AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
  287                         AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
  288                             [iops->set_acl() takes 4 args, arg2 is struct dentry *])
  289                 ],[
  290                         ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
  291                                 AC_MSG_RESULT(yes)
  292                                 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
  293                         ],[
  294                                 ZFS_LINUX_REQUIRE_API([i_op->set_acl()], [3.14])
  295                         ])
  296                 ])
  297         ])
  298 ])
  299 
  300 dnl #
  301 dnl # 4.7 API change,
  302 dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
  303 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
  304 dnl # anymore.
  305 dnl #
  306 AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [
  307         ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [
  308                 #include <linux/fs.h>
  309         ],[
  310                 void *sentinel __attribute__ ((unused)) =
  311                     uncached_acl_sentinel(NULL);
  312         ])
  313 ])
  314 
  315 AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
  316         AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
  317         ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [
  318                 AC_MSG_RESULT(yes)
  319                 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1,
  320                     [uncached_acl_sentinel() exists])
  321         ],[
  322                 AC_MSG_RESULT(no)
  323         ])
  324 ])
  325 
  326 dnl #
  327 dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t.
  328 dnl # It's an atomic_t on older kernels.
  329 dnl #
  330 AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [
  331         ZFS_LINUX_TEST_SRC([acl_refcount], [
  332                 #include <linux/backing-dev.h>
  333                 #include <linux/refcount.h>
  334                 #include <linux/posix_acl.h>
  335         ],[
  336                 struct posix_acl acl;
  337                 refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
  338         ])
  339 ])
  340 
  341 AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [
  342         AC_MSG_CHECKING([whether posix_acl has refcount_t])
  343         ZFS_LINUX_TEST_RESULT([acl_refcount], [
  344                 AC_MSG_RESULT(yes)
  345                 AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t])
  346         ],[
  347                 AC_MSG_RESULT(no)
  348         ])
  349 ])
  350 
  351 AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
  352         ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE
  353         ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE
  354         ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD
  355         ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
  356         ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS
  357         ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
  358         ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
  359         ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE
  360         ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT
  361 ])
  362 
  363 AC_DEFUN([ZFS_AC_KERNEL_ACL], [
  364         ZFS_AC_KERNEL_POSIX_ACL_RELEASE
  365         ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
  366         ZFS_AC_KERNEL_POSIX_ACL_CHMOD
  367         ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
  368         ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
  369         ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
  370         ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
  371         ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
  372         ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
  373 ])

Cache object: 2a099946234719262369606b0292c3e6


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.