]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux 3.6: dentry_open API change
authorMarc Dionne <marc.c.dionne@gmail.com>
Tue, 14 Aug 2012 01:36:15 +0000 (21:36 -0400)
committerDerrick Brashear <shadow@your-file-system.com>
Sat, 29 Sep 2012 13:40:28 +0000 (06:40 -0700)
dentry_open now takes a path argument that combines the dentry and
the vfsmount pointers.
Add a configure test and a new compat inline function to keep things
cleaner in the main source file.

Reviewed-on: http://gerrit.openafs.org/7982
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 8766a65e97eb90cb6c97ccd35181c441ece14f8a)

Change-Id: I2c0f59ad9aa6e544a2a613e902933d463f22a5b6
Reviewed-on: http://gerrit.openafs.org/8079
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
acinclude.m4
src/afs/LINUX/osi_compat.h
src/afs/LINUX/osi_file.c
src/cf/linux-test4.m4

index bf81d3ec2b896059657b701d5006af3e49835b00..1a1ba2ff2e292f3d4b7050f7e743099364bf87e1 100644 (file)
@@ -961,6 +961,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_IOP_CREATE_TAKES_UMODE_T
                 LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES
                 LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE
+                LINUX_DENTRY_OPEN_TAKES_PATH
 
                 dnl If we are guaranteed that keyrings will work - that is
                 dnl  a) The kernel has keyrings enabled
index 4c7c261ef85720f5f248c51410bb61e6369f0099..84fcaa5d7a91c2e4b06696058d4af668ee61f5cc 100644 (file)
@@ -445,4 +445,20 @@ afs_get_dentry_ref(struct path *path, struct vfsmount **mnt, struct dentry **dpp
 #endif
 }
 
+#if defined(STRUCT_TASK_STRUCT_HAS_CRED)
+static inline struct file *
+afs_dentry_open(struct dentry *dp, struct vfsmount *mnt, int flags, const struct cred *creds) {
+#if defined(DENTRY_OPEN_TAKES_PATH)
+    struct path path;
+    struct file *filp;
+    path.mnt = mnt;
+    path.dentry = dp;
+    filp = dentry_open(&path, flags, creds);
+    return filp;
+#else
+    return dentry_open(dp, mntget(mnt), flags, creds);
+#endif
+}
+#endif
+
 #endif /* AFS_LINUX_OSI_COMPAT_H */
index 0aba82bdadcb908b1d30910ae14c1197a45d589c..01cc42fcb78696ba5cab724966cf5f47f8c294d7 100644 (file)
@@ -56,9 +56,9 @@ afs_linux_raw_open(afs_dcache_id_t *ainode)
 
 #if defined(STRUCT_TASK_STRUCT_HAS_CRED)
     /* Use stashed credentials - prevent selinux/apparmor problems  */
-    filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds);
+    filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds);
     if (IS_ERR(filp))
-       filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
+       filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
 #else
     filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
 #endif
index 7db805fb4f0f7ee1cc98149fedf27348869abc3b..427c5e1c8a22b9209c0dc9d526fcca7aea70d9ba 100644 (file)
@@ -687,3 +687,15 @@ AC_DEFUN([LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE], [
                        [define if kmap_atomic takes no km_type argument],
                        [-Werror])
 ])
+
+
+AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [
+  AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument],
+                       [ac_cv_linux_dentry_open_takes_path],
+                       [#include <linux/fs.h>],
+                       [struct path p;
+                       dentry_open(&p, 0, NULL);],
+                       [DENTRY_OPEN_TAKES_PATH],
+                       [define if dentry_open takes a path argument],
+                       [-Werror])
+])