Linux: 2.6.39: replace path_lookup with kern_path

path_lookup is no longer available, use kern_path instead.

Change-Id: I42ae43114fe257fc65452f1b0a35d43595b0044b
Reviewed-on: http://gerrit.openafs.org/4360
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2011-03-27 10:59:55 -04:00 committed by Derrick Brashear
parent 20da07abdf
commit 7d162266c4
3 changed files with 41 additions and 14 deletions

View File

@ -847,6 +847,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
[#include <linux/pagevec.h>],
[__pagevec_lru_add_file(NULL);])
AC_CHECK_LINUX_FUNC([path_lookup],
[#include <linux/namei.h>],
[path_lookup(NULL, 0, NULL);])
AC_CHECK_LINUX_FUNC([rcu_read_lock],
[#include <linux/rcupdate.h>],
[rcu_read_lock();])

View File

@ -403,4 +403,35 @@ afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
return code;
}
static inline int
afs_kern_path(char *aname, int flags, struct nameidata *nd, struct path *path) {
#if defined(HAVE_LINUX_PATH_LOOKUP)
return path_lookup(aname, flags, nd);
#else
return kern_path(aname, flags, path);
#endif
}
static inline void
afs_get_dentry_ref(struct nameidata *nd, struct path *path, struct vfsmount **mnt, struct dentry **dpp) {
#if defined(STRUCT_NAMEIDATA_HAS_PATH)
# if defined(HAVE_LINUX_PATH_LOOKUP)
*dpp = dget(nd->path.dentry);
if (mnt)
*mnt = mntget(nd->path.mnt);
path_put(&nd->path);
# else
*dpp = dget(path->dentry);
if (mnt)
*mnt = mntget(path->mnt);
path_put(path);
# endif
#else
*dpp = dget(nd->dentry);
if (mnt)
*mnt = mntget(nd->mnt);
path_release(nd);
#endif
}
#endif /* AFS_LINUX_OSI_COMPAT_H */

View File

@ -23,6 +23,8 @@
#include "afsincludes.h"
#include "afs/afs_stats.h"
#include "osi_compat.h"
int afs_osicred_initialized = 0;
afs_ucred_t afs_osi_cred;
@ -58,26 +60,17 @@ osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt,
{
int code;
struct nameidata nd;
struct path path;
int flags = LOOKUP_POSITIVE;
code = ENOENT;
if (followlink)
flags |= LOOKUP_FOLLOW;
code = path_lookup(aname, flags, &nd);
code = afs_kern_path(aname, flags, &nd, &path);
if (!code)
afs_get_dentry_ref(&nd, &path, mnt, dpp);
if (!code) {
#if defined(STRUCT_NAMEIDATA_HAS_PATH)
*dpp = dget(nd.path.dentry);
if (mnt)
*mnt = mntget(nd.path.mnt);
path_put(&nd.path);
#else
*dpp = dget(nd.dentry);
if (mnt)
*mnt = mntget(nd.mnt);
path_release(&nd);
#endif
}
return code;
}