Linux: use standard macro for set_nlink configure test
authorMarc Dionne <marc.c.dionne@gmail.com>
Wed, 18 Jan 2012 15:25:03 +0000 (10:25 -0500)
committerDerrick Brashear <shadow@dementix.org>
Wed, 18 Jan 2012 17:28:23 +0000 (09:28 -0800)
A generic macro exists to test for functions in the kernel, use
it for set_nlink.

Change-Id: Iaec2b29e48f500bcf7a1ef80a3f2a1305e5dbb8f
Reviewed-on: http://gerrit.openafs.org/6566
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

acinclude.m4
src/afs/LINUX/osi_vfsops.c
src/cf/linux-test4.m4

index 81d22aa..8f6ccf1 100644 (file)
@@ -888,6 +888,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([rcu_read_lock],
                                     [#include <linux/rcupdate.h>],
                                     [rcu_read_lock();])
+                AC_CHECK_LINUX_FUNC([set_nlink],
+                                    [#include <linux/fs.h>],
+                                    [set_nlink(NULL, 1);])
                 AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
                                     [#include <linux/splice.h>],
                                     [splice_direct_to_actor(NULL,NULL,NULL);])
@@ -947,7 +950,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
                 LINUX_HAVE_DCACHE_LOCK
                 LINUX_D_COUNT_IS_INT
-                LINUX_HAVE_SET_NLINK
 
                 dnl If we are guaranteed that keyrings will work - that is
                 dnl  a) The kernel has keyrings enabled
index 30479dc..2fbb349 100644 (file)
@@ -439,7 +439,7 @@ void
 vattr2inode(struct inode *ip, struct vattr *vp)
 {
     ip->i_ino = vp->va_nodeid;
-#ifdef HAVE_SET_NLINK
+#ifdef HAVE_LINUX_SET_NLINK
     set_nlink(ip, vp->va_nlink);
 #else
     ip->i_nlink = vp->va_nlink;
index 894136f..b7c9070 100644 (file)
@@ -624,15 +624,3 @@ AC_DEFUN([LINUX_DOP_D_DELETE_TAKES_CONST], [
                        [define if dentry.d_op->d_delete takes a const argument],
                        [-Werror])
 ])
-
-
-AC_DEFUN([LINUX_HAVE_SET_NLINK], [
-  AC_CHECK_LINUX_BUILD([for set_nlink],
-                       [ac_cv_linux_have_set_nlink],
-                       [#include <linux/fs.h>],
-                       [struct inode _inode;
-                       set_nlink(&_inode, 1);],
-                       [HAVE_SET_NLINK],
-                       [define if set_nlink exists],
-                       [-Werror])
-])