From: Andrew Deason Date: Wed, 29 Aug 2012 16:39:01 +0000 (-0500) Subject: LINUX: Use struct vfs_path on RHEL5 X-Git-Tag: openafs-stable-1_8_0pre1~2069 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=74c1881dff1593f4a8920ba8d8a2400760899fa5 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. Change-Id: I88c31125dbc1ab2998a521e3c57ed532bf2d5bb7 Reviewed-on: http://gerrit.openafs.org/8019 Tested-by: BuildBot Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear --- diff --git a/acinclude.m4 b/acinclude.m4 index 2e9cf6b..9b465c3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -799,6 +799,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 a4b83a1..322d88f 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) { @@ -432,7 +438,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 @@ -441,7 +447,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) @@ -502,7 +508,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 fb740db..9a8ccbe 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; @@ -113,7 +113,7 @@ int osi_abspath(char *aname, char *buf, int buflen, code = osi_lookupname_internal(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 36cd056..5a3ce7a 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1238,7 +1238,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;