]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
SOLARIS: Use vn_renamepath as early as possible
authorAndrew Deason <adeason@sinenomine.net>
Fri, 18 Jan 2013 20:27:16 +0000 (14:27 -0600)
committerPaul Smeddle <paul.smeddle@gmail.com>
Tue, 29 Jan 2013 21:19:24 +0000 (13:19 -0800)
Commit 6c509601 uses the vn_renamepath when we are building on Solaris
11. However, some recent patch level of Solaris 10 (more recent than
stock 10u10) has the same problem fixed by that commit, where
vn_setpath takes an additional argument. So instead, just test for the
existence of vn_renamepath itself, so we also use it on Solaris 10
when we can.

Thanks to Rich Sudlow for reporting this.

Reviewed-on: http://gerrit.openafs.org/8920
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 1b63689b99b49d902dd5a3286b14dcccee88b4a2)

Change-Id: I035c76dba51571fa82fd8932302e7f26b4954333
Reviewed-on: http://gerrit.openafs.org/8984
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
acinclude.m4
src/afs/SOLARIS/osi_vnodeops.c
src/cf/solaris-renamepath.m4 [new file with mode: 0644]

index 2238aebd36b8c4428c1075813ab242c5941c0d98..8c57779061cc0e0261cee54d1576a5dc4d7ba7ca 100644 (file)
@@ -374,6 +374,7 @@ case $system in
                SOLARIS_UFSVFS_HAS_DQRWLOCK
                SOLARIS_FS_HAS_FS_ROLLED
                SOLARIS_SOLOOKUP_TAKES_SOCKPARAMS
+               SOLARIS_HAVE_VN_RENAMEPATH
                 ;;
         *-sunos*)
                MKAFS_OSTYPE=SUNOS
index f2fe46d3c2e1caa392a1dffc4ea6e785eb34c044..f810c6db9358f5d73f319e681557d364121342da 100644 (file)
@@ -1707,7 +1707,7 @@ gafs_rename(struct vcache *aodp, char *aname1,
        if (avcp) {
            struct vnode *vp = AFSTOV(avcp), *pvp = AFSTOV(andp);
 
-# ifdef AFS_SUN511_ENV
+# ifdef HAVE_VN_RENAMEPATH
            vn_renamepath(pvp, vp, aname2, strlen(aname2));
 # else
            mutex_enter(&vp->v_lock);
@@ -1717,7 +1717,7 @@ gafs_rename(struct vcache *aodp, char *aname1,
            }
            mutex_exit(&vp->v_lock);
            vn_setpath(afs_globalVp, pvp, vp, aname2, strlen(aname2));
-# endif /* !AFS_SUN511_ENV */
+# endif /* !HAVE_VN_RENAMEPATH */
 
            AFS_RELE(avcp);
        }
diff --git a/src/cf/solaris-renamepath.m4 b/src/cf/solaris-renamepath.m4
new file mode 100644 (file)
index 0000000..6ae7fe2
--- /dev/null
@@ -0,0 +1,35 @@
+dnl This checks for the existence of the vn_renamepath function, added in
+dnl Solaris 11 and Solaris 10u8.
+dnl
+dnl Just trying to use the function is not sufficient for a configure test,
+dnl since using an undeclared function is just a warning, and we want an error.
+dnl Rather than try to rely on making warnings generate errors (which may
+dnl change depending on what compiler version we're using, or in the future
+dnl different compilers entirely), we detect the function by declaring an
+dnl incompatible prototype. If that successfully compiles, vn_renamepath
+dnl does not exist in the system headers, so we know it's not there. If it
+dnl fails, we try to compile again without the incompatible prototype, to
+dnl make sure we didn't fail for some other reason. If that succeeds, we know
+dnl we have vn_renamepath available; if it fails, something else is wrong and
+dnl we just try to proceed, assuming we don't have it.
+dnl
+AC_DEFUN([SOLARIS_HAVE_VN_RENAMEPATH],
+
+ [AC_CACHE_CHECK([for vn_renamepath],
+   [ac_cv_solaris_have_vn_renamepath],
+   [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM(
+       [[#define _KERNEL
+         #include <sys/vnode.h>]],
+       [[void vn_renamepath(void);]])],
+     [ac_cv_solaris_have_vn_renamepath=no],
+     [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[#define _KERNEL
+           #include <sys/vnode.h>]])],
+       [ac_cv_solaris_have_vn_renamepath=yes],
+       [ac_cv_solaris_have_vn_renamepath=no])])])
+
+  AS_IF([test "x$ac_cv_solaris_have_vn_renamepath" = "xyes"],
+        [AC_DEFINE([HAVE_VN_RENAMEPATH], [1],
+                   [define if the function vn_renamepath exists])])])