Blame view
include/linux/namei.h
2.49 KB
1da177e4c
|
1 2 |
#ifndef _LINUX_NAMEI_H #define _LINUX_NAMEI_H |
82b0547cf
|
3 |
#include <linux/dcache.h> |
1da177e4c
|
4 |
#include <linux/linkage.h> |
c5e725f33
|
5 |
#include <linux/path.h> |
1da177e4c
|
6 7 8 9 10 11 |
struct vfsmount; struct open_intent { int flags; int create_mode; |
834f2a4a1
|
12 |
struct file *file; |
1da177e4c
|
13 |
}; |
737bebd13
|
14 |
enum { MAX_NESTED_LINKS = 8 }; |
1da177e4c
|
15 16 |
struct nameidata { |
4ac913785
|
17 |
struct path path; |
1da177e4c
|
18 |
struct qstr last; |
2a7378711
|
19 |
struct path root; |
1da177e4c
|
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
unsigned int flags; int last_type; unsigned depth; char *saved_names[MAX_NESTED_LINKS + 1]; /* Intent data */ union { struct open_intent open; } intent; }; /* * Type of the last component on LOOKUP_PARENT */ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; /* * The bitmask for a lookup event: * - follow links at the end * - require a directory * - ending slashes ok even for nonexistent files |
47a0dfaad
|
41 |
* - internal "there are more path components" flag |
1da177e4c
|
42 43 44 45 46 47 48 |
* - locked when lookup done with dcache_lock held * - dentry cache is untrusted; force a real lookup */ #define LOOKUP_FOLLOW 1 #define LOOKUP_DIRECTORY 2 #define LOOKUP_CONTINUE 4 #define LOOKUP_PARENT 16 |
1da177e4c
|
49 50 51 52 |
#define LOOKUP_REVAL 64 /* * Intent data */ |
3516586a4
|
53 54 55 |
#define LOOKUP_OPEN 0x0100 #define LOOKUP_CREATE 0x0200 #define LOOKUP_EXCL 0x0400 |
4e9ed2f85
|
56 |
#define LOOKUP_RENAME_TARGET 0x0800 |
1da177e4c
|
57 |
|
2d8f30380
|
58 59 60 61 62 63 |
extern int user_path_at(int, const char __user *, unsigned, struct path *); #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) #define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) #define user_path_dir(name, path) \ user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) |
d18114657
|
64 |
extern int kern_path(const char *, unsigned, struct path *); |
b3c975286
|
65 |
extern int path_lookup(const char *, unsigned, struct nameidata *); |
16f182002
|
66 67 |
extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct nameidata *); |
1da177e4c
|
68 |
|
834f2a4a1
|
69 70 |
extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, int (*open)(struct inode *, struct file *)); |
834f2a4a1
|
71 |
|
eead19115
|
72 |
extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
1da177e4c
|
73 |
|
9393bd07c
|
74 |
extern int follow_down(struct path *); |
bab77ebf5
|
75 |
extern int follow_up(struct path *); |
1da177e4c
|
76 77 78 79 80 81 82 83 84 85 86 87 88 |
extern struct dentry *lock_rename(struct dentry *, struct dentry *); extern void unlock_rename(struct dentry *, struct dentry *); static inline void nd_set_link(struct nameidata *nd, char *path) { nd->saved_names[nd->depth] = path; } static inline char *nd_get_link(struct nameidata *nd) { return nd->saved_names[nd->depth]; } |
035146851
|
89 90 91 92 |
static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) { ((char *) name)[min(len, maxlen)] = '\0'; } |
1da177e4c
|
93 |
#endif /* _LINUX_NAMEI_H */ |