ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / namei.h
1 #ifndef _LINUX_NAMEI_H
2 #define _LINUX_NAMEI_H
3
4 #include <linux/linkage.h>
5
6 struct vfsmount;
7
8 struct open_intent {
9         int     flags;
10         int     create_mode;
11 };
12
13 struct nameidata {
14         struct dentry   *dentry;
15         struct vfsmount *mnt;
16         struct qstr     last;
17         unsigned int    flags;
18         int             last_type;
19
20         /* Intent data */
21         union {
22                 struct open_intent open;
23         } intent;
24 };
25
26 /*
27  * Type of the last component on LOOKUP_PARENT
28  */
29 enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
30
31 /*
32  * The bitmask for a lookup event:
33  *  - follow links at the end
34  *  - require a directory
35  *  - ending slashes ok even for nonexistent files
36  *  - internal "there are more path compnents" flag
37  *  - locked when lookup done with dcache_lock held
38  */
39 #define LOOKUP_FOLLOW            1
40 #define LOOKUP_DIRECTORY         2
41 #define LOOKUP_CONTINUE          4
42 #define LOOKUP_PARENT           16
43 #define LOOKUP_NOALT            32
44 /*
45  * Intent data
46  */
47 #define LOOKUP_OPEN             (0x0100)
48 #define LOOKUP_CREATE           (0x0200)
49 #define LOOKUP_ACCESS           (0x0400)
50
51 extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
52 #define user_path_walk(name,nd) \
53         __user_walk(name, LOOKUP_FOLLOW, nd)
54 #define user_path_walk_link(name,nd) \
55         __user_walk(name, 0, nd)
56 extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
57 extern int FASTCALL(path_walk(const char *, struct nameidata *));
58 extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
59 extern void path_release(struct nameidata *);
60
61 extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
62 extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
63
64 extern int follow_down(struct vfsmount **, struct dentry **);
65 extern int follow_up(struct vfsmount **, struct dentry **);
66
67 extern struct dentry *lock_rename(struct dentry *, struct dentry *);
68 extern void unlock_rename(struct dentry *, struct dentry *);
69
70 #endif /* _LINUX_NAMEI_H */