Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

make nameidata completely opaque outside of fs/namei.c

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

Al Viro 1f55a6ec 707c5960

+27 -22
+24
fs/namei.c
··· 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 ··· 706 694 nd->inode = nd->path.dentry->d_inode; 707 695 nd->flags |= LOOKUP_JUMPED; 708 696 } 697 + 698 + void nd_set_link(struct nameidata *nd, char *path) 699 + { 700 + nd->saved_names[nd->depth] = path; 701 + } 702 + EXPORT_SYMBOL(nd_set_link); 703 + 704 + char *nd_get_link(struct nameidata *nd) 705 + { 706 + return nd->saved_names[nd->depth]; 707 + } 708 + EXPORT_SYMBOL(nd_get_link); 709 709 710 710 static inline void put_link(struct nameidata *nd, struct path *link, void *cookie) 711 711 {
+3 -22
include/linux/namei.h
··· 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 - 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 13 25 14 /* 26 15 * Type of the last component on LOOKUP_PARENT ··· 71 82 extern void unlock_rename(struct dentry *, struct dentry *); 72 83 73 84 extern void nd_jump_link(struct nameidata *nd, struct path *path); 74 - 75 - static inline void nd_set_link(struct nameidata *nd, char *path) 76 - { 77 - nd->saved_names[nd->depth] = path; 78 - } 79 - 80 - static inline char *nd_get_link(struct nameidata *nd) 81 - { 82 - return nd->saved_names[nd->depth]; 83 - } 85 + extern void nd_set_link(struct nameidata *nd, char *path); 86 + extern char *nd_get_link(struct nameidata *nd); 84 87 85 88 static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) 86 89 {