Commit d181146572c4fa9af2a068b967cb53dcac7da944
1 parent
2515ddc6db
Exists in
master
and in
4 other branches
[PATCH] new helper - kern_path()
Analog of lookup_path(), takes struct path *. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 2 changed files with 12 additions and 0 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -1106,6 +1106,15 @@ |
1106 | 1106 | return do_path_lookup(AT_FDCWD, name, flags, nd); |
1107 | 1107 | } |
1108 | 1108 | |
1109 | +int kern_path(const char *name, unsigned int flags, struct path *path) | |
1110 | +{ | |
1111 | + struct nameidata nd; | |
1112 | + int res = do_path_lookup(AT_FDCWD, name, flags, &nd); | |
1113 | + if (!res) | |
1114 | + *path = nd.path; | |
1115 | + return res; | |
1116 | +} | |
1117 | + | |
1109 | 1118 | /** |
1110 | 1119 | * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair |
1111 | 1120 | * @dentry: pointer to dentry of the base directory |
... | ... | @@ -2855,6 +2864,7 @@ |
2855 | 2864 | EXPORT_SYMBOL(page_symlink); |
2856 | 2865 | EXPORT_SYMBOL(page_symlink_inode_operations); |
2857 | 2866 | EXPORT_SYMBOL(path_lookup); |
2867 | +EXPORT_SYMBOL(kern_path); | |
2858 | 2868 | EXPORT_SYMBOL(vfs_path_lookup); |
2859 | 2869 | EXPORT_SYMBOL(inode_permission); |
2860 | 2870 | EXPORT_SYMBOL(vfs_permission); |
include/linux/namei.h
... | ... | @@ -61,6 +61,8 @@ |
61 | 61 | #define user_path_dir(name, path) \ |
62 | 62 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) |
63 | 63 | |
64 | +extern int kern_path(const char *, unsigned, struct path *); | |
65 | + | |
64 | 66 | extern int path_lookup(const char *, unsigned, struct nameidata *); |
65 | 67 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
66 | 68 | const char *, unsigned int, struct nameidata *); |