Blame view

include/linux/namei.h 2.49 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_NAMEI_H
  #define _LINUX_NAMEI_H
82b0547cf   Alexey Dobriyan   [PATCH] Create fs...
3
  #include <linux/dcache.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
  #include <linux/linkage.h>
c5e725f33   Jan Blunck   Move struct path ...
5
  #include <linux/path.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
9
10
11
  
  struct vfsmount;
  
  struct open_intent {
  	int	flags;
  	int	create_mode;
834f2a4a1   Trond Myklebust   VFS: Allow the fi...
12
  	struct file *file;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  };
737bebd13   Al Viro   [PATCH] symlink n...
14
  enum { MAX_NESTED_LINKS = 8 };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
  
  struct nameidata {
4ac913785   Jan Blunck   Embed a struct pa...
17
  	struct path	path;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
  	struct qstr	last;
2a7378711   Al Viro   Cache root in nam...
19
  	struct path	root;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Ori Avtalion   trivial: fix typo...
41
   *  - internal "there are more path components" flag
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Linus Torvalds   Linux-2.6.12-rc2
49
50
51
52
  #define LOOKUP_REVAL		64
  /*
   * Intent data
   */
3516586a4   Al Viro   [PATCH] make O_EX...
53
54
55
  #define LOOKUP_OPEN		0x0100
  #define LOOKUP_CREATE		0x0200
  #define LOOKUP_EXCL		0x0400
4e9ed2f85   OGAWA Hirofumi   [PATCH vfs-2.6 6/...
56
  #define LOOKUP_RENAME_TARGET	0x0800
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57

2d8f30380   Al Viro   [PATCH] sanitize ...
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   Al Viro   [PATCH] new helpe...
64
  extern int kern_path(const char *, unsigned, struct path *);
b3c975286   Harvey Harrison   include/linux: Re...
65
  extern int path_lookup(const char *, unsigned, struct nameidata *);
16f182002   Josef 'Jeff' Sipek   fs: introduce vfs...
66
67
  extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
  			   const char *, unsigned int, struct nameidata *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68

834f2a4a1   Trond Myklebust   VFS: Allow the fi...
69
70
  extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
  		int (*open)(struct inode *, struct file *));
834f2a4a1   Trond Myklebust   VFS: Allow the fi...
71

eead19115   Christoph Hellwig   partially fix up ...
72
  extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73

9393bd07c   Al Viro   switch follow_down()
74
  extern int follow_down(struct path *);
bab77ebf5   Al Viro   switch follow_up(...
75
  extern int follow_up(struct path *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Duane Griffin   vfs: introduce he...
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   Linus Torvalds   Linux-2.6.12-rc2
93
  #endif /* _LINUX_NAMEI_H */