Linux 4: struct address_space no longer has backing_dev_info
[openafs.git] / acinclude.m4
index 24d0721..84199ff 100644 (file)
@@ -79,8 +79,6 @@ dnl General feature options.
 AC_ARG_ENABLE([gtx],
     [AS_HELP_STRING([--disable-gtx], [disable gtx curses-based terminal tools])])
 
-AC_ARG_ENABLE([uss],
-    [AS_HELP_STRING([--disable-uss], [disable uss bulk creation tool])])
 AC_ARG_ENABLE([namei-fileserver],
     [AS_HELP_STRING([--enable-namei-fileserver],
        [force compilation of namei fileserver in preference to inode
@@ -253,6 +251,26 @@ AC_ARG_ENABLE([linux-syscall-probing],
        [enable Linux syscall probing (defaults to autodetect)])],
     [],
     [enable_linux_syscall_probing="maybe"])
+AC_ARG_ENABLE([linux-d_splice_alias-extra-iput],
+    [AS_HELP_STRING([--enable-linux-d_splice_alias-extra-iput],
+       [Linux has introduced an incompatible behavior change in the
+        d_splice_alias function with no reliable way to determine which
+        behavior will be produced.  If Linux commit
+        51486b900ee92856b977eacfc5bfbe6565028070 (or equivalent) has been
+        applied to your kernel, disable this option.  If that commit is
+        not present in your kernel, enable this option.  We apologize
+        that you are required to know this about your running kernel.])],
+    [],
+    [case $system in
+    *-linux*)
+       AS_IF([test "x$LOGNAME" != "xbuildslave" &&
+           test "x$LOGNAME" != "xbuildbot"],
+           [AC_ERROR([Linux users must specify either
+               --enable-linux-d_splice_alias-extra-iput or
+               --disable-linux-d_splice_alias-extra-iput])],
+           [enable_linux_d_splice_alias_extra_iput="no"])
+     esac
+    ])
 AC_ARG_WITH([crosstools-dir],
     [AS_HELP_STRING([--with-crosstools-dir=path],
        [use path for native versions of rxgen, compile_et and config])
@@ -437,7 +455,7 @@ case $system in
                 case "$GUESS_LINUX_VERSION" in
                   2.2.*) AFS_SYSKVERS=22 ;;
                   2.4.*) AFS_SYSKVERS=24 ;;
-                  2.6.* | 3.*) AFS_SYSKVERS=26 ;;
+                  [2.6.* | [3-9]* | [1-2][0-9]*]) AFS_SYSKVERS=26 ;;
                   *) AC_MSG_ERROR(Couldn't guess your Linux version [2]) ;;
                 esac
                 ;;
@@ -897,18 +915,21 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_TYPE([kuid_t], [uidgid.h])
 
                 dnl Check for structure elements
+                AC_CHECK_LINUX_STRUCT([address_space], [backing_dev_info], [fs.h])
                 AC_CHECK_LINUX_STRUCT([address_space_operations],
                                       [write_begin], [fs.h])
                 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
                                       [backing-dev.h])
                 AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
                 AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
+                AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h])
                 AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
+                AC_CHECK_LINUX_STRUCT([file], [f_path], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_operations], [iterate], [fs.h])
                 AC_CHECK_LINUX_STRUCT([file_operations], [read_iter], [fs.h])
@@ -918,6 +939,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h])
                 AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h])
                 AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
+                AC_CHECK_LINUX_STRUCT([msghdr], [msg_iter], [socket.h])
                 AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
                 AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
                 AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
@@ -988,6 +1010,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([hlist_unhashed],
                                     [#include <linux/list.h>],
                                     [hlist_unhashed(0);])
+                AC_CHECK_LINUX_FUNC([ihold],
+                                    [#include <linux/fs.h>],
+                                    [ihold(NULL);])
                 AC_CHECK_LINUX_FUNC([i_size_read],
                                     [#include <linux/fs.h>],
                                     [i_size_read(NULL);])
@@ -1178,6 +1203,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 fi
                 :
                fi
+               if test "x$enable_linux_d_splice_alias_extra_iput" = xyes; then
+                   AC_DEFINE(D_SPLICE_ALIAS_LEAK_ON_ERROR, 1, [for internal use])
+               fi
 dnl Linux-only, but just enable always.
                AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
 esac
@@ -1539,13 +1567,6 @@ else
 fi
 AC_SUBST(BUILD_LOGIN)
 
-if test "$enable_uss" = yes; then
-       BUILD_USS="yes"
-else
-       BUILD_USS="no"
-fi
-AC_SUBST(BUILD_USS)
-
 if test "$enable_kauth" = yes; then
        INSTALL_KAUTH="yes"
 else