From 7ca98751976df92a8f91f5768754ff3c1b4980bf Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 29 Aug 2012 11:39:01 -0500 Subject: [PATCH] LINUX: Use struct vfs_path on RHEL5 Some revisions of the kernel from RHEL5 (2.6.18-308.* and possibly others) renamed 'struct path' to 'struct vfs_path'. So, use 'struct vfs_path' when it exists. This introduces the afs_linux_path_t typedef, which is defined as either a struct path, or struct vfs_path. Reviewed-on: http://gerrit.openafs.org/8019 Tested-by: BuildBot Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear (cherry picked from commit 74c1881dff1593f4a8920ba8d8a2400760899fa5) Change-Id: I6eaf17ebe9a35b345c1fd5cebd490f8095a1b22b Reviewed-on: http://gerrit.openafs.org/8789 Tested-by: BuildBot Reviewed-by: Paul Smeddle Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand --- acinclude.m4 | 3 +++ src/afs/LINUX/osi_compat.h | 12 +++++++++--- src/afs/LINUX/osi_misc.c | 4 ++-- src/afs/LINUX/osi_vnodeops.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index d80913cc4..76ae5976e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -798,6 +798,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_HEADER([semaphore.h]) AC_CHECK_LINUX_HEADER([seq_file.h]) + dnl Type existence checks + AC_CHECK_LINUX_TYPE([struct vfs_path], [dcache.h]) + dnl Check for structure elements AC_CHECK_LINUX_STRUCT([address_space_operations], [write_begin], [fs.h]) diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index c71384df8..942f10176 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -27,6 +27,12 @@ # endif #endif +#ifdef HAVE_LINUX_STRUCT_VFS_PATH +typedef struct vfs_path afs_linux_path_t; +#else +typedef struct path afs_linux_path_t; +#endif + #ifndef HAVE_LINUX_DO_SYNC_READ static inline int do_sync_read(struct file *fp, char *buf, size_t count, loff_t *offp) { @@ -414,7 +420,7 @@ afs_kern_path(char *aname, int flags, struct nameidata *nd) { } #else static inline int -afs_kern_path(char *aname, int flags, struct path *path) { +afs_kern_path(char *aname, int flags, afs_linux_path_t *path) { return kern_path(aname, flags, path); } #endif @@ -423,7 +429,7 @@ static inline void #if defined(HAVE_LINUX_PATH_LOOKUP) afs_get_dentry_ref(struct nameidata *nd, struct vfsmount **mnt, struct dentry **dpp) { #else -afs_get_dentry_ref(struct path *path, struct vfsmount **mnt, struct dentry **dpp) { +afs_get_dentry_ref(afs_linux_path_t *path, struct vfsmount **mnt, struct dentry **dpp) { #endif #if defined(STRUCT_NAMEIDATA_HAS_PATH) # if defined(HAVE_LINUX_PATH_LOOKUP) @@ -449,7 +455,7 @@ afs_get_dentry_ref(struct path *path, struct vfsmount **mnt, struct dentry **dpp 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; + afs_linux_path_t path; struct file *filp; path.mnt = mnt; path.dentry = dp; diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 6ae6c1b8c..879f7a12c 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -62,7 +62,7 @@ osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt, #if defined(HAVE_LINUX_PATH_LOOKUP) struct nameidata path_data; #else - struct path path_data; + afs_linux_path_t path_data; #endif int flags = LOOKUP_POSITIVE; code = ENOENT; @@ -117,7 +117,7 @@ int osi_abspath(char *aname, char *buf, int buflen, code = osi_lookupname_internal(afs_name_to_string(tname), followlink, &mnt, &dp); if (!code) { #if defined(D_PATH_TAKES_STRUCT_PATH) - struct path p = { mnt, dp }; + afs_linux_path_t p = { mnt, dp }; path = d_path(&p, buf, buflen); #else path = d_path(dp, mnt, buf, buflen); diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 844768a25..1344d0ca0 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1146,7 +1146,7 @@ afs_dentry_delete(struct dentry *dp) #ifdef STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT static struct vfsmount * -afs_dentry_automount(struct path *path) +afs_dentry_automount(afs_linux_path_t *path) { struct dentry *target; -- 2.39.5