X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fnamei.c;h=a83160acd7487328a0b86d318ac4e3427df7e329;hb=1864f7bd58351732593def024e73eca1f75bc352;hp=5e2d98d10c5d79220a7daa95be76a8ac0616df93;hpb=31f6e1bd3b58c9a67e5ea0c2d372fbf5fc9e326d;p=linux-2.6-omap-h63xx.git diff --git a/fs/namei.c b/fs/namei.c index 5e2d98d10c5..a83160acd74 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -107,6 +107,8 @@ * any extra contention... */ +static int fastcall link_path_walk(const char *name, struct nameidata *nd); + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. @@ -998,7 +1000,7 @@ return_err: * Retry the whole path once, forcing real lookup requests * instead of relying on the dcache. */ -int fastcall link_path_walk(const char *name, struct nameidata *nd) +static int fastcall link_path_walk(const char *name, struct nameidata *nd) { struct nameidata save = *nd; int result; @@ -1022,7 +1024,7 @@ int fastcall link_path_walk(const char *name, struct nameidata *nd) return result; } -int fastcall path_walk(const char * name, struct nameidata *nd) +static int fastcall path_walk(const char * name, struct nameidata *nd) { current->total_link_count = 0; return link_path_walk(name, nd); @@ -1172,6 +1174,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) @@ -1576,7 +1609,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) /* O_NOATIME can only be set by the owner or superuser */ if (flag & O_NOATIME) - if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) + if (!is_owner_or_cap(inode)) return -EPERM; /* @@ -2774,8 +2807,8 @@ 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); EXPORT_SYMBOL(vfs_permission); EXPORT_SYMBOL(file_permission);