Commit 1f55a6ec940fb45e3edaa52b6e9fc40cf8e18dcb

Authored by Al Viro
1 parent 707c5960f1

make nameidata completely opaque outside of fs/namei.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 2 changed files with 27 additions and 22 deletions Side-by-side Diff

... ... @@ -487,6 +487,18 @@
487 487 }
488 488 EXPORT_SYMBOL(path_put);
489 489  
  490 +struct nameidata {
  491 + struct path path;
  492 + struct qstr last;
  493 + struct path root;
  494 + struct inode *inode; /* path.dentry.d_inode */
  495 + unsigned int flags;
  496 + unsigned seq, m_seq;
  497 + int last_type;
  498 + unsigned depth;
  499 + char *saved_names[MAX_NESTED_LINKS + 1];
  500 +};
  501 +
490 502 /*
491 503 * Path walking has 2 modes, rcu-walk and ref-walk (see
492 504 * Documentation/filesystems/path-lookup.txt). In situations when we can't
... ... @@ -694,6 +706,18 @@
694 706 nd->inode = nd->path.dentry->d_inode;
695 707 nd->flags |= LOOKUP_JUMPED;
696 708 }
  709 +
  710 +void nd_set_link(struct nameidata *nd, char *path)
  711 +{
  712 + nd->saved_names[nd->depth] = path;
  713 +}
  714 +EXPORT_SYMBOL(nd_set_link);
  715 +
  716 +char *nd_get_link(struct nameidata *nd)
  717 +{
  718 + return nd->saved_names[nd->depth];
  719 +}
  720 +EXPORT_SYMBOL(nd_get_link);
697 721  
698 722 static inline void put_link(struct nameidata *nd, struct path *link, void *cookie)
699 723 {
include/linux/namei.h
... ... @@ -7,21 +7,10 @@
7 7 #include <linux/path.h>
8 8  
9 9 struct vfsmount;
  10 +struct nameidata;
10 11  
11 12 enum { MAX_NESTED_LINKS = 8 };
12 13  
13   -struct nameidata {
14   - struct path path;
15   - struct qstr last;
16   - struct path root;
17   - struct inode *inode; /* path.dentry.d_inode */
18   - unsigned int flags;
19   - unsigned seq, m_seq;
20   - int last_type;
21   - unsigned depth;
22   - char *saved_names[MAX_NESTED_LINKS + 1];
23   -};
24   -
25 14 /*
26 15 * Type of the last component on LOOKUP_PARENT
27 16 */
... ... @@ -82,16 +71,8 @@
82 71 extern void unlock_rename(struct dentry *, struct dentry *);
83 72  
84 73 extern void nd_jump_link(struct nameidata *nd, struct path *path);
85   -
86   -static inline void nd_set_link(struct nameidata *nd, char *path)
87   -{
88   - nd->saved_names[nd->depth] = path;
89   -}
90   -
91   -static inline char *nd_get_link(struct nameidata *nd)
92   -{
93   - return nd->saved_names[nd->depth];
94   -}
  74 +extern void nd_set_link(struct nameidata *nd, char *path);
  75 +extern char *nd_get_link(struct nameidata *nd);
95 76  
96 77 static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
97 78 {