]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-get-link.m4
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / config / kernel-get-link.m4
1 dnl #
2 dnl # Supported get_link() interfaces checked newest to oldest.
3 dnl # Note this interface used to be named follow_link.
4 dnl #
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
6         ZFS_LINUX_TEST_SRC([inode_operations_get_link], [
7                 #include <linux/fs.h>
8                 const char *get_link(struct dentry *de, struct inode *ip,
9                     struct delayed_call *done) { return "symlink"; }
10                 static struct inode_operations
11                      iops __attribute__ ((unused)) = {
12                         .get_link = get_link,
13                 };
14         ],[])
15
16         ZFS_LINUX_TEST_SRC([inode_operations_get_link_cookie], [
17                 #include <linux/fs.h>
18                 const char *get_link(struct dentry *de, struct
19                     inode *ip, void **cookie) { return "symlink"; }
20                 static struct inode_operations
21                      iops __attribute__ ((unused)) = {
22                         .get_link = get_link,
23                 };
24         ],[])
25
26         ZFS_LINUX_TEST_SRC([inode_operations_follow_link], [
27                 #include <linux/fs.h>
28                 const char *follow_link(struct dentry *de,
29                     void **cookie) { return "symlink"; }
30                 static struct inode_operations
31                     iops __attribute__ ((unused)) = {
32                         .follow_link = follow_link,
33                 };
34         ],[])
35
36         ZFS_LINUX_TEST_SRC([inode_operations_follow_link_nameidata], [
37                 #include <linux/fs.h>
38                 void *follow_link(struct dentry *de, struct
39                     nameidata *nd) { return (void *)NULL; }
40                 static struct inode_operations
41                     iops __attribute__ ((unused)) = {
42                         .follow_link = follow_link,
43                 };
44         ],[])
45 ])
46
47 AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
48         dnl #
49         dnl # 4.5 API change
50         dnl # The get_link interface has added a delayed done call and
51         dnl # used it to retire the put_link() interface.
52         dnl #
53         AC_MSG_CHECKING([whether iops->get_link() passes delayed])
54         ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
55                 AC_MSG_RESULT(yes)
56                 AC_DEFINE(HAVE_GET_LINK_DELAYED, 1, [iops->get_link() delayed])
57         ],[
58                 AC_MSG_RESULT(no)
59
60                 dnl #
61                 dnl # 4.5 API change
62                 dnl # The follow_link() interface has been replaced by
63                 dnl # get_link() which behaves the same as before except:
64                 dnl # - An inode is passed as a separate argument
65                 dnl # - When called in RCU mode a NULL dentry is passed.
66                 dnl #
67                 AC_MSG_CHECKING([whether iops->get_link() passes cookie])
68                 ZFS_LINUX_TEST_RESULT([inode_operations_get_link_cookie], [
69                         AC_MSG_RESULT(yes)
70                         AC_DEFINE(HAVE_GET_LINK_COOKIE, 1,
71                             [iops->get_link() cookie])
72                 ],[
73                         AC_MSG_RESULT(no)
74
75                         dnl #
76                         dnl # 4.2 API change
77                         dnl # This kernel retired the nameidata structure.
78                         dnl #
79                         AC_MSG_CHECKING(
80                             [whether iops->follow_link() passes cookie])
81                         ZFS_LINUX_TEST_RESULT([inode_operations_follow_link], [
82                                 AC_MSG_RESULT(yes)
83                                 AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
84                                     [iops->follow_link() cookie])
85                         ],[
86                                 AC_MSG_RESULT(no)
87
88                                 dnl #
89                                 dnl # 2.6.32 API
90                                 dnl #
91                                 AC_MSG_CHECKING(
92                                 [whether iops->follow_link() passes nameidata])
93                                 ZFS_LINUX_TEST_RESULT(
94                                     [inode_operations_follow_link_nameidata],[
95                                         AC_MSG_RESULT(yes)
96                                         AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
97                                             [iops->follow_link() nameidata])
98                                 ],[
99                                         ZFS_LINUX_TEST_ERROR([get_link])
100                                 ])
101                         ])
102                 ])
103         ])
104 ])