.. | .. |
---|
2 | 2 | #ifndef _LINUX_NAMEI_H |
---|
3 | 3 | #define _LINUX_NAMEI_H |
---|
4 | 4 | |
---|
| 5 | +#include <linux/fs.h> |
---|
5 | 6 | #include <linux/kernel.h> |
---|
6 | 7 | #include <linux/path.h> |
---|
7 | 8 | #include <linux/fcntl.h> |
---|
.. | .. |
---|
14 | 15 | /* |
---|
15 | 16 | * Type of the last component on LOOKUP_PARENT |
---|
16 | 17 | */ |
---|
17 | | -enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; |
---|
| 18 | +enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT}; |
---|
18 | 19 | |
---|
19 | | -/* |
---|
20 | | - * The bitmask for a lookup event: |
---|
21 | | - * - follow links at the end |
---|
22 | | - * - require a directory |
---|
23 | | - * - ending slashes ok even for nonexistent files |
---|
24 | | - * - internal "there are more path components" flag |
---|
25 | | - * - dentry cache is untrusted; force a real lookup |
---|
26 | | - * - suppress terminal automount |
---|
27 | | - */ |
---|
28 | | -#define LOOKUP_FOLLOW 0x0001 |
---|
29 | | -#define LOOKUP_DIRECTORY 0x0002 |
---|
30 | | -#define LOOKUP_AUTOMOUNT 0x0004 |
---|
| 20 | +/* pathwalk mode */ |
---|
| 21 | +#define LOOKUP_FOLLOW 0x0001 /* follow links at the end */ |
---|
| 22 | +#define LOOKUP_DIRECTORY 0x0002 /* require a directory */ |
---|
| 23 | +#define LOOKUP_AUTOMOUNT 0x0004 /* force terminal automount */ |
---|
| 24 | +#define LOOKUP_EMPTY 0x4000 /* accept empty path [user_... only] */ |
---|
| 25 | +#define LOOKUP_DOWN 0x8000 /* follow mounts in the starting point */ |
---|
| 26 | +#define LOOKUP_MOUNTPOINT 0x0080 /* follow mounts in the end */ |
---|
31 | 27 | |
---|
| 28 | +#define LOOKUP_REVAL 0x0020 /* tell ->d_revalidate() to trust no cache */ |
---|
| 29 | +#define LOOKUP_RCU 0x0040 /* RCU pathwalk mode; semi-internal */ |
---|
| 30 | + |
---|
| 31 | +/* These tell filesystem methods that we are dealing with the final component... */ |
---|
| 32 | +#define LOOKUP_OPEN 0x0100 /* ... in open */ |
---|
| 33 | +#define LOOKUP_CREATE 0x0200 /* ... in object creation */ |
---|
| 34 | +#define LOOKUP_EXCL 0x0400 /* ... in exclusive creation */ |
---|
| 35 | +#define LOOKUP_RENAME_TARGET 0x0800 /* ... in destination of rename() */ |
---|
| 36 | + |
---|
| 37 | +/* internal use only */ |
---|
32 | 38 | #define LOOKUP_PARENT 0x0010 |
---|
33 | | -#define LOOKUP_REVAL 0x0020 |
---|
34 | | -#define LOOKUP_RCU 0x0040 |
---|
35 | | -#define LOOKUP_NO_REVAL 0x0080 |
---|
36 | | - |
---|
37 | | -/* |
---|
38 | | - * Intent data |
---|
39 | | - */ |
---|
40 | | -#define LOOKUP_OPEN 0x0100 |
---|
41 | | -#define LOOKUP_CREATE 0x0200 |
---|
42 | | -#define LOOKUP_EXCL 0x0400 |
---|
43 | | -#define LOOKUP_RENAME_TARGET 0x0800 |
---|
44 | | - |
---|
45 | 39 | #define LOOKUP_JUMPED 0x1000 |
---|
46 | 40 | #define LOOKUP_ROOT 0x2000 |
---|
47 | | -#define LOOKUP_EMPTY 0x4000 |
---|
48 | | -#define LOOKUP_DOWN 0x8000 |
---|
| 41 | +#define LOOKUP_ROOT_GRABBED 0x0008 |
---|
| 42 | + |
---|
| 43 | +/* Scoping flags for lookup. */ |
---|
| 44 | +#define LOOKUP_NO_SYMLINKS 0x010000 /* No symlink crossing. */ |
---|
| 45 | +#define LOOKUP_NO_MAGICLINKS 0x020000 /* No nd_jump_link() crossing. */ |
---|
| 46 | +#define LOOKUP_NO_XDEV 0x040000 /* No mountpoint crossing. */ |
---|
| 47 | +#define LOOKUP_BENEATH 0x080000 /* No escaping from starting point. */ |
---|
| 48 | +#define LOOKUP_IN_ROOT 0x100000 /* Treat dirfd as fs root. */ |
---|
| 49 | +#define LOOKUP_CACHED 0x200000 /* Only do cached lookup */ |
---|
| 50 | +/* LOOKUP_* flags which do scope-related checks based on the dirfd. */ |
---|
| 51 | +#define LOOKUP_IS_SCOPED (LOOKUP_BENEATH | LOOKUP_IN_ROOT) |
---|
49 | 52 | |
---|
50 | 53 | extern int path_pts(struct path *path); |
---|
51 | 54 | |
---|
.. | .. |
---|
57 | 60 | return user_path_at_empty(dfd, name, flags, path, NULL); |
---|
58 | 61 | } |
---|
59 | 62 | |
---|
60 | | -static inline int user_path(const char __user *name, struct path *path) |
---|
61 | | -{ |
---|
62 | | - return user_path_at_empty(AT_FDCWD, name, LOOKUP_FOLLOW, path, NULL); |
---|
63 | | -} |
---|
64 | | - |
---|
65 | | -static inline int user_lpath(const char __user *name, struct path *path) |
---|
66 | | -{ |
---|
67 | | - return user_path_at_empty(AT_FDCWD, name, 0, path, NULL); |
---|
68 | | -} |
---|
69 | | - |
---|
70 | | -static inline int user_path_dir(const char __user *name, struct path *path) |
---|
71 | | -{ |
---|
72 | | - return user_path_at_empty(AT_FDCWD, name, |
---|
73 | | - LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path, NULL); |
---|
74 | | -} |
---|
75 | | - |
---|
76 | 63 | extern int kern_path(const char *, unsigned, struct path *); |
---|
77 | 64 | |
---|
78 | 65 | extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int); |
---|
79 | 66 | extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); |
---|
80 | 67 | extern void done_path_create(struct path *, struct dentry *); |
---|
81 | 68 | extern struct dentry *kern_path_locked(const char *, struct path *); |
---|
82 | | -extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
---|
83 | | - const char *, unsigned int, struct path *); |
---|
84 | | -extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); |
---|
85 | 69 | |
---|
86 | 70 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); |
---|
87 | 71 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
---|
88 | | -extern struct dentry *lookup_one_len2(const char *, struct vfsmount *mnt, struct dentry *, int); |
---|
89 | 72 | extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); |
---|
| 73 | +extern struct dentry *lookup_positive_unlocked(const char *, struct dentry *, int); |
---|
90 | 74 | |
---|
91 | 75 | extern int follow_down_one(struct path *); |
---|
92 | 76 | extern int follow_down(struct path *); |
---|
.. | .. |
---|
95 | 79 | extern struct dentry *lock_rename(struct dentry *, struct dentry *); |
---|
96 | 80 | extern void unlock_rename(struct dentry *, struct dentry *); |
---|
97 | 81 | |
---|
98 | | -extern void nd_jump_link(struct path *path); |
---|
| 82 | +extern int __must_check nd_jump_link(struct path *path); |
---|
99 | 83 | |
---|
100 | 84 | static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) |
---|
101 | 85 | { |
---|