]> granicus.if.org Git - spl/commitdiff
Linux 3.9 compat: vfs_getattr takes two arguments
authorRichard Yao <ryao@cs.stonybrook.edu>
Mon, 4 Mar 2013 05:02:43 +0000 (00:02 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 14 Mar 2013 17:43:26 +0000 (10:43 -0700)
The function prototype of vfs_getattr previoulsy took struct vfsmount *
and struct dentry * as arguments. These would always be defined together
in a struct path *.

torvalds/linux@3dadecce20603aa380023c65e6f55f108fd5e952 modified
vfs_getattr to take struct path * is taken as an argument instead.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
config/spl-build.m4
module/spl/spl-vnode.c

index eef3a76aeaa7584057477d4fab3364061b36a1cb..83cefabd422ffcf42bcc688b18c1c97f7cea2b99 100644 (file)
@@ -89,6 +89,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
        SPL_AC_SHRINK_CONTROL_STRUCT
        SPL_AC_RWSEM_SPINLOCK_IS_RAW
        SPL_AC_SCHED_RT_HEADER
+       SPL_AC_2ARGS_VFS_GETATTR
 ])
 
 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
@@ -2237,3 +2238,34 @@ AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
                AC_MSG_RESULT(no)
        ])
 ])
+
+dnl #
+dnl # 3.9 API change,
+dnl # vfs_getattr() uses 2 args
+dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
+dnl #
+AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
+       AC_MSG_CHECKING([whether vfs_getattr() wants])
+       SPL_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               vfs_getattr((struct path *) NULL,
+                       (struct kstat *)NULL);
+       ],[
+               AC_MSG_RESULT(2 args)
+               AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
+                         [vfs_getattr wants 2 args])
+       ],[
+               SPL_LINUX_TRY_COMPILE([
+                       #include <linux/fs.h>
+               ],[
+                       vfs_getattr((struct vfsmount *)NULL,
+                               (struct dentry *)NULL,
+                               (struct kstat *)NULL);
+               ],[
+                       AC_MSG_RESULT(3 args)
+               ],[
+                       AC_MSG_ERROR(unknown)
+               ])
+       ])
+])
index fb8f1fc7e489755a89bcb76e97c259b8cb7326e5..e264fba050e924431324cc8fecdae459e73b36cc 100644 (file)
@@ -175,7 +175,11 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
        if (IS_ERR(fp))
                SRETURN(-PTR_ERR(fp));
 
+#ifdef HAVE_2ARGS_VFS_GETATTR
+       rc = vfs_getattr(&fp->f_path, &stat);
+#else
        rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
+#endif
        if (rc) {
                filp_close(fp, 0);
                SRETURN(-rc);
@@ -602,7 +606,11 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
 
        fp = vp->v_file;
 
-        rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
+#ifdef HAVE_2ARGS_VFS_GETATTR
+       rc = vfs_getattr(&fp->f_path, &stat);
+#else
+       rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
+#endif
        if (rc)
                SRETURN(-rc);
 
@@ -754,7 +762,12 @@ vn_getf(int fd)
        if (vp == NULL)
                SGOTO(out_fget, rc);
 
-        if (vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat))
+#ifdef HAVE_2ARGS_VFS_GETATTR
+       rc = vfs_getattr(&lfp->f_path, &stat);
+#else
+       rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat);
+#endif
+        if (rc)
                SGOTO(out_vnode, rc);
 
        mutex_enter(&vp->v_lock);