From 6c94a31f1a0bef6a80e1180a5f01c7fea1c0e9ea Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Thu, 19 Jul 2007 01:48:18 -0700 Subject: [PATCH] --- yaml --- r: 61587 b: refs/heads/master c: 16f1820028d660d9da9c03b2ae7e98253c11795b h: refs/heads/master i: 61585: 757bfbce9886db6b2b8c393a7b1bb002e6eaadbe 61583: ddd5466fbe02807e0810c6ec5ff8bbf8aa1e88db v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 32 ++++++++++++++++++++++++++++++++ trunk/include/linux/namei.h | 2 ++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 06b719e155e4..3810473e982f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b6a2fea39318e43fee84fa7b0b90d68bed92d2ba +refs/heads/master: 16f1820028d660d9da9c03b2ae7e98253c11795b diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index defaa47c11d4..3bdb29615a9d 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1172,6 +1172,37 @@ int fastcall path_lookup(const char *name, unsigned int flags, return do_path_lookup(AT_FDCWD, name, flags, nd); } +/** + * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair + * @dentry: pointer to dentry of the base directory + * @mnt: pointer to vfs mount of the base directory + * @name: pointer to file name + * @flags: lookup flags + * @nd: pointer to nameidata + */ +int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, + const char *name, unsigned int flags, + struct nameidata *nd) +{ + int retval; + + /* same as do_path_lookup */ + nd->last_type = LAST_ROOT; + nd->flags = flags; + nd->depth = 0; + + nd->mnt = mntget(mnt); + nd->dentry = dget(dentry); + + retval = path_walk(name, nd); + if (unlikely(!retval && !audit_dummy_context() && nd->dentry && + nd->dentry->d_inode)) + audit_inode(name, nd->dentry->d_inode); + + return retval; + +} + static int __path_lookup_intent_open(int dfd, const char *name, unsigned int lookup_flags, struct nameidata *nd, int open_flags, int create_mode) @@ -2774,6 +2805,7 @@ EXPORT_SYMBOL(__page_symlink); EXPORT_SYMBOL(page_symlink); EXPORT_SYMBOL(page_symlink_inode_operations); EXPORT_SYMBOL(path_lookup); +EXPORT_SYMBOL(vfs_path_lookup); EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(path_walk); EXPORT_SYMBOL(permission); diff --git a/trunk/include/linux/namei.h b/trunk/include/linux/namei.h index b7dd24917f0d..2e21af0989d9 100644 --- a/trunk/include/linux/namei.h +++ b/trunk/include/linux/namei.h @@ -69,6 +69,8 @@ extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struc #define user_path_walk_link(name,nd) \ __user_walk_fd(AT_FDCWD, name, 0, nd) extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); +extern int vfs_path_lookup(struct dentry *, struct vfsmount *, + const char *, unsigned int, struct nameidata *); extern int FASTCALL(path_walk(const char *, struct nameidata *)); extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); extern void path_release(struct nameidata *);