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>
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();])
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 */
#include "afsincludes.h"
#include "afs/afs_stats.h"
+#include "osi_compat.h"
+
int afs_osicred_initialized = 0;
afs_ucred_t afs_osi_cred;
{
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;
}