Searched refs:dentry (Results 1 - 200 of 1190) sorted by relevance

123456

/linux-4.1.27/fs/overlayfs/
H A Doverlayfs.h30 static inline int ovl_do_rmdir(struct inode *dir, struct dentry *dentry) ovl_do_rmdir() argument
32 int err = vfs_rmdir(dir, dentry); ovl_do_rmdir()
33 pr_debug("rmdir(%pd2) = %i\n", dentry, err); ovl_do_rmdir()
37 static inline int ovl_do_unlink(struct inode *dir, struct dentry *dentry) ovl_do_unlink() argument
39 int err = vfs_unlink(dir, dentry, NULL); ovl_do_unlink()
40 pr_debug("unlink(%pd2) = %i\n", dentry, err); ovl_do_unlink()
44 static inline int ovl_do_link(struct dentry *old_dentry, struct inode *dir, ovl_do_link()
45 struct dentry *new_dentry, bool debug) ovl_do_link()
55 static inline int ovl_do_create(struct inode *dir, struct dentry *dentry, ovl_do_create() argument
58 int err = vfs_create(dir, dentry, mode, true); ovl_do_create()
60 pr_debug("create(%pd2, 0%o) = %i\n", dentry, mode, err); ovl_do_create()
64 static inline int ovl_do_mkdir(struct inode *dir, struct dentry *dentry, ovl_do_mkdir() argument
67 int err = vfs_mkdir(dir, dentry, mode); ovl_do_mkdir()
69 pr_debug("mkdir(%pd2, 0%o) = %i\n", dentry, mode, err); ovl_do_mkdir()
73 static inline int ovl_do_mknod(struct inode *dir, struct dentry *dentry, ovl_do_mknod() argument
76 int err = vfs_mknod(dir, dentry, mode, dev); ovl_do_mknod()
79 dentry, mode, dev, err); ovl_do_mknod()
84 static inline int ovl_do_symlink(struct inode *dir, struct dentry *dentry, ovl_do_symlink() argument
87 int err = vfs_symlink(dir, dentry, oldname); ovl_do_symlink()
89 pr_debug("symlink(\"%s\", %pd2) = %i\n", oldname, dentry, err); ovl_do_symlink()
93 static inline int ovl_do_setxattr(struct dentry *dentry, const char *name, ovl_do_setxattr() argument
96 int err = vfs_setxattr(dentry, name, value, size, flags); ovl_do_setxattr()
98 dentry, name, (int) size, (char *) value, flags, err); ovl_do_setxattr()
102 static inline int ovl_do_removexattr(struct dentry *dentry, const char *name) ovl_do_removexattr() argument
104 int err = vfs_removexattr(dentry, name); ovl_do_removexattr()
105 pr_debug("removexattr(%pd2, \"%s\") = %i\n", dentry, name, err); ovl_do_removexattr()
109 static inline int ovl_do_rename(struct inode *olddir, struct dentry *olddentry, ovl_do_rename()
110 struct inode *newdir, struct dentry *newdentry, ovl_do_rename()
127 static inline int ovl_do_whiteout(struct inode *dir, struct dentry *dentry) ovl_do_whiteout() argument
129 int err = vfs_whiteout(dir, dentry); ovl_do_whiteout()
130 pr_debug("whiteout(%pd2) = %i\n", dentry, err); ovl_do_whiteout()
134 enum ovl_path_type ovl_path_type(struct dentry *dentry);
135 u64 ovl_dentry_version_get(struct dentry *dentry);
136 void ovl_dentry_version_inc(struct dentry *dentry);
137 void ovl_path_upper(struct dentry *dentry, struct path *path);
138 void ovl_path_lower(struct dentry *dentry, struct path *path);
139 enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
140 int ovl_path_next(int idx, struct dentry *dentry, struct path *path);
141 struct dentry *ovl_dentry_upper(struct dentry *dentry);
142 struct dentry *ovl_dentry_lower(struct dentry *dentry);
143 struct dentry *ovl_dentry_real(struct dentry *dentry);
144 struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper);
145 struct ovl_dir_cache *ovl_dir_cache(struct dentry *dentry);
146 void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache);
147 struct dentry *ovl_workdir(struct dentry *dentry);
148 int ovl_want_write(struct dentry *dentry);
149 void ovl_drop_write(struct dentry *dentry);
150 bool ovl_dentry_is_opaque(struct dentry *dentry);
151 void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque);
152 bool ovl_is_whiteout(struct dentry *dentry);
153 void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry);
154 struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
158 struct dentry *ovl_upper_create(struct dentry *upperdir, struct dentry *dentry,
163 int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list);
164 void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list);
168 int ovl_setattr(struct dentry *dentry, struct iattr *attr);
170 int ovl_setxattr(struct dentry *dentry, const char *name,
172 ssize_t ovl_getxattr(struct dentry *dentry, const char *name,
174 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
175 int ovl_removexattr(struct dentry *dentry, const char *name);
176 struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags);
188 struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry);
189 int ovl_create_real(struct inode *dir, struct dentry *newdentry,
191 struct dentry *hardlink, bool debug);
192 void ovl_cleanup(struct inode *dir, struct dentry *dentry);
195 int ovl_copy_up(struct dentry *dentry);
196 int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
199 int ovl_copy_xattr(struct dentry *old, struct dentry *new);
200 int ovl_set_attr(struct dentry *upper, struct kstat *stat);
H A Ddir.c17 void ovl_cleanup(struct inode *wdir, struct dentry *wdentry) ovl_cleanup()
34 struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry) ovl_lookup_temp() argument
36 struct dentry *temp; ovl_lookup_temp()
39 snprintf(name, sizeof(name), "#%lx", (unsigned long) dentry); ovl_lookup_temp()
52 static struct dentry *ovl_whiteout(struct dentry *workdir, ovl_whiteout() argument
53 struct dentry *dentry) ovl_whiteout()
56 struct dentry *whiteout; ovl_whiteout()
59 whiteout = ovl_lookup_temp(workdir, dentry); ovl_whiteout()
72 int ovl_create_real(struct inode *dir, struct dentry *newdentry, ovl_create_real()
74 struct dentry *hardlink, bool debug) ovl_create_real()
111 * Not quite sure if non-instantiated dentry is legal or not. ovl_create_real()
119 static int ovl_set_opaque(struct dentry *upperdentry) ovl_set_opaque()
124 static void ovl_remove_opaque(struct dentry *upperdentry) ovl_remove_opaque()
135 static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry, ovl_dir_getattr() argument
142 type = ovl_path_real(dentry, &realpath); ovl_dir_getattr()
147 stat->dev = dentry->d_sb->s_dev; ovl_dir_getattr()
148 stat->ino = dentry->d_inode->i_ino; ovl_dir_getattr()
161 static int ovl_create_upper(struct dentry *dentry, struct inode *inode, ovl_create_upper() argument
163 struct dentry *hardlink) ovl_create_upper()
165 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); ovl_create_upper()
167 struct dentry *newdentry; ovl_create_upper()
171 newdentry = lookup_one_len(dentry->d_name.name, upperdir, ovl_create_upper()
172 dentry->d_name.len); ovl_create_upper()
180 ovl_dentry_version_inc(dentry->d_parent); ovl_create_upper()
181 ovl_dentry_update(dentry, newdentry); ovl_create_upper()
183 d_instantiate(dentry, inode); ovl_create_upper()
192 static int ovl_lock_rename_workdir(struct dentry *workdir, ovl_lock_rename_workdir()
193 struct dentry *upperdir) ovl_lock_rename_workdir()
212 static struct dentry *ovl_clear_empty(struct dentry *dentry, ovl_clear_empty() argument
215 struct dentry *workdir = ovl_workdir(dentry); ovl_clear_empty()
217 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); ovl_clear_empty()
220 struct dentry *upper; ovl_clear_empty()
221 struct dentry *opaquedir; ovl_clear_empty()
232 ovl_path_upper(dentry, &upperpath); ovl_clear_empty()
240 upper = upperpath.dentry; ovl_clear_empty()
244 opaquedir = ovl_lookup_temp(workdir, dentry); ovl_clear_empty()
275 /* dentry's upper doesn't match now, get rid of it */ ovl_clear_empty()
276 d_drop(dentry); ovl_clear_empty()
290 static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry) ovl_check_empty_and_clear() argument
293 struct dentry *ret = NULL; ovl_check_empty_and_clear()
296 err = ovl_check_empty_dir(dentry, &list); ovl_check_empty_and_clear()
307 if (ovl_dentry_upper(dentry)) ovl_check_empty_and_clear()
308 ret = ovl_clear_empty(dentry, &list); ovl_check_empty_and_clear()
316 static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, ovl_create_over_whiteout() argument
318 struct dentry *hardlink) ovl_create_over_whiteout()
320 struct dentry *workdir = ovl_workdir(dentry); ovl_create_over_whiteout()
322 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); ovl_create_over_whiteout()
324 struct dentry *upper; ovl_create_over_whiteout()
325 struct dentry *newdentry; ovl_create_over_whiteout()
335 newdentry = ovl_lookup_temp(workdir, dentry); ovl_create_over_whiteout()
340 upper = lookup_one_len(dentry->d_name.name, upperdir, ovl_create_over_whiteout()
341 dentry->d_name.len); ovl_create_over_whiteout()
366 ovl_dentry_version_inc(dentry->d_parent); ovl_create_over_whiteout()
367 ovl_dentry_update(dentry, newdentry); ovl_create_over_whiteout()
369 d_instantiate(dentry, inode); ovl_create_over_whiteout()
385 static int ovl_create_or_link(struct dentry *dentry, int mode, dev_t rdev, ovl_create_or_link() argument
386 const char *link, struct dentry *hardlink) ovl_create_or_link()
396 inode = ovl_new_inode(dentry->d_sb, mode, dentry->d_fsdata); ovl_create_or_link()
400 err = ovl_copy_up(dentry->d_parent); ovl_create_or_link()
404 if (!ovl_dentry_is_opaque(dentry)) { ovl_create_or_link()
405 err = ovl_create_upper(dentry, inode, &stat, link, hardlink); ovl_create_or_link()
425 err = ovl_create_over_whiteout(dentry, inode, &stat, link, ovl_create_or_link()
440 static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, ovl_create_object() argument
445 err = ovl_want_write(dentry); ovl_create_object()
447 err = ovl_create_or_link(dentry, mode, rdev, link, NULL); ovl_create_object()
448 ovl_drop_write(dentry); ovl_create_object()
454 static int ovl_create(struct inode *dir, struct dentry *dentry, umode_t mode, ovl_create() argument
457 return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); ovl_create()
460 static int ovl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ovl_mkdir() argument
462 return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL); ovl_mkdir()
465 static int ovl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ovl_mknod() argument
472 return ovl_create_object(dentry, mode, rdev, NULL); ovl_mknod()
475 static int ovl_symlink(struct inode *dir, struct dentry *dentry, ovl_symlink() argument
478 return ovl_create_object(dentry, S_IFLNK, 0, link); ovl_symlink()
481 static int ovl_link(struct dentry *old, struct inode *newdir, ovl_link()
482 struct dentry *new) ovl_link()
485 struct dentry *upper; ovl_link()
504 static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) ovl_remove_and_whiteout() argument
506 struct dentry *workdir = ovl_workdir(dentry); ovl_remove_and_whiteout()
508 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); ovl_remove_and_whiteout()
510 struct dentry *whiteout; ovl_remove_and_whiteout()
511 struct dentry *upper; ovl_remove_and_whiteout()
512 struct dentry *opaquedir = NULL; ovl_remove_and_whiteout()
519 if (OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { ovl_remove_and_whiteout()
520 opaquedir = ovl_check_empty_and_clear(dentry); ovl_remove_and_whiteout()
532 err = ovl_check_empty_dir(dentry, &list); ovl_remove_and_whiteout()
543 whiteout = ovl_whiteout(workdir, dentry); ovl_remove_and_whiteout()
548 upper = ovl_dentry_upper(dentry); ovl_remove_and_whiteout()
550 upper = lookup_one_len(dentry->d_name.name, upperdir, ovl_remove_and_whiteout()
551 dentry->d_name.len); ovl_remove_and_whiteout()
579 ovl_dentry_version_inc(dentry->d_parent); ovl_remove_and_whiteout()
581 d_drop(dentry); ovl_remove_and_whiteout()
595 static int ovl_remove_upper(struct dentry *dentry, bool is_dir) ovl_remove_upper() argument
597 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); ovl_remove_upper()
599 struct dentry *upper = ovl_dentry_upper(dentry); ovl_remove_upper()
612 ovl_dentry_version_inc(dentry->d_parent); ovl_remove_upper()
616 * Keeping this dentry hashed would mean having to release ovl_remove_upper()
618 * sole user of this dentry. Too tricky... Just unhash for ovl_remove_upper()
622 d_drop(dentry); ovl_remove_upper()
628 static inline int ovl_check_sticky(struct dentry *dentry) ovl_check_sticky() argument
630 struct inode *dir = ovl_dentry_real(dentry->d_parent)->d_inode; ovl_check_sticky()
631 struct inode *inode = ovl_dentry_real(dentry)->d_inode; ovl_check_sticky()
639 static int ovl_do_remove(struct dentry *dentry, bool is_dir) ovl_do_remove() argument
644 err = ovl_check_sticky(dentry); ovl_do_remove()
648 err = ovl_want_write(dentry); ovl_do_remove()
652 err = ovl_copy_up(dentry->d_parent); ovl_do_remove()
656 type = ovl_path_type(dentry); ovl_do_remove()
658 err = ovl_remove_upper(dentry, is_dir); ovl_do_remove()
682 err = ovl_remove_and_whiteout(dentry, is_dir); ovl_do_remove()
688 ovl_drop_write(dentry); ovl_do_remove()
693 static int ovl_unlink(struct inode *dir, struct dentry *dentry) ovl_unlink() argument
695 return ovl_do_remove(dentry, false); ovl_unlink()
698 static int ovl_rmdir(struct inode *dir, struct dentry *dentry) ovl_rmdir() argument
700 return ovl_do_remove(dentry, true); ovl_rmdir()
703 static int ovl_rename2(struct inode *olddir, struct dentry *old, ovl_rename2()
704 struct inode *newdir, struct dentry *new, ovl_rename2()
710 struct dentry *old_upperdir; ovl_rename2()
711 struct dentry *new_upperdir; ovl_rename2()
712 struct dentry *olddentry; ovl_rename2()
713 struct dentry *newdentry; ovl_rename2()
714 struct dentry *trap; ovl_rename2()
722 struct dentry *opaquedir = NULL; ovl_rename2()
908 * Old dentry now lives in different location. Dentries in ovl_rename2()
H A Dinode.c15 static int ovl_copy_up_last(struct dentry *dentry, struct iattr *attr, ovl_copy_up_last() argument
19 struct dentry *parent; ovl_copy_up_last()
23 parent = dget_parent(dentry); ovl_copy_up_last()
28 ovl_path_lower(dentry, &lowerpath); ovl_copy_up_last()
36 err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat, attr); ovl_copy_up_last()
43 int ovl_setattr(struct dentry *dentry, struct iattr *attr) ovl_setattr() argument
46 struct dentry *upperdentry; ovl_setattr()
50 * since it will be rechecked later by ->setattr() on upper dentry. But ovl_setattr()
57 err = inode_change_ok(dentry->d_inode, attr); ovl_setattr()
61 err = ovl_want_write(dentry); ovl_setattr()
65 err = ovl_copy_up(dentry); ovl_setattr()
67 upperdentry = ovl_dentry_upper(dentry); ovl_setattr()
72 ovl_copyattr(upperdentry->d_inode, dentry->d_inode); ovl_setattr()
75 ovl_drop_write(dentry); ovl_setattr()
80 static int ovl_getattr(struct vfsmount *mnt, struct dentry *dentry, ovl_getattr() argument
85 ovl_path_real(dentry, &realpath); ovl_getattr()
92 struct dentry *alias = NULL; ovl_permission()
94 struct dentry *realdentry; ovl_permission()
154 struct dentry *realdentry;
158 static void *ovl_follow_link(struct dentry *dentry, struct nameidata *nd) ovl_follow_link() argument
161 struct dentry *realdentry; ovl_follow_link()
164 realdentry = ovl_dentry_real(dentry); ovl_follow_link()
191 static void ovl_put_link(struct dentry *dentry, struct nameidata *nd, void *c) ovl_put_link() argument
204 static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) ovl_readlink() argument
209 ovl_path_real(dentry, &realpath); ovl_readlink()
210 realinode = realpath.dentry->d_inode; ovl_readlink()
217 return realinode->i_op->readlink(realpath.dentry, buf, bufsiz); ovl_readlink()
226 int ovl_setxattr(struct dentry *dentry, const char *name, ovl_setxattr() argument
230 struct dentry *upperdentry; ovl_setxattr()
232 err = ovl_want_write(dentry); ovl_setxattr()
240 err = ovl_copy_up(dentry); ovl_setxattr()
244 upperdentry = ovl_dentry_upper(dentry); ovl_setxattr()
248 ovl_drop_write(dentry); ovl_setxattr()
253 static bool ovl_need_xattr_filter(struct dentry *dentry, ovl_need_xattr_filter() argument
257 return S_ISDIR(dentry->d_inode->i_mode); ovl_need_xattr_filter()
262 ssize_t ovl_getxattr(struct dentry *dentry, const char *name, ovl_getxattr() argument
266 enum ovl_path_type type = ovl_path_real(dentry, &realpath); ovl_getxattr()
268 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) ovl_getxattr()
271 return vfs_getxattr(realpath.dentry, name, value, size); ovl_getxattr()
274 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) ovl_listxattr() argument
277 enum ovl_path_type type = ovl_path_real(dentry, &realpath); ovl_listxattr()
281 res = vfs_listxattr(realpath.dentry, list, size); ovl_listxattr()
285 if (!ovl_need_xattr_filter(dentry, type)) ovl_listxattr()
306 int ovl_removexattr(struct dentry *dentry, const char *name) ovl_removexattr() argument
310 enum ovl_path_type type = ovl_path_real(dentry, &realpath); ovl_removexattr()
312 err = ovl_want_write(dentry); ovl_removexattr()
317 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) ovl_removexattr()
321 err = vfs_getxattr(realpath.dentry, name, NULL, 0); ovl_removexattr()
325 err = ovl_copy_up(dentry); ovl_removexattr()
329 ovl_path_upper(dentry, &realpath); ovl_removexattr()
332 err = vfs_removexattr(realpath.dentry, name); ovl_removexattr()
334 ovl_drop_write(dentry); ovl_removexattr()
340 struct dentry *realdentry) ovl_open_need_copy_up()
354 struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) ovl_d_select_inode() argument
360 if (d_is_dir(dentry)) ovl_d_select_inode()
361 return d_backing_inode(dentry); ovl_d_select_inode()
363 type = ovl_path_real(dentry, &realpath); ovl_d_select_inode()
364 if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) { ovl_d_select_inode()
365 err = ovl_want_write(dentry); ovl_d_select_inode()
370 err = ovl_copy_up_last(dentry, NULL, true); ovl_d_select_inode()
372 err = ovl_copy_up(dentry); ovl_d_select_inode()
373 ovl_drop_write(dentry); ovl_d_select_inode()
377 ovl_path_upper(dentry, &realpath); ovl_d_select_inode()
380 return d_backing_inode(realpath.dentry); ovl_d_select_inode()
H A Dsuper.c41 struct dentry *workdir;
49 /* private information held for every overlayfs dentry */
51 struct dentry *__upperdentry;
66 static struct dentry *__ovl_dentry_lower(struct ovl_entry *oe) __ovl_dentry_lower()
68 return oe->numlower ? oe->lowerstack[0].dentry : NULL; __ovl_dentry_lower()
71 enum ovl_path_type ovl_path_type(struct dentry *dentry) ovl_path_type() argument
73 struct ovl_entry *oe = dentry->d_fsdata; ovl_path_type()
80 * Non-dir dentry can hold lower dentry from previous ovl_path_type()
83 if (oe->numlower && S_ISDIR(dentry->d_inode->i_mode)) ovl_path_type()
94 static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) ovl_upperdentry_dereference()
99 void ovl_path_upper(struct dentry *dentry, struct path *path) ovl_path_upper() argument
101 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; ovl_path_upper()
102 struct ovl_entry *oe = dentry->d_fsdata; ovl_path_upper()
105 path->dentry = ovl_upperdentry_dereference(oe); ovl_path_upper()
108 enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path) ovl_path_real() argument
110 enum ovl_path_type type = ovl_path_type(dentry); ovl_path_real()
113 ovl_path_lower(dentry, path); ovl_path_real()
115 ovl_path_upper(dentry, path); ovl_path_real()
120 struct dentry *ovl_dentry_upper(struct dentry *dentry) ovl_dentry_upper() argument
122 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_upper()
127 struct dentry *ovl_dentry_lower(struct dentry *dentry) ovl_dentry_lower() argument
129 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_lower()
134 struct dentry *ovl_dentry_real(struct dentry *dentry) ovl_dentry_real() argument
136 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_real()
137 struct dentry *realdentry; ovl_dentry_real()
146 struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper) ovl_entry_real()
148 struct dentry *realdentry; ovl_entry_real()
160 struct ovl_dir_cache *ovl_dir_cache(struct dentry *dentry) ovl_dir_cache() argument
162 struct ovl_entry *oe = dentry->d_fsdata; ovl_dir_cache()
167 void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache) ovl_set_dir_cache() argument
169 struct ovl_entry *oe = dentry->d_fsdata; ovl_set_dir_cache()
174 void ovl_path_lower(struct dentry *dentry, struct path *path) ovl_path_lower() argument
176 struct ovl_entry *oe = dentry->d_fsdata; ovl_path_lower()
181 int ovl_want_write(struct dentry *dentry) ovl_want_write() argument
183 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; ovl_want_write()
187 void ovl_drop_write(struct dentry *dentry) ovl_drop_write() argument
189 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; ovl_drop_write()
193 struct dentry *ovl_workdir(struct dentry *dentry) ovl_workdir() argument
195 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; ovl_workdir()
199 bool ovl_dentry_is_opaque(struct dentry *dentry) ovl_dentry_is_opaque() argument
201 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_is_opaque()
205 void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque) ovl_dentry_set_opaque() argument
207 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_set_opaque()
211 void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry) ovl_dentry_update() argument
213 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_update()
226 void ovl_dentry_version_inc(struct dentry *dentry) ovl_dentry_version_inc() argument
228 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_version_inc()
230 WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); ovl_dentry_version_inc()
234 u64 ovl_dentry_version_get(struct dentry *dentry) ovl_dentry_version_get() argument
236 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_version_get()
238 WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); ovl_dentry_version_get()
242 bool ovl_is_whiteout(struct dentry *dentry) ovl_is_whiteout() argument
244 struct inode *inode = dentry->d_inode; ovl_is_whiteout()
249 static bool ovl_is_opaquedir(struct dentry *dentry) ovl_is_opaquedir() argument
253 struct inode *inode = dentry->d_inode; ovl_is_opaquedir()
258 res = inode->i_op->getxattr(dentry, OVL_XATTR_OPAQUE, &val, 1); ovl_is_opaquedir()
265 static void ovl_dentry_release(struct dentry *dentry) ovl_dentry_release() argument
267 struct ovl_entry *oe = dentry->d_fsdata; ovl_dentry_release()
274 dput(oe->lowerstack[i].dentry); ovl_dentry_release()
295 static inline struct dentry *ovl_lookup_real(struct dentry *dir, ovl_lookup_real()
298 struct dentry *dentry; ovl_lookup_real() local
301 dentry = lookup_one_len(name->name, dir, name->len); ovl_lookup_real()
304 if (IS_ERR(dentry)) { ovl_lookup_real()
305 if (PTR_ERR(dentry) == -ENOENT) ovl_lookup_real()
306 dentry = NULL; ovl_lookup_real()
307 } else if (!dentry->d_inode) { ovl_lookup_real()
308 dput(dentry); ovl_lookup_real()
309 dentry = NULL; ovl_lookup_real()
311 return dentry; ovl_lookup_real()
318 int ovl_path_next(int idx, struct dentry *dentry, struct path *path) ovl_path_next() argument
320 struct ovl_entry *oe = dentry->d_fsdata; ovl_path_next()
324 ovl_path_upper(dentry, path); ovl_path_next()
325 if (path->dentry) ovl_path_next()
335 struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, ovl_lookup() argument
339 struct ovl_entry *poe = dentry->d_parent->d_fsdata; ovl_lookup()
341 struct dentry *upperdir, *upperdentry = NULL; ovl_lookup()
345 struct dentry *this, *prev = NULL; ovl_lookup()
351 this = ovl_lookup_real(upperdir, &dentry->d_name); ovl_lookup()
379 this = ovl_lookup_real(lowerpath.dentry, &dentry->d_name); ovl_lookup()
419 stack[ctr].dentry = this; ovl_lookup()
433 struct dentry *realdentry; ovl_lookup()
435 realdentry = upperdentry ? upperdentry : stack[0].dentry; ovl_lookup()
438 inode = ovl_new_inode(dentry->d_sb, realdentry->d_inode->i_mode, ovl_lookup()
449 dentry->d_fsdata = oe; ovl_lookup()
450 d_add(dentry, inode); ovl_lookup()
458 dput(stack[i].dentry); ovl_lookup()
496 static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) ovl_statfs() argument
498 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; ovl_statfs()
499 struct dentry *root_dentry = dentry->d_sb->s_root; ovl_statfs()
520 static int ovl_show_options(struct seq_file *m, struct dentry *dentry) ovl_show_options() argument
522 struct super_block *sb = dentry->d_sb; ovl_show_options()
640 static struct dentry *ovl_workdir_create(struct vfsmount *mnt, ovl_workdir_create() argument
641 struct dentry *dentry) ovl_workdir_create()
643 struct inode *dir = dentry->d_inode; ovl_workdir_create()
644 struct dentry *work; ovl_workdir_create()
654 work = lookup_one_len(OVL_WORKDIR_NAME, dentry, ovl_workdir_create()
702 static bool ovl_is_allowed_fs_type(struct dentry *root) ovl_is_allowed_fs_type()
735 if (!ovl_is_allowed_fs_type(path->dentry)) { ovl_mount_dir_noesc()
739 if (!S_ISDIR(path->dentry->d_inode->i_mode)) { ovl_mount_dir_noesc()
791 static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) ovl_workdir_ok()
826 struct dentry *root_dentry; ovl_fill_super()
880 if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { ovl_fill_super()
931 ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); ovl_fill_super()
984 oe->__upperdentry = upperpath.dentry; ovl_fill_super()
986 oe->lowerstack[i].dentry = stack[i].dentry; ovl_fill_super()
1031 static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, ovl_mount()
H A Dcopy_up.c23 int ovl_copy_xattr(struct dentry *old, struct dentry *new) ovl_copy_xattr()
136 static char *ovl_read_symlink(struct dentry *realdentry) ovl_read_symlink()
170 static int ovl_set_timestamps(struct dentry *upperdentry, struct kstat *stat) ovl_set_timestamps()
182 int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat) ovl_set_attr()
207 static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, ovl_copy_up_locked() argument
208 struct dentry *dentry, struct path *lowerpath, ovl_copy_up_locked()
214 struct dentry *newdentry = NULL; ovl_copy_up_locked()
215 struct dentry *upper = NULL; ovl_copy_up_locked()
219 newdentry = ovl_lookup_temp(workdir, dentry); ovl_copy_up_locked()
224 upper = lookup_one_len(dentry->d_name.name, upperdir, ovl_copy_up_locked()
225 dentry->d_name.len); ovl_copy_up_locked()
239 ovl_path_upper(dentry, &upperpath); ovl_copy_up_locked()
240 BUG_ON(upperpath.dentry != NULL); ovl_copy_up_locked()
241 upperpath.dentry = newdentry; ovl_copy_up_locked()
248 err = ovl_copy_xattr(lowerpath->dentry, newdentry); ovl_copy_up_locked()
264 ovl_dentry_update(dentry, newdentry); ovl_copy_up_locked()
271 ovl_dentry_set_opaque(dentry, true); ovl_copy_up_locked()
285 * Copy up a single dentry
299 int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, ovl_copy_up_one() argument
303 struct dentry *workdir = ovl_workdir(dentry); ovl_copy_up_one()
307 struct dentry *upperdir; ovl_copy_up_one()
308 struct dentry *upperdentry; ovl_copy_up_one()
317 upperdir = parentpath.dentry; ovl_copy_up_one()
324 link = ovl_read_symlink(lowerpath->dentry); ovl_copy_up_one()
357 upperdentry = ovl_dentry_upper(dentry); ovl_copy_up_one()
370 err = ovl_copy_up_locked(workdir, upperdir, dentry, lowerpath, ovl_copy_up_one()
389 int ovl_copy_up(struct dentry *dentry) ovl_copy_up() argument
395 struct dentry *next; ovl_copy_up()
396 struct dentry *parent; ovl_copy_up()
399 enum ovl_path_type type = ovl_path_type(dentry); ovl_copy_up()
404 next = dget(dentry); ovl_copy_up()
405 /* find the topmost dentry not yet copied up */ ovl_copy_up()
H A Dreaddir.c173 static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) ovl_cache_put() argument
180 if (ovl_dir_cache(dentry) == cache) ovl_cache_put()
181 ovl_set_dir_cache(dentry, NULL); ovl_cache_put()
202 static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd) ovl_check_whiteouts()
206 struct dentry *dentry; ovl_check_whiteouts() local
225 dentry = lookup_one_len(p->name, dir, p->len); ovl_check_whiteouts()
226 if (!IS_ERR(dentry)) { ovl_check_whiteouts()
227 p->is_whiteout = ovl_is_whiteout(dentry); ovl_check_whiteouts()
228 dput(dentry); ovl_check_whiteouts()
260 err = ovl_check_whiteouts(realpath->dentry, rdd); ovl_dir_read()
271 struct dentry *dentry = file->f_path.dentry; ovl_dir_reset() local
272 enum ovl_path_type type = ovl_path_type(dentry); ovl_dir_reset()
274 if (cache && ovl_dentry_version_get(dentry) != cache->version) { ovl_dir_reset()
275 ovl_cache_put(od, dentry); ovl_dir_reset()
284 static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) ovl_dir_read_merged() argument
297 next = ovl_path_next(idx, dentry, &realpath); ovl_dir_read_merged()
331 static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) ovl_cache_get() argument
336 cache = ovl_dir_cache(dentry); ovl_cache_get()
337 if (cache && ovl_dentry_version_get(dentry) == cache->version) { ovl_cache_get()
341 ovl_set_dir_cache(dentry, NULL); ovl_cache_get()
350 res = ovl_dir_read_merged(dentry, &cache->entries); ovl_cache_get()
357 cache->version = ovl_dentry_version_get(dentry); ovl_cache_get()
358 ovl_set_dir_cache(dentry, cache); ovl_cache_get()
366 struct dentry *dentry = file->f_path.dentry; ovl_iterate() local
378 cache = ovl_cache_get(dentry); ovl_iterate()
441 struct dentry *dentry = file->f_path.dentry; ovl_dir_fsync() local
447 if (!od->is_upper && OVL_TYPE_UPPER(ovl_path_type(dentry))) { ovl_dir_fsync()
454 ovl_path_upper(dentry, &upperpath); ovl_dir_fsync()
483 ovl_cache_put(od, file->f_path.dentry); ovl_dir_release()
505 type = ovl_path_real(file->f_path.dentry, &realpath); ovl_dir_open()
528 int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) ovl_check_empty_dir() argument
533 err = ovl_dir_read_merged(dentry, list); ovl_check_empty_dir()
556 void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) ovl_cleanup_whiteouts()
562 struct dentry *dentry; list_for_each_entry() local
567 dentry = lookup_one_len(p->name, upper, p->len); list_for_each_entry()
568 if (IS_ERR(dentry)) { list_for_each_entry()
571 (int) PTR_ERR(dentry)); list_for_each_entry()
574 if (dentry->d_inode) list_for_each_entry()
575 ovl_cleanup(upper->d_inode, dentry); list_for_each_entry()
576 dput(dentry); list_for_each_entry()
/linux-4.1.27/include/linux/
H A Devm.h17 extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
22 extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
23 extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
24 extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
26 extern void evm_inode_post_setxattr(struct dentry *dentry,
30 extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
31 extern void evm_inode_post_removexattr(struct dentry *dentry,
46 static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, evm_verifyxattr() argument
56 static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) evm_inode_setattr() argument
61 static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) evm_inode_post_setattr() argument
66 static inline int evm_inode_setxattr(struct dentry *dentry, const char *name, evm_inode_setxattr() argument
72 static inline void evm_inode_post_setxattr(struct dentry *dentry, evm_inode_post_setxattr() argument
80 static inline int evm_inode_removexattr(struct dentry *dentry, evm_inode_removexattr() argument
86 static inline void evm_inode_post_removexattr(struct dentry *dentry, evm_inode_post_removexattr() argument
H A Ddebugfs.h42 extern struct dentry *arch_debugfs_dir;
50 struct dentry *debugfs_create_file(const char *name, umode_t mode,
51 struct dentry *parent, void *data,
54 struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
55 struct dentry *parent, void *data,
59 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
61 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
64 struct dentry *debugfs_create_automount(const char *name,
65 struct dentry *parent,
69 void debugfs_remove(struct dentry *dentry);
70 void debugfs_remove_recursive(struct dentry *dentry);
72 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
73 struct dentry *new_dir, const char *new_name);
75 struct dentry *debugfs_create_u8(const char *name, umode_t mode,
76 struct dentry *parent, u8 *value);
77 struct dentry *debugfs_create_u16(const char *name, umode_t mode,
78 struct dentry *parent, u16 *value);
79 struct dentry *debugfs_create_u32(const char *name, umode_t mode,
80 struct dentry *parent, u32 *value);
81 struct dentry *debugfs_create_u64(const char *name, umode_t mode,
82 struct dentry *parent, u64 *value);
83 struct dentry *debugfs_create_x8(const char *name, umode_t mode,
84 struct dentry *parent, u8 *value);
85 struct dentry *debugfs_create_x16(const char *name, umode_t mode,
86 struct dentry *parent, u16 *value);
87 struct dentry *debugfs_create_x32(const char *name, umode_t mode,
88 struct dentry *parent, u32 *value);
89 struct dentry *debugfs_create_x64(const char *name, umode_t mode,
90 struct dentry *parent, u64 *value);
91 struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
92 struct dentry *parent, size_t *value);
93 struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
94 struct dentry *parent, atomic_t *value);
95 struct dentry *debugfs_create_bool(const char *name, umode_t mode,
96 struct dentry *parent, u32 *value);
98 struct dentry *debugfs_create_blob(const char *name, umode_t mode,
99 struct dentry *parent,
102 struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
103 struct dentry *parent,
109 struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
110 struct dentry *parent,
113 struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
114 struct dentry *parent,
130 static inline struct dentry *debugfs_create_file(const char *name, umode_t mode, debugfs_create_file()
131 struct dentry *parent, void *data, debugfs_create_file()
137 static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode, debugfs_create_file_size()
138 struct dentry *parent, void *data, debugfs_create_file_size()
145 static inline struct dentry *debugfs_create_dir(const char *name, debugfs_create_dir()
146 struct dentry *parent) debugfs_create_dir()
151 static inline struct dentry *debugfs_create_symlink(const char *name, debugfs_create_symlink()
152 struct dentry *parent, debugfs_create_symlink()
158 static inline void debugfs_remove(struct dentry *dentry) debugfs_remove() argument
161 static inline void debugfs_remove_recursive(struct dentry *dentry) debugfs_remove_recursive() argument
164 static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, debugfs_rename()
165 struct dentry *new_dir, char *new_name) debugfs_rename()
170 static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode, debugfs_create_u8()
171 struct dentry *parent, debugfs_create_u8()
177 static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode, debugfs_create_u16()
178 struct dentry *parent, debugfs_create_u16()
184 static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, debugfs_create_u32()
185 struct dentry *parent, debugfs_create_u32()
191 static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode, debugfs_create_u64()
192 struct dentry *parent, debugfs_create_u64()
198 static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode, debugfs_create_x8()
199 struct dentry *parent, debugfs_create_x8()
205 static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode, debugfs_create_x16()
206 struct dentry *parent, debugfs_create_x16()
212 static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode, debugfs_create_x32()
213 struct dentry *parent, debugfs_create_x32()
219 static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode, debugfs_create_x64()
220 struct dentry *parent, debugfs_create_x64()
226 static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, debugfs_create_size_t()
227 struct dentry *parent, debugfs_create_size_t()
233 static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, debugfs_create_atomic_t()
234 struct dentry *parent, atomic_t *value) debugfs_create_atomic_t()
239 static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, debugfs_create_bool()
240 struct dentry *parent, debugfs_create_bool()
246 static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode, debugfs_create_blob()
247 struct dentry *parent, debugfs_create_blob()
253 static inline struct dentry *debugfs_create_regset32(const char *name, debugfs_create_regset32()
254 umode_t mode, struct dentry *parent, debugfs_create_regset32()
270 static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, debugfs_create_u32_array()
271 struct dentry *parent, debugfs_create_u32_array()
277 static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, debugfs_create_devm_seqfile()
279 struct dentry *parent, debugfs_create_devm_seqfile()
H A Ddcache.h42 * dentry.
92 * Try to keep struct dentry aligned on 64 byte cachelines (this will
108 struct dentry { struct
111 seqcount_t d_seq; /* per dentry seqlock */
113 struct dentry *d_parent; /* parent directory */
120 struct lockref d_lockref; /* per-dentry lock and refcount */
122 struct super_block *d_sb; /* The root of the dentry tree */
139 * dentry->d_lock spinlock nesting subclasses:
151 int (*d_revalidate)(struct dentry *, unsigned int);
152 int (*d_weak_revalidate)(struct dentry *, unsigned int);
153 int (*d_hash)(const struct dentry *, struct qstr *);
154 int (*d_compare)(const struct dentry *, const struct dentry *,
156 int (*d_delete)(const struct dentry *);
157 void (*d_release)(struct dentry *);
158 void (*d_prune)(struct dentry *);
159 void (*d_iput)(struct dentry *, struct inode *);
160 char *(*d_dname)(struct dentry *, char *, int);
162 int (*d_manage)(struct dentry *, bool);
163 struct inode *(*d_select_inode)(struct dentry *, unsigned);
182 /* This dentry is possibly not currently connected to the dcache tree, in
184 * well. nfsd will not use a dentry with this bit set, but will first
188 * directory inode with a DCACHE_DISCONNECTED dentry, will d_move that
189 * dentry into place and return that dentry rather than the passed one,
202 /* this dentry has been "silly renamed" and has to be deleted on the last
219 #define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry (maybe fallthru to nowhere) */
220 #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */
236 extern void d_instantiate(struct dentry *, struct inode *);
237 extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
238 extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
239 extern void __d_drop(struct dentry *dentry);
240 extern void d_drop(struct dentry *dentry);
241 extern void d_delete(struct dentry *);
242 extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op);
245 extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
246 extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
247 extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
248 extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
249 extern struct dentry *d_find_any_alias(struct inode *inode);
250 extern struct dentry * d_obtain_alias(struct inode *);
251 extern struct dentry * d_obtain_root(struct inode *);
253 extern void shrink_dcache_parent(struct dentry *);
255 extern void d_invalidate(struct dentry *);
258 extern struct dentry * d_make_root(struct inode *);
261 extern void d_genocide(struct dentry *);
263 extern void d_tmpfile(struct dentry *, struct inode *);
265 extern struct dentry *d_find_alias(struct inode *);
269 extern int have_submounts(struct dentry *);
274 extern void d_rehash(struct dentry *);
277 * d_add - add dentry to hash queues
278 * @entry: dentry to add
279 * @inode: The inode to attach to this dentry
285 static inline void d_add(struct dentry *entry, struct inode *inode) d_add()
292 * d_add_unique - add dentry to hash queues without aliasing
293 * @entry: dentry to add
294 * @inode: The inode to attach to this dentry
299 static inline struct dentry *d_add_unique(struct dentry *entry, struct inode *inode) d_add_unique()
301 struct dentry *res; d_add_unique()
308 extern void dentry_update_name_case(struct dentry *, struct qstr *);
311 extern void d_move(struct dentry *, struct dentry *);
312 extern void d_exchange(struct dentry *, struct dentry *);
313 extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
316 extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
317 extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
318 extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
319 extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
322 static inline unsigned d_count(const struct dentry *dentry) d_count() argument
324 return dentry->d_lockref.count; d_count()
330 extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
331 extern char *simple_dname(struct dentry *, char *, int);
336 extern char *dentry_path_raw(struct dentry *, char *, int);
337 extern char *dentry_path(struct dentry *, char *, int);
342 * dget, dget_dlock - get a reference to a dentry
343 * @dentry: dentry to get a reference to
345 * Given a dentry or %NULL pointer increment the reference count
346 * if appropriate and return the dentry. A dentry will not be
349 static inline struct dentry *dget_dlock(struct dentry *dentry) dget_dlock() argument
351 if (dentry) dget_dlock()
352 dentry->d_lockref.count++; dget_dlock()
353 return dentry; dget_dlock()
356 static inline struct dentry *dget(struct dentry *dentry) dget() argument
358 if (dentry) dget()
359 lockref_get(&dentry->d_lockref); dget()
360 return dentry; dget()
363 extern struct dentry *dget_parent(struct dentry *dentry);
366 * d_unhashed - is dentry hashed
367 * @dentry: entry to check
369 * Returns true if the dentry passed is not currently hashed.
372 static inline int d_unhashed(const struct dentry *dentry) d_unhashed() argument
374 return hlist_bl_unhashed(&dentry->d_hash); d_unhashed()
377 static inline int d_unlinked(const struct dentry *dentry) d_unlinked() argument
379 return d_unhashed(dentry) && !IS_ROOT(dentry); d_unlinked()
382 static inline int cant_mount(const struct dentry *dentry) cant_mount() argument
384 return (dentry->d_flags & DCACHE_CANT_MOUNT); cant_mount()
387 static inline void dont_mount(struct dentry *dentry) dont_mount() argument
389 spin_lock(&dentry->d_lock); dont_mount()
390 dentry->d_flags |= DCACHE_CANT_MOUNT; dont_mount()
391 spin_unlock(&dentry->d_lock); dont_mount()
394 extern void dput(struct dentry *);
396 static inline bool d_managed(const struct dentry *dentry) d_managed() argument
398 return dentry->d_flags & DCACHE_MANAGED_DENTRY; d_managed()
401 static inline bool d_mountpoint(const struct dentry *dentry) d_mountpoint() argument
403 return dentry->d_flags & DCACHE_MOUNTED; d_mountpoint()
409 static inline unsigned __d_entry_type(const struct dentry *dentry) __d_entry_type() argument
411 return dentry->d_flags & DCACHE_ENTRY_TYPE; __d_entry_type()
414 static inline bool d_is_miss(const struct dentry *dentry) d_is_miss() argument
416 return __d_entry_type(dentry) == DCACHE_MISS_TYPE; d_is_miss()
419 static inline bool d_is_whiteout(const struct dentry *dentry) d_is_whiteout() argument
421 return __d_entry_type(dentry) == DCACHE_WHITEOUT_TYPE; d_is_whiteout()
424 static inline bool d_can_lookup(const struct dentry *dentry) d_can_lookup() argument
426 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; d_can_lookup()
429 static inline bool d_is_autodir(const struct dentry *dentry) d_is_autodir() argument
431 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; d_is_autodir()
434 static inline bool d_is_dir(const struct dentry *dentry) d_is_dir() argument
436 return d_can_lookup(dentry) || d_is_autodir(dentry); d_is_dir()
439 static inline bool d_is_symlink(const struct dentry *dentry) d_is_symlink() argument
441 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; d_is_symlink()
444 static inline bool d_is_reg(const struct dentry *dentry) d_is_reg() argument
446 return __d_entry_type(dentry) == DCACHE_REGULAR_TYPE; d_is_reg()
449 static inline bool d_is_special(const struct dentry *dentry) d_is_special() argument
451 return __d_entry_type(dentry) == DCACHE_SPECIAL_TYPE; d_is_special()
454 static inline bool d_is_file(const struct dentry *dentry) d_is_file() argument
456 return d_is_reg(dentry) || d_is_special(dentry); d_is_file()
459 static inline bool d_is_negative(const struct dentry *dentry) d_is_negative() argument
461 // TODO: check d_is_whiteout(dentry) also. d_is_negative()
462 return d_is_miss(dentry); d_is_negative()
465 static inline bool d_is_positive(const struct dentry *dentry) d_is_positive() argument
467 return !d_is_negative(dentry); d_is_positive()
471 * d_really_is_negative - Determine if a dentry is really negative (ignoring fallthroughs)
472 * @dentry: The dentry in question
474 * Returns true if the dentry represents either an absent name or a name that
475 * doesn't map to an inode (ie. ->d_inode is NULL). The dentry could represent
482 * the inode. (3) The dentry may have something attached to ->d_lower and the
485 static inline bool d_really_is_negative(const struct dentry *dentry) d_really_is_negative() argument
487 return dentry->d_inode == NULL; d_really_is_negative()
491 * d_really_is_positive - Determine if a dentry is really positive (ignoring fallthroughs)
492 * @dentry: The dentry in question
494 * Returns true if the dentry represents a name that maps to an inode
495 * (ie. ->d_inode is not NULL). The dentry might still represent a whiteout if
503 static inline bool d_really_is_positive(const struct dentry *dentry) d_really_is_positive() argument
505 return dentry->d_inode != NULL; d_really_is_positive()
508 extern void d_set_fallthru(struct dentry *dentry);
510 static inline bool d_is_fallthru(const struct dentry *dentry) d_is_fallthru() argument
512 return dentry->d_flags & DCACHE_FALLTHRU; d_is_fallthru()
524 * d_inode - Get the actual inode of this dentry
525 * @dentry: The dentry to query
530 static inline struct inode *d_inode(const struct dentry *dentry) d_inode() argument
532 return dentry->d_inode; d_inode()
536 * d_inode_rcu - Get the actual inode of this dentry with ACCESS_ONCE()
537 * @dentry: The dentry to query
542 static inline struct inode *d_inode_rcu(const struct dentry *dentry) d_inode_rcu() argument
544 return ACCESS_ONCE(dentry->d_inode); d_inode_rcu()
552 * if this dentry were to be opened as a file. The inode may be on the upper
553 * dentry or it may be on a lower dentry pinned by the upper.
557 static inline struct inode *d_backing_inode(const struct dentry *upper) d_backing_inode()
565 * d_backing_dentry - Get upper or lower dentry we should be using
568 * This is the helper that should be used to get the dentry of the inode that
569 * will be used if this dentry were opened as a file. It may be the upper
570 * dentry or it may be a lower dentry pinned by the upper.
574 static inline struct dentry *d_backing_dentry(struct dentry *upper) d_backing_dentry()
H A Dpath.h4 struct dentry;
9 struct dentry *dentry; member in struct:path
17 return path1->mnt == path2->mnt && path1->dentry == path2->dentry; path_equal()
H A Dtracefs.h28 struct dentry *tracefs_create_file(const char *name, umode_t mode,
29 struct dentry *parent, void *data,
32 struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
34 void tracefs_remove(struct dentry *dentry);
35 void tracefs_remove_recursive(struct dentry *dentry);
37 struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
H A Dxattr.h20 struct dentry;
25 size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
27 int (*get)(struct dentry *dentry, const char *name, void *buffer,
29 int (*set)(struct dentry *dentry, const char *name, const void *buffer,
40 ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
41 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
42 int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
43 int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
44 int vfs_removexattr(struct dentry *, const char *);
46 ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
47 ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
48 int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
49 int generic_removexattr(struct dentry *dentry, const char *name);
50 ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
52 int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
H A Dima.h58 extern void ima_inode_post_setattr(struct dentry *dentry);
59 extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
61 extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
63 static inline void ima_inode_post_setattr(struct dentry *dentry) ima_inode_post_setattr() argument
68 static inline int ima_inode_setxattr(struct dentry *dentry, ima_inode_setxattr() argument
76 static inline int ima_inode_removexattr(struct dentry *dentry, ima_inode_removexattr() argument
H A Dfsnotify.h20 * fsnotify_d_instantiate - instantiate a dentry for inode
22 static inline void fsnotify_d_instantiate(struct dentry *dentry, fsnotify_d_instantiate() argument
25 __fsnotify_d_instantiate(dentry, inode); fsnotify_d_instantiate()
28 /* Notify this dentry's parent about a child's events. */ fsnotify_parent()
29 static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) fsnotify_parent() argument
31 if (!dentry) fsnotify_parent()
32 dentry = path->dentry; fsnotify_parent()
34 return __fsnotify_parent(path, dentry, mask); fsnotify_parent()
64 * fsnotify_d_move - dentry has been moved
66 static inline void fsnotify_d_move(struct dentry *dentry) fsnotify_d_move() argument
69 * On move we need to update dentry->d_flags to indicate if the new parent fsnotify_d_move()
70 * cares about events from this dentry. fsnotify_d_move()
72 __fsnotify_update_dcache_flags(dentry); fsnotify_d_move()
88 int isdir, struct inode *target, struct dentry *moved) fsnotify_move()
136 static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) fsnotify_nameremove() argument
143 fsnotify_parent(NULL, dentry, mask); fsnotify_nameremove()
158 static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) fsnotify_create() argument
160 audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE); fsnotify_create()
162 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); fsnotify_create()
170 static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) fsnotify_link()
181 static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) fsnotify_mkdir() argument
184 struct inode *d_inode = dentry->d_inode; fsnotify_mkdir()
186 audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE); fsnotify_mkdir()
188 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); fsnotify_mkdir()
265 static inline void fsnotify_xattr(struct dentry *dentry) fsnotify_xattr() argument
267 struct inode *inode = dentry->d_inode; fsnotify_xattr()
273 fsnotify_parent(NULL, dentry, mask); fsnotify_xattr()
281 static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) fsnotify_change() argument
283 struct inode *inode = dentry->d_inode; fsnotify_change()
308 fsnotify_parent(NULL, dentry, mask); fsnotify_change()
H A Dnamei.h25 * - dentry cache is untrusted; force a real lookup
58 extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int);
59 extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
60 extern void done_path_create(struct path *, struct dentry *);
61 extern struct dentry *kern_path_locked(const char *, struct path *);
64 extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
70 extern struct dentry *lock_rename(struct dentry *, struct dentry *);
71 extern void unlock_rename(struct dentry *, struct dentry *);
H A Dexportfs.h6 struct dentry;
127 * @encode_fh: encode a file handle fragment from a dentry
128 * @fh_to_dentry: find the implied object and get a dentry for it
129 * @fh_to_parent: find the implied object's parent and get a dentry for it
140 * file referred to by the &struct dentry @de. If the @connectable flag is
151 * fragment (@fh, @fh_len). It should return a &struct dentry which refers
155 * couldn't be found (e.g. %ENOENT or %ENOMEM). Any suitable dentry can be
156 * returned including, if necessary, a new dentry created with d_alloc_root.
162 * dentry if it was encoded into the filehandle fragment by @encode_fh.
202 struct dentry * (*fh_to_dentry)(struct super_block *sb, struct fid *fid,
204 struct dentry * (*fh_to_parent)(struct super_block *sb, struct fid *fid,
206 int (*get_name)(struct dentry *parent, char *name,
207 struct dentry *child);
208 struct dentry * (*get_parent)(struct dentry *child);
221 extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
223 extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
224 int fh_len, int fileid_type, int (*acceptable)(void *, struct dentry *),
230 extern struct dentry *generic_fh_to_dentry(struct super_block *sb,
233 extern struct dentry *generic_fh_to_parent(struct super_block *sb,
H A Dfault-inject.h30 struct dentry *dname;
49 struct dentry *fault_create_debugfs_attr(const char *name,
50 struct dentry *parent, struct fault_attr *attr);
54 static inline struct dentry *fault_create_debugfs_attr(const char *name, fault_create_debugfs_attr()
55 struct dentry *parent, struct fault_attr *attr) fault_create_debugfs_attr()
H A Dsecurity.h41 struct dentry;
88 extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
90 extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
91 extern int cap_inode_need_killpriv(struct dentry *dentry);
92 extern int cap_inode_killpriv(struct dentry *dentry);
260 * @dentry is a handle on the superblock for the filesystem.
314 * Compute a context for a dentry as the inode is not yet available
316 * @dentry dentry to use in calculating the context.
358 * @dentry contains the dentry structure for the file to be created.
363 * @old_dentry contains the dentry structure for an existing link to the file.
365 * @new_dentry contains the dentry structure for the new link.
369 * @old_dentry contains the dentry structure for an existing link
373 * @new_dentry contains the dentry structure for the new link.
378 * @dentry contains the dentry structure for file to be unlinked.
383 * @dentry contains the dentry structure for file to be unlinked.
388 * @dentry contains the dentry structure of the symbolic link.
395 * @dentry contains the dentry structure of the symbolic link.
402 * @dentry contains the dentry structure of new directory.
410 * @dentry contains the dentry structure of new directory.
416 * @dentry contains the dentry structure of directory to be removed.
422 * @dentry contains the dentry structure of directory to be removed.
430 * @dentry contains the dentry structure of the new file.
438 * @dentry contains the dentry structure of the new file.
446 * @old_dentry contains the dentry structure of the old link.
448 * @new_dentry contains the dentry structure of the new link.
453 * @old_dentry contains the dentry structure of the old link.
455 * @new_dentry contains the dentry structure of the new link.
459 * @dentry contains the dentry structure.
475 * @dentry contains the dentry structure for the file link.
479 * @dentry contains the dentry structure for the link.
497 * @dentry contains the dentry structure for the file.
506 * @mnt is the vfsmount where the dentry was looked up
507 * @dentry contains the dentry structure for the file.
511 * @value identified by @name for @dentry.
515 * @value identified by @name for @dentry.
518 * identified by @name for @dentry.
522 * names for @dentry.
526 * identified by @name for @dentry.
550 * @dentry is the dentry being changed.
556 * Called with the dentry->d_inode->i_mutex held.
557 * @dentry is the dentry being changed.
1447 * @dentry contains the inode we wish to set the security context of.
1484 int (*quota_on) (struct dentry *dentry);
1501 int (*sb_statfs) (struct dentry *dentry);
1514 int (*dentry_init_security) (struct dentry *dentry, int mode,
1520 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1521 int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
1522 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1523 int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
1526 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1528 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
1529 struct dentry *new_dentry);
1530 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1531 struct path *new_dir, struct dentry *new_dentry);
1543 struct dentry *dentry, umode_t mode);
1544 int (*inode_link) (struct dentry *old_dentry,
1545 struct inode *dir, struct dentry *new_dentry);
1546 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1548 struct dentry *dentry, const char *old_name);
1549 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
1550 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1551 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1553 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1554 struct inode *new_dir, struct dentry *new_dentry);
1555 int (*inode_readlink) (struct dentry *dentry);
1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1560 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
1564 int (*inode_getxattr) (struct dentry *dentry, const char *name);
1565 int (*inode_listxattr) (struct dentry *dentry);
1566 int (*inode_removexattr) (struct dentry *dentry, const char *name);
1567 int (*inode_need_killpriv) (struct dentry *dentry);
1568 int (*inode_killpriv) (struct dentry *dentry);
1662 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1672 int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
1790 int security_quota_on(struct dentry *dentry);
1805 int security_sb_statfs(struct dentry *dentry);
1817 int security_dentry_init_security(struct dentry *dentry, int mode,
1829 int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1830 int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1831 struct dentry *new_dentry);
1832 int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1833 int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1835 int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
1836 int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1837 int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1838 int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1839 struct inode *new_dir, struct dentry *new_dentry,
1841 int security_inode_readlink(struct dentry *dentry);
1842 int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1844 int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1846 int security_inode_setxattr(struct dentry *dentry, const char *name,
1848 void security_inode_post_setxattr(struct dentry *dentry, const char *name,
1850 int security_inode_getxattr(struct dentry *dentry, const char *name);
1851 int security_inode_listxattr(struct dentry *dentry);
1852 int security_inode_removexattr(struct dentry *dentry, const char *name);
1853 int security_inode_need_killpriv(struct dentry *dentry);
1854 int security_inode_killpriv(struct dentry *dentry);
1929 void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1939 int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
2032 static inline int security_quota_on(struct dentry *dentry) security_quota_on() argument
2105 static inline int security_sb_statfs(struct dentry *dentry) security_sb_statfs() argument
2155 static inline int security_dentry_init_security(struct dentry *dentry, security_dentry_init_security() argument
2184 struct dentry *dentry, security_inode_create()
2190 static inline int security_inode_link(struct dentry *old_dentry, security_inode_link()
2192 struct dentry *new_dentry) security_inode_link()
2198 struct dentry *dentry) security_inode_unlink()
2204 struct dentry *dentry, security_inode_symlink()
2211 struct dentry *dentry, security_inode_mkdir()
2218 struct dentry *dentry) security_inode_rmdir()
2224 struct dentry *dentry, security_inode_mknod()
2231 struct dentry *old_dentry, security_inode_rename()
2233 struct dentry *new_dentry, security_inode_rename()
2239 static inline int security_inode_readlink(struct dentry *dentry) security_inode_readlink() argument
2244 static inline int security_inode_follow_link(struct dentry *dentry, security_inode_follow_link() argument
2255 static inline int security_inode_setattr(struct dentry *dentry, security_inode_setattr() argument
2266 static inline int security_inode_setxattr(struct dentry *dentry, security_inode_setxattr() argument
2269 return cap_inode_setxattr(dentry, name, value, size, flags); security_inode_setxattr()
2272 static inline void security_inode_post_setxattr(struct dentry *dentry, security_inode_post_setxattr() argument
2276 static inline int security_inode_getxattr(struct dentry *dentry, security_inode_getxattr() argument
2282 static inline int security_inode_listxattr(struct dentry *dentry) security_inode_listxattr() argument
2287 static inline int security_inode_removexattr(struct dentry *dentry, security_inode_removexattr() argument
2290 return cap_inode_removexattr(dentry, name); security_inode_removexattr()
2293 static inline int security_inode_need_killpriv(struct dentry *dentry) security_inode_need_killpriv() argument
2295 return cap_inode_need_killpriv(dentry); security_inode_need_killpriv()
2298 static inline int security_inode_killpriv(struct dentry *dentry) security_inode_killpriv() argument
2300 return cap_inode_killpriv(dentry); security_inode_killpriv()
2638 static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode) security_d_instantiate() argument
2681 static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) security_inode_setsecctx() argument
3015 int security_path_unlink(struct path *dir, struct dentry *dentry);
3016 int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
3017 int security_path_rmdir(struct path *dir, struct dentry *dentry);
3018 int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
3021 int security_path_symlink(struct path *dir, struct dentry *dentry,
3023 int security_path_link(struct dentry *old_dentry, struct path *new_dir,
3024 struct dentry *new_dentry);
3025 int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
3026 struct path *new_dir, struct dentry *new_dentry,
3032 static inline int security_path_unlink(struct path *dir, struct dentry *dentry) security_path_unlink() argument
3037 static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, security_path_mkdir() argument
3043 static inline int security_path_rmdir(struct path *dir, struct dentry *dentry) security_path_rmdir() argument
3048 static inline int security_path_mknod(struct path *dir, struct dentry *dentry, security_path_mknod() argument
3059 static inline int security_path_symlink(struct path *dir, struct dentry *dentry, security_path_symlink() argument
3065 static inline int security_path_link(struct dentry *old_dentry, security_path_link()
3067 struct dentry *new_dentry) security_path_link()
3073 struct dentry *old_dentry, security_path_rename()
3075 struct dentry *new_dentry, security_path_rename()
3170 extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
3171 struct dentry *parent, void *data,
3173 extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
3174 extern void securityfs_remove(struct dentry *dentry);
3178 static inline struct dentry *securityfs_create_dir(const char *name, securityfs_create_dir()
3179 struct dentry *parent) securityfs_create_dir()
3184 static inline struct dentry *securityfs_create_file(const char *name, securityfs_create_file()
3186 struct dentry *parent, securityfs_create_file()
3193 static inline void securityfs_remove(struct dentry *dentry) securityfs_remove() argument
2183 security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode) security_inode_create() argument
2197 security_inode_unlink(struct inode *dir, struct dentry *dentry) security_inode_unlink() argument
2203 security_inode_symlink(struct inode *dir, struct dentry *dentry, const char *old_name) security_inode_symlink() argument
2210 security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode) security_inode_mkdir() argument
2217 security_inode_rmdir(struct inode *dir, struct dentry *dentry) security_inode_rmdir() argument
2223 security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) security_inode_mknod() argument
/linux-4.1.27/fs/reiserfs/
H A Dxattr_trusted.c11 trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, trusted_get() argument
17 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) trusted_get()
20 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); trusted_get()
24 trusted_set(struct dentry *dentry, const char *name, const void *buffer, trusted_set() argument
30 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) trusted_set()
33 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); trusted_set()
36 static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, trusted_list() argument
41 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) trusted_list()
H A Dxattr_user.c10 user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, user_get() argument
16 if (!reiserfs_xattrs_user(dentry->d_sb)) user_get()
18 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); user_get()
22 user_set(struct dentry *dentry, const char *name, const void *buffer, user_set() argument
28 if (!reiserfs_xattrs_user(dentry->d_sb)) user_set()
30 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); user_set()
33 static size_t user_list(struct dentry *dentry, char *list, size_t list_size, user_list() argument
38 if (!reiserfs_xattrs_user(dentry->d_sb)) user_list()
H A Dxattr.c65 static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) xattr_create() argument
68 return dir->i_op->create(dir, dentry, mode, true); xattr_create()
72 static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) xattr_mkdir() argument
75 return dir->i_op->mkdir(dir, dentry, mode); xattr_mkdir()
84 static int xattr_unlink(struct inode *dir, struct dentry *dentry) xattr_unlink() argument
90 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); xattr_unlink()
91 error = dir->i_op->unlink(dir, dentry); xattr_unlink()
92 mutex_unlock(&d_inode(dentry)->i_mutex); xattr_unlink()
95 d_delete(dentry); xattr_unlink()
99 static int xattr_rmdir(struct inode *dir, struct dentry *dentry) xattr_rmdir() argument
105 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); xattr_rmdir()
106 error = dir->i_op->rmdir(dir, dentry); xattr_rmdir()
108 d_inode(dentry)->i_flags |= S_DEAD; xattr_rmdir()
109 mutex_unlock(&d_inode(dentry)->i_mutex); xattr_rmdir()
111 d_delete(dentry); xattr_rmdir()
118 static struct dentry *open_xa_root(struct super_block *sb, int flags) open_xa_root()
120 struct dentry *privroot = REISERFS_SB(sb)->priv_root; open_xa_root()
121 struct dentry *xaroot; open_xa_root()
146 static struct dentry *open_xa_dir(const struct inode *inode, int flags) open_xa_dir()
148 struct dentry *xaroot, *xadir; open_xa_dir()
185 struct dentry *xadir;
187 struct dentry *dentries[8];
196 struct dentry *dentry; fill_with_dentries() local
207 dentry = lookup_one_len(name, dbuf->xadir, namelen); fill_with_dentries()
208 if (IS_ERR(dentry)) { fill_with_dentries()
209 return PTR_ERR(dentry); fill_with_dentries()
210 } else if (d_really_is_negative(dentry)) { fill_with_dentries()
212 reiserfs_error(dentry->d_sb, "xattr-20003", fill_with_dentries()
215 dentry, dbuf->xadir); fill_with_dentries()
216 dput(dentry); fill_with_dentries()
220 dbuf->dentries[dbuf->count++] = dentry; fill_with_dentries()
235 int (*action)(struct dentry *, void *), reiserfs_for_each_xattr()
238 struct dentry *dir; reiserfs_for_each_xattr()
267 struct dentry *dentry = buf.dentries[i]; reiserfs_for_each_xattr() local
269 if (!d_is_dir(dentry)) reiserfs_for_each_xattr()
270 err = action(dentry, data); reiserfs_for_each_xattr()
272 dput(dentry); reiserfs_for_each_xattr()
320 static int delete_one_xattr(struct dentry *dentry, void *data) delete_one_xattr() argument
322 struct inode *dir = d_inode(dentry->d_parent); delete_one_xattr()
325 if (d_is_dir(dentry)) delete_one_xattr()
326 return xattr_rmdir(dir, dentry); delete_one_xattr()
328 return xattr_unlink(dir, dentry); delete_one_xattr()
331 static int chown_one_xattr(struct dentry *dentry, void *data) chown_one_xattr() argument
343 err = reiserfs_setattr(dentry, attrs); chown_one_xattr()
373 * Returns a dentry corresponding to a specific extended attribute file
375 * valid or negative dentry, or an error is returned.
377 static struct dentry *xattr_lookup(struct inode *inode, const char *name, xattr_lookup()
380 struct dentry *xadir, *xafile; xattr_lookup()
466 struct dentry *dentry, *xadir; lookup_and_delete_xattr() local
473 dentry = lookup_one_len(name, xadir, strlen(name)); lookup_and_delete_xattr()
474 if (IS_ERR(dentry)) { lookup_and_delete_xattr()
475 err = PTR_ERR(dentry); lookup_and_delete_xattr()
479 if (d_really_is_positive(dentry)) { lookup_and_delete_xattr()
480 err = xattr_unlink(d_inode(xadir), dentry); lookup_and_delete_xattr()
484 dput(dentry); lookup_and_delete_xattr()
503 struct dentry *dentry; reiserfs_xattr_set_handle() local
519 dentry = xattr_lookup(inode, name, flags); reiserfs_xattr_set_handle()
520 if (IS_ERR(dentry)) reiserfs_xattr_set_handle()
521 return PTR_ERR(dentry); reiserfs_xattr_set_handle()
536 page = reiserfs_get_page(d_inode(dentry), file_pos); reiserfs_xattr_set_handle()
576 if (!err && new_size < i_size_read(d_inode(dentry))) { reiserfs_xattr_set_handle()
583 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_XATTR); reiserfs_xattr_set_handle()
584 inode_dio_wait(d_inode(dentry)); reiserfs_xattr_set_handle()
586 err = reiserfs_setattr(dentry, &newattrs); reiserfs_xattr_set_handle()
587 mutex_unlock(&d_inode(dentry)->i_mutex); reiserfs_xattr_set_handle()
592 dput(dentry); reiserfs_xattr_set_handle()
635 struct dentry *dentry; reiserfs_xattr_get() local
652 dentry = xattr_lookup(inode, name, XATTR_REPLACE); reiserfs_xattr_get()
653 if (IS_ERR(dentry)) { reiserfs_xattr_get()
654 err = PTR_ERR(dentry); reiserfs_xattr_get()
660 isize = i_size_read(d_inode(dentry)); reiserfs_xattr_get()
683 page = reiserfs_get_page(d_inode(dentry), file_pos); reiserfs_xattr_get()
728 dput(dentry); reiserfs_xattr_get()
771 reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, reiserfs_getxattr() argument
776 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); reiserfs_getxattr()
778 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) reiserfs_getxattr()
781 return handler->get(dentry, name, buffer, size, handler->flags); reiserfs_getxattr()
787 * d_inode(dentry)->i_mutex down
790 reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, reiserfs_setxattr() argument
795 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); reiserfs_setxattr()
797 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) reiserfs_setxattr()
800 return handler->set(dentry, name, value, size, flags, handler->flags); reiserfs_setxattr()
806 * d_inode(dentry)->i_mutex down
808 int reiserfs_removexattr(struct dentry *dentry, const char *name) reiserfs_removexattr() argument
812 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); reiserfs_removexattr()
814 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) reiserfs_removexattr()
817 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); reiserfs_removexattr()
825 struct dentry *dentry; member in struct:listxattr_buf
840 handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr, listxattr_filler()
845 size = handler->list(b->dentry, b->buf + b->pos, listxattr_filler()
851 size = handler->list(b->dentry, NULL, 0, name, listxattr_filler()
867 ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) reiserfs_listxattr() argument
869 struct dentry *dir; reiserfs_listxattr()
873 .dentry = dentry, reiserfs_listxattr()
878 if (d_really_is_negative(dentry)) reiserfs_listxattr()
881 if (!dentry->d_sb->s_xattr || reiserfs_listxattr()
882 get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) reiserfs_listxattr()
885 dir = open_xa_dir(d_inode(dentry), XATTR_REPLACE); reiserfs_listxattr()
905 static int create_privroot(struct dentry *dentry) create_privroot() argument
908 struct inode *inode = d_inode(dentry->d_parent); create_privroot()
912 err = xattr_mkdir(inode, dentry, 0700); create_privroot()
913 if (err || d_really_is_negative(dentry)) { create_privroot()
914 reiserfs_warning(dentry->d_sb, "jdm-20006", create_privroot()
921 d_inode(dentry)->i_flags |= S_PRIVATE; create_privroot()
922 reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " create_privroot()
931 static int create_privroot(struct dentry *dentry) { return 0; } create_privroot() argument
985 static int xattr_hide_revalidate(struct dentry *dentry, unsigned int flags) xattr_hide_revalidate() argument
996 struct dentry *dentry; reiserfs_lookup_privroot() local
1001 dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, reiserfs_lookup_privroot()
1003 if (!IS_ERR(dentry)) { reiserfs_lookup_privroot()
1004 REISERFS_SB(s)->priv_root = dentry; reiserfs_lookup_privroot()
1005 d_set_d_op(dentry, &xattr_lookup_poison_ops); reiserfs_lookup_privroot()
1006 if (d_really_is_positive(dentry)) reiserfs_lookup_privroot()
1007 d_inode(dentry)->i_flags |= S_PRIVATE; reiserfs_lookup_privroot()
1009 err = PTR_ERR(dentry); reiserfs_lookup_privroot()
1023 struct dentry *privroot = REISERFS_SB(s)->priv_root; reiserfs_xattr_init()
1039 struct dentry *dentry; reiserfs_xattr_init() local
1041 dentry = lookup_one_len(XAROOT_NAME, privroot, reiserfs_xattr_init()
1043 if (!IS_ERR(dentry)) reiserfs_xattr_init()
1044 REISERFS_SB(s)->xattr_root = dentry; reiserfs_xattr_init()
1046 err = PTR_ERR(dentry); reiserfs_xattr_init()
H A Dxattr_security.c12 security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, security_get() argument
18 if (IS_PRIVATE(d_inode(dentry))) security_get()
21 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); security_get()
25 security_set(struct dentry *dentry, const char *name, const void *buffer, security_set() argument
31 if (IS_PRIVATE(d_inode(dentry))) security_set()
34 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); security_set()
37 static size_t security_list(struct dentry *dentry, char *list, size_t list_len, security_list() argument
42 if (IS_PRIVATE(d_inode(dentry))) security_list()
H A Dxattr.h7 struct dentry;
21 ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
23 int reiserfs_setxattr(struct dentry *dentry, const char *name,
25 ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
26 int reiserfs_removexattr(struct dentry *dentry, const char *name);
H A Dacl.h54 struct inode *dir, struct dentry *dentry,
71 const struct inode *dir, struct dentry *dentry, reiserfs_inherit_default_acl()
70 reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, const struct inode *dir, struct dentry *dentry, struct inode *inode) reiserfs_inherit_default_acl() argument
/linux-4.1.27/fs/ext2/
H A Dxattr_user.c14 ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, ext2_xattr_user_list() argument
20 if (!test_opt(dentry->d_sb, XATTR_USER)) ext2_xattr_user_list()
32 ext2_xattr_user_get(struct dentry *dentry, const char *name, ext2_xattr_user_get() argument
37 if (!test_opt(dentry->d_sb, XATTR_USER)) ext2_xattr_user_get()
39 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER, ext2_xattr_user_get()
44 ext2_xattr_user_set(struct dentry *dentry, const char *name, ext2_xattr_user_set() argument
49 if (!test_opt(dentry->d_sb, XATTR_USER)) ext2_xattr_user_set()
52 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER, ext2_xattr_user_set()
H A Dxattr_trusted.c12 ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, ext2_xattr_trusted_list() argument
30 ext2_xattr_trusted_get(struct dentry *dentry, const char *name, ext2_xattr_trusted_get() argument
35 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, ext2_xattr_trusted_get()
40 ext2_xattr_trusted_set(struct dentry *dentry, const char *name, ext2_xattr_trusted_set() argument
45 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, ext2_xattr_trusted_set()
H A Dnamei.c39 static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) ext2_add_nondir() argument
41 int err = ext2_add_link(dentry, inode); ext2_add_nondir()
44 d_instantiate(dentry, inode); ext2_add_nondir()
57 static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) ext2_lookup() argument
62 if (dentry->d_name.len > EXT2_NAME_LEN) ext2_lookup()
65 ino = ext2_inode_by_name(dir, &dentry->d_name); ext2_lookup()
76 return d_splice_alias(inode, dentry); ext2_lookup()
79 struct dentry *ext2_get_parent(struct dentry *child) ext2_get_parent()
96 static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) ext2_create() argument
102 inode = ext2_new_inode(dir, mode, &dentry->d_name); ext2_create()
115 return ext2_add_nondir(dentry, inode); ext2_create()
118 static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) ext2_tmpfile() argument
133 d_tmpfile(dentry, inode); ext2_tmpfile()
138 static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) ext2_mknod() argument
148 inode = ext2_new_inode (dir, mode, &dentry->d_name); ext2_mknod()
156 err = ext2_add_nondir(dentry, inode); ext2_mknod()
161 static int ext2_symlink (struct inode * dir, struct dentry * dentry, ext2_symlink() argument
174 inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO, &dentry->d_name); ext2_symlink()
197 err = ext2_add_nondir(dentry, inode); ext2_symlink()
208 static int ext2_link (struct dentry * old_dentry, struct inode * dir, ext2_link() argument
209 struct dentry *dentry) ext2_link()
220 err = ext2_add_link(dentry, inode); ext2_link()
222 d_instantiate(dentry, inode); ext2_link()
230 static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ext2_mkdir() argument
239 inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name); ext2_mkdir()
257 err = ext2_add_link(dentry, inode); ext2_mkdir()
262 d_instantiate(dentry, inode); ext2_mkdir()
276 static int ext2_unlink(struct inode * dir, struct dentry *dentry) ext2_unlink() argument
278 struct inode * inode = d_inode(dentry); ext2_unlink()
285 de = ext2_find_entry (dir, &dentry->d_name, &page); ext2_unlink()
300 static int ext2_rmdir (struct inode * dir, struct dentry *dentry) ext2_rmdir() argument
302 struct inode * inode = d_inode(dentry); ext2_rmdir()
306 err = ext2_unlink(dir, dentry); ext2_rmdir()
316 static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, ext2_rename()
317 struct inode * new_dir, struct dentry * new_dentry ) ext2_rename()
H A Dxattr_security.c11 ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, ext2_xattr_security_list() argument
26 ext2_xattr_security_get(struct dentry *dentry, const char *name, ext2_xattr_security_get() argument
31 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, ext2_xattr_security_get()
36 ext2_xattr_security_set(struct dentry *dentry, const char *name, ext2_xattr_security_set() argument
41 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, ext2_xattr_security_set()
H A Dsymlink.c24 static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd) ext2_follow_link() argument
26 struct ext2_inode_info *ei = EXT2_I(d_inode(dentry)); ext2_follow_link()
/linux-4.1.27/fs/ext3/
H A Dxattr_user.c12 ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, ext3_xattr_user_list() argument
18 if (!test_opt(dentry->d_sb, XATTR_USER)) ext3_xattr_user_list()
30 ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer, ext3_xattr_user_get() argument
35 if (!test_opt(dentry->d_sb, XATTR_USER)) ext3_xattr_user_get()
37 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_USER, ext3_xattr_user_get()
42 ext3_xattr_user_set(struct dentry *dentry, const char *name, ext3_xattr_user_set() argument
47 if (!test_opt(dentry->d_sb, XATTR_USER)) ext3_xattr_user_set()
49 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_USER, ext3_xattr_user_set()
H A Dxattr_trusted.c12 ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, ext3_xattr_trusted_list() argument
30 ext3_xattr_trusted_get(struct dentry *dentry, const char *name, ext3_xattr_trusted_get() argument
35 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, ext3_xattr_trusted_get()
40 ext3_xattr_trusted_set(struct dentry *dentry, const char *name, ext3_xattr_trusted_set() argument
45 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, name, ext3_xattr_trusted_set()
H A Dxattr_security.c11 ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, ext3_xattr_security_list() argument
27 ext3_xattr_security_get(struct dentry *dentry, const char *name, ext3_xattr_security_get() argument
32 return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, ext3_xattr_security_get()
37 ext3_xattr_security_set(struct dentry *dentry, const char *name, ext3_xattr_security_set() argument
42 return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, ext3_xattr_security_set()
H A Dnamei.h8 extern struct dentry *ext3_get_parent(struct dentry *child);
H A Dsymlink.c24 static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) ext3_follow_link() argument
26 struct ext3_inode_info *ei = EXT3_I(d_inode(dentry)); ext3_follow_link()
/linux-4.1.27/drivers/net/wireless/ti/wl1251/
H A Dwl1251.h160 struct dentry *rootdir;
161 struct dentry *fw_statistics;
163 struct dentry *tx_internal_desc_overflow;
165 struct dentry *rx_out_of_mem;
166 struct dentry *rx_hdr_overflow;
167 struct dentry *rx_hw_stuck;
168 struct dentry *rx_dropped;
169 struct dentry *rx_fcs_err;
170 struct dentry *rx_xfr_hint_trig;
171 struct dentry *rx_path_reset;
172 struct dentry *rx_reset_counter;
174 struct dentry *dma_rx_requested;
175 struct dentry *dma_rx_errors;
176 struct dentry *dma_tx_requested;
177 struct dentry *dma_tx_errors;
179 struct dentry *isr_cmd_cmplt;
180 struct dentry *isr_fiqs;
181 struct dentry *isr_rx_headers;
182 struct dentry *isr_rx_mem_overflow;
183 struct dentry *isr_rx_rdys;
184 struct dentry *isr_irqs;
185 struct dentry *isr_tx_procs;
186 struct dentry *isr_decrypt_done;
187 struct dentry *isr_dma0_done;
188 struct dentry *isr_dma1_done;
189 struct dentry *isr_tx_exch_complete;
190 struct dentry *isr_commands;
191 struct dentry *isr_rx_procs;
192 struct dentry *isr_hw_pm_mode_changes;
193 struct dentry *isr_host_acknowledges;
194 struct dentry *isr_pci_pm;
195 struct dentry *isr_wakeups;
196 struct dentry *isr_low_rssi;
198 struct dentry *wep_addr_key_count;
199 struct dentry *wep_default_key_count;
201 struct dentry *wep_key_not_found;
202 struct dentry *wep_decrypt_fail;
203 struct dentry *wep_packets;
204 struct dentry *wep_interrupt;
206 struct dentry *pwr_ps_enter;
207 struct dentry *pwr_elp_enter;
208 struct dentry *pwr_missing_bcns;
209 struct dentry *pwr_wake_on_host;
210 struct dentry *pwr_wake_on_timer_exp;
211 struct dentry *pwr_tx_with_ps;
212 struct dentry *pwr_tx_without_ps;
213 struct dentry *pwr_rcvd_beacons;
214 struct dentry *pwr_power_save_off;
215 struct dentry *pwr_enable_ps;
216 struct dentry *pwr_disable_ps;
217 struct dentry *pwr_fix_tsf_ps;
219 struct dentry *pwr_rcvd_awake_beacons;
221 struct dentry *mic_rx_pkts;
222 struct dentry *mic_calc_failure;
224 struct dentry *aes_encrypt_fail;
225 struct dentry *aes_decrypt_fail;
226 struct dentry *aes_encrypt_packets;
227 struct dentry *aes_decrypt_packets;
228 struct dentry *aes_encrypt_interrupt;
229 struct dentry *aes_decrypt_interrupt;
231 struct dentry *event_heart_beat;
232 struct dentry *event_calibration;
233 struct dentry *event_rx_mismatch;
234 struct dentry *event_rx_mem_empty;
235 struct dentry *event_rx_pool;
236 struct dentry *event_oom_late;
237 struct dentry *event_phy_transmit_error;
238 struct dentry *event_tx_stuck;
240 struct dentry *ps_pspoll_timeouts;
241 struct dentry *ps_upsd_timeouts;
242 struct dentry *ps_upsd_max_sptime;
243 struct dentry *ps_upsd_max_apturn;
244 struct dentry *ps_pspoll_max_apturn;
245 struct dentry *ps_pspoll_utilization;
246 struct dentry *ps_upsd_utilization;
248 struct dentry *rxpipe_rx_prep_beacon_drop;
249 struct dentry *rxpipe_descr_host_int_trig_rx_data;
250 struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data;
251 struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data;
252 struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data;
254 struct dentry *tx_queue_len;
255 struct dentry *tx_queue_status;
257 struct dentry *retry_count;
258 struct dentry *excessive_retries;
/linux-4.1.27/arch/x86/xen/
H A Ddebugfs.h4 struct dentry * __init xen_init_debugfs(void);
H A Ddebugfs.c8 static struct dentry *d_xen_debug;
10 struct dentry * __init xen_init_debugfs(void) xen_init_debugfs()
/linux-4.1.27/fs/9p/
H A Dfid.c38 * v9fs_fid_add - add a fid to a dentry
39 * @dentry: dentry that the fid is being added to
44 static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid) __add_fid() argument
46 hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata); __add_fid()
49 void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) v9fs_fid_add() argument
51 spin_lock(&dentry->d_lock); v9fs_fid_add()
52 __add_fid(dentry, fid); v9fs_fid_add()
53 spin_unlock(&dentry->d_lock); v9fs_fid_add()
58 * @dentry: dentry to look for fid in
60 * @any: if non-zero, return any fid associated with the dentry
64 static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) v9fs_fid_find() argument
68 p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p) uid %d any %d\n", v9fs_fid_find()
69 dentry, dentry, from_kuid(&init_user_ns, uid), v9fs_fid_find()
73 if (dentry->d_fsdata) { v9fs_fid_find()
74 struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata; v9fs_fid_find()
75 spin_lock(&dentry->d_lock); hlist_for_each_entry()
82 spin_unlock(&dentry->d_lock);
91 * dentry names.
94 struct dentry *dentry, char ***names) build_path_from_dentry()
98 struct dentry *ds; build_path_from_dentry()
100 for (ds = dentry; !IS_ROOT(ds); ds = ds->d_parent) build_path_from_dentry()
107 for (ds = dentry, i = (n-1); i >= 0; i--, ds = ds->d_parent) build_path_from_dentry()
116 static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, v9fs_fid_lookup_with_uid() argument
119 struct dentry *ds; v9fs_fid_lookup_with_uid()
125 v9ses = v9fs_dentry2v9ses(dentry); v9fs_fid_lookup_with_uid()
127 fid = v9fs_fid_find(dentry, uid, any); v9fs_fid_lookup_with_uid()
136 ds = dentry->d_parent; v9fs_fid_lookup_with_uid()
140 fid = p9_client_walk(fid, 1, (char **)&dentry->d_name.name, 1); v9fs_fid_lookup_with_uid()
146 fid = v9fs_fid_find(dentry->d_sb->s_root, uid, any); v9fs_fid_lookup_with_uid()
162 v9fs_fid_add(dentry->d_sb->s_root, fid); v9fs_fid_lookup_with_uid()
165 if (dentry->d_sb->s_root == dentry) v9fs_fid_lookup_with_uid()
173 n = build_path_from_dentry(v9ses, dentry, &wnames); v9fs_fid_lookup_with_uid()
206 spin_lock(&dentry->d_lock); v9fs_fid_lookup_with_uid()
207 if (d_unhashed(dentry)) { v9fs_fid_lookup_with_uid()
208 spin_unlock(&dentry->d_lock); v9fs_fid_lookup_with_uid()
212 __add_fid(dentry, fid); v9fs_fid_lookup_with_uid()
213 spin_unlock(&dentry->d_lock); v9fs_fid_lookup_with_uid()
223 * @dentry: dentry to look for fid in
225 * Look for a fid in the specified dentry for the current user.
227 * dentry (if it has one), or the root dentry. If the user haven't accessed
231 struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) v9fs_fid_lookup() argument
237 v9ses = v9fs_dentry2v9ses(dentry); v9fs_fid_lookup()
257 return v9fs_fid_lookup_with_uid(dentry, uid, any); v9fs_fid_lookup()
260 struct p9_fid *v9fs_fid_clone(struct dentry *dentry) v9fs_fid_clone() argument
264 fid = v9fs_fid_lookup(dentry); v9fs_fid_clone()
272 static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, kuid_t uid) v9fs_fid_clone_with_uid() argument
276 fid = v9fs_fid_lookup_with_uid(dentry, uid, 0); v9fs_fid_clone_with_uid()
284 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) v9fs_writeback_fid() argument
289 fid = v9fs_fid_clone_with_uid(dentry, GLOBAL_ROOT_UID); v9fs_writeback_fid()
93 build_path_from_dentry(struct v9fs_session_info *v9ses, struct dentry *dentry, char ***names) build_path_from_dentry() argument
H A Dvfs_dentry.c4 * This file contians vfs dentry ops for the 9P2000 protocol.
46 * v9fs_cached_dentry_delete - called when dentry refcount equals 0
47 * @dentry: dentry in question
50 static int v9fs_cached_dentry_delete(const struct dentry *dentry) v9fs_cached_dentry_delete() argument
52 p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n", v9fs_cached_dentry_delete()
53 dentry, dentry); v9fs_cached_dentry_delete()
56 if (d_really_is_negative(dentry)) v9fs_cached_dentry_delete()
62 * v9fs_dentry_release - called when dentry is going to be freed
63 * @dentry: dentry that is being release
67 static void v9fs_dentry_release(struct dentry *dentry) v9fs_dentry_release() argument
70 p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n", v9fs_dentry_release()
71 dentry, dentry); v9fs_dentry_release()
72 hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata) v9fs_dentry_release()
74 dentry->d_fsdata = NULL; v9fs_dentry_release()
77 static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) v9fs_lookup_revalidate() argument
86 inode = d_inode(dentry); v9fs_lookup_revalidate()
94 fid = v9fs_fid_lookup(dentry); v9fs_lookup_revalidate()
H A Dfid.h26 struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
27 struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
28 void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
29 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
H A Dvfs_inode.c394 v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
407 err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name,
427 err = v9fs_fid_insert(ret, dentry);
581 * @dentry: dentry that is being deleted
586 static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags) v9fs_remove() argument
593 p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n", v9fs_remove()
594 dir, dentry, flags); v9fs_remove()
597 inode = d_inode(dentry); v9fs_remove()
598 dfid = v9fs_fid_lookup(dentry->d_parent); v9fs_remove()
605 retval = p9_client_unlinkat(dfid, dentry->d_name.name, v9fs_remove()
609 v9fid = v9fs_fid_clone(dentry); v9fs_remove()
634 * @dir: directory that dentry is being created in
635 * @dentry: dentry that is being created
643 struct dentry *dentry, char *extension, u32 perm, u8 mode) v9fs_create()
650 p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); v9fs_create()
655 name = (char *) dentry->d_name.name; v9fs_create()
656 dfid = v9fs_fid_lookup(dentry->d_parent); v9fs_create()
688 * instantiate inode and assign the unopened fid to the dentry v9fs_create()
697 v9fs_fid_add(dentry, fid); v9fs_create()
698 d_instantiate(dentry, inode); v9fs_create()
718 * @dentry: dentry that is being deleted
724 v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, v9fs_vfs_create() argument
732 fid = v9fs_create(v9ses, dir, dentry, NULL, perm, P9_ORDWR); v9fs_vfs_create()
745 * @dentry: dentry that is being unlinked
750 static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) v9fs_vfs_mkdir() argument
757 p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); v9fs_vfs_mkdir()
761 fid = v9fs_create(v9ses, dir, dentry, NULL, perm, P9_OREAD); v9fs_vfs_mkdir()
779 * @dentry: dentry that is being walked to?
784 struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, v9fs_vfs_lookup() argument
787 struct dentry *res; v9fs_vfs_lookup()
793 p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%pd) %p flags: %x\n", v9fs_vfs_lookup()
794 dir, dentry, dentry, flags); v9fs_vfs_lookup()
796 if (dentry->d_name.len > NAME_MAX) v9fs_vfs_lookup()
801 dfid = v9fs_fid_lookup(dentry->d_parent); v9fs_vfs_lookup()
805 name = (char *) dentry->d_name.name; v9fs_vfs_lookup()
809 d_add(dentry, NULL); v9fs_vfs_lookup()
834 res = d_splice_alias(inode, dentry); v9fs_vfs_lookup()
836 v9fs_fid_add(dentry, fid); v9fs_vfs_lookup()
845 v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, v9fs_vfs_atomic_open() argument
854 struct dentry *res = NULL; v9fs_vfs_atomic_open()
856 if (d_unhashed(dentry)) { v9fs_vfs_atomic_open()
857 res = v9fs_vfs_lookup(dir, dentry, 0); v9fs_vfs_atomic_open()
862 dentry = res; v9fs_vfs_atomic_open()
866 if (!(flags & O_CREAT) || d_really_is_positive(dentry)) v9fs_vfs_atomic_open()
873 fid = v9fs_create(v9ses, dir, dentry, NULL, perm, v9fs_vfs_atomic_open()
883 v9inode = V9FS_I(d_inode(dentry)); v9fs_vfs_atomic_open()
895 inode_fid = v9fs_writeback_fid(dentry); v9fs_vfs_atomic_open()
904 err = finish_open(file, dentry, generic_file_open, opened); v9fs_vfs_atomic_open()
910 v9fs_cache_inode_set_cookie(d_inode(dentry), file); v9fs_vfs_atomic_open()
926 * @d: dentry that is being unlinked
930 int v9fs_vfs_unlink(struct inode *i, struct dentry *d) v9fs_vfs_unlink()
938 * @d: dentry that is being unlinked
942 int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) v9fs_vfs_rmdir()
950 * @old_dentry: old dentry
952 * @new_dentry: new dentry
957 v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, v9fs_vfs_rename()
958 struct inode *new_dir, struct dentry *new_dentry) v9fs_vfs_rename()
1047 * @dentry: file to get attributes on
1053 v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, v9fs_vfs_getattr() argument
1060 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); v9fs_vfs_getattr()
1061 v9ses = v9fs_dentry2v9ses(dentry); v9fs_vfs_getattr()
1063 generic_fillattr(d_inode(dentry), stat); v9fs_vfs_getattr()
1066 fid = v9fs_fid_lookup(dentry); v9fs_vfs_getattr()
1074 v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb); v9fs_vfs_getattr()
1075 generic_fillattr(d_inode(dentry), stat); v9fs_vfs_getattr()
1084 * @dentry: file whose metadata to set
1089 static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) v9fs_vfs_setattr() argument
1097 retval = inode_change_ok(d_inode(dentry), iattr); v9fs_vfs_setattr()
1102 v9ses = v9fs_dentry2v9ses(dentry); v9fs_vfs_setattr()
1103 fid = v9fs_fid_lookup(dentry); v9fs_vfs_setattr()
1129 if (d_is_reg(dentry)) v9fs_vfs_setattr()
1130 filemap_write_and_wait(d_inode(dentry)->i_mapping); v9fs_vfs_setattr()
1137 iattr->ia_size != i_size_read(d_inode(dentry))) v9fs_vfs_setattr()
1138 truncate_setsize(d_inode(dentry), iattr->ia_size); v9fs_vfs_setattr()
1140 v9fs_invalidate_inode_attr(d_inode(dentry)); v9fs_vfs_setattr()
1142 setattr_copy(d_inode(dentry), iattr); v9fs_vfs_setattr()
1143 mark_inode_dirty(d_inode(dentry)); v9fs_vfs_setattr()
1227 * @dentry: dentry for symlink
1233 static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) v9fs_readlink() argument
1241 p9_debug(P9_DEBUG_VFS, " %pd\n", dentry); v9fs_readlink()
1243 v9ses = v9fs_dentry2v9ses(dentry); v9fs_readlink()
1244 fid = v9fs_fid_lookup(dentry); v9fs_readlink()
1265 dentry, st->extension, buflen, buffer); v9fs_readlink()
1275 * @dentry: dentry for symlink
1280 static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) v9fs_vfs_follow_link() argument
1285 p9_debug(P9_DEBUG_VFS, "%pd\n", dentry); v9fs_vfs_follow_link()
1290 len = v9fs_readlink(dentry, link, PATH_MAX); v9fs_vfs_follow_link()
1305 * @dentry: dentry for symlink
1312 v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) v9fs_vfs_put_link() argument
1317 dentry, IS_ERR(s) ? "<error>" : s); v9fs_vfs_put_link()
1325 * @dentry: dentry to create
1331 static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, v9fs_vfs_mkspecial() argument
1343 fid = v9fs_create(v9ses, dir, dentry, (char *) extension, perm, v9fs_vfs_mkspecial()
1356 * @dentry: dentry for symlink
1364 v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) v9fs_vfs_symlink() argument
1367 dir->i_ino, dentry, symname); v9fs_vfs_symlink()
1369 return v9fs_vfs_mkspecial(dir, dentry, P9_DMSYMLINK, symname); v9fs_vfs_symlink()
1374 * @old_dentry: dentry for file to link to
1376 * @dentry: dentry for link
1381 v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, v9fs_vfs_link() argument
1382 struct dentry *dentry) v9fs_vfs_link()
1389 dir->i_ino, dentry, old_dentry); v9fs_vfs_link()
1402 retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); v9fs_vfs_link()
1416 * @dentry: dentry for file
1423 v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) v9fs_vfs_mknod() argument
1431 dir->i_ino, dentry, mode, v9fs_vfs_mknod()
1455 retval = v9fs_vfs_mkspecial(dir, dentry, perm, name); v9fs_vfs_mknod()
642 v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, struct dentry *dentry, char *extension, u32 perm, u8 mode) v9fs_create() argument
H A Dxattr_security.c22 static int v9fs_xattr_security_get(struct dentry *dentry, const char *name, v9fs_xattr_security_get() argument
44 retval = v9fs_xattr_get(dentry, full_name, buffer, size); v9fs_xattr_security_get()
49 static int v9fs_xattr_security_set(struct dentry *dentry, const char *name, v9fs_xattr_security_set() argument
71 retval = v9fs_xattr_set(dentry, full_name, value, size, flags); v9fs_xattr_security_set()
H A Dxattr_trusted.c22 static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name, v9fs_xattr_trusted_get() argument
44 retval = v9fs_xattr_get(dentry, full_name, buffer, size); v9fs_xattr_trusted_get()
49 static int v9fs_xattr_trusted_set(struct dentry *dentry, const char *name, v9fs_xattr_trusted_set() argument
71 retval = v9fs_xattr_set(dentry, full_name, value, size, flags); v9fs_xattr_trusted_set()
H A Dxattr_user.c22 static int v9fs_xattr_user_get(struct dentry *dentry, const char *name, v9fs_xattr_user_get() argument
44 retval = v9fs_xattr_get(dentry, full_name, buffer, size); v9fs_xattr_user_get()
49 static int v9fs_xattr_user_set(struct dentry *dentry, const char *name, v9fs_xattr_user_set() argument
71 retval = v9fs_xattr_set(dentry, full_name, value, size, flags); v9fs_xattr_user_set()
H A Dvfs_inode_dotl.c51 v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
227 * @dentry: dentry that is being deleted
233 v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, v9fs_vfs_create_dotl() argument
236 return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); v9fs_vfs_create_dotl()
240 v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, v9fs_vfs_atomic_open_dotl() argument
255 struct dentry *res = NULL; v9fs_vfs_atomic_open_dotl()
257 if (d_unhashed(dentry)) { v9fs_vfs_atomic_open_dotl()
258 res = v9fs_vfs_lookup(dir, dentry, 0); v9fs_vfs_atomic_open_dotl()
263 dentry = res; v9fs_vfs_atomic_open_dotl()
267 if (!(flags & O_CREAT) || d_really_is_positive(dentry)) v9fs_vfs_atomic_open_dotl()
272 name = (char *) dentry->d_name.name; v9fs_vfs_atomic_open_dotl()
276 dfid = v9fs_fid_lookup(dentry->d_parent); v9fs_vfs_atomic_open_dotl()
310 /* instantiate inode and assign the unopened fid to the dentry */ v9fs_vfs_atomic_open_dotl()
327 v9fs_fid_add(dentry, fid); v9fs_vfs_atomic_open_dotl()
328 d_instantiate(dentry, inode); v9fs_vfs_atomic_open_dotl()
342 inode_fid = v9fs_writeback_fid(dentry); v9fs_vfs_atomic_open_dotl()
352 err = finish_open(file, dentry, generic_file_open, opened); v9fs_vfs_atomic_open_dotl()
376 * @dentry: dentry that is being unlinked
382 struct dentry *dentry, umode_t omode) v9fs_vfs_mkdir_dotl()
392 struct dentry *dir_dentry; v9fs_vfs_mkdir_dotl()
395 p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); v9fs_vfs_mkdir_dotl()
403 dir_dentry = dentry->d_parent; v9fs_vfs_mkdir_dotl()
421 name = (char *) dentry->d_name.name; v9fs_vfs_mkdir_dotl()
435 /* instantiate inode and assign the unopened fid to the dentry */ v9fs_vfs_mkdir_dotl()
444 v9fs_fid_add(dentry, fid); v9fs_vfs_mkdir_dotl()
446 d_instantiate(dentry, inode); v9fs_vfs_mkdir_dotl()
453 * so that we can set the acl with dentry v9fs_vfs_mkdir_dotl()
461 d_instantiate(dentry, inode); v9fs_vfs_mkdir_dotl()
473 v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, v9fs_vfs_getattr_dotl() argument
480 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); v9fs_vfs_getattr_dotl()
481 v9ses = v9fs_dentry2v9ses(dentry); v9fs_vfs_getattr_dotl()
483 generic_fillattr(d_inode(dentry), stat); v9fs_vfs_getattr_dotl()
486 fid = v9fs_fid_lookup(dentry); v9fs_vfs_getattr_dotl()
498 v9fs_stat2inode_dotl(st, d_inode(dentry)); v9fs_vfs_getattr_dotl()
499 generic_fillattr(d_inode(dentry), stat); v9fs_vfs_getattr_dotl()
549 * @dentry: file whose metadata to set
554 int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) v9fs_vfs_setattr_dotl() argument
559 struct inode *inode = d_inode(dentry); v9fs_vfs_setattr_dotl()
577 fid = v9fs_fid_lookup(dentry); v9fs_vfs_setattr_dotl()
678 v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, v9fs_vfs_symlink_dotl() argument
690 name = (char *) dentry->d_name.name; v9fs_vfs_symlink_dotl()
694 dfid = v9fs_fid_lookup(dentry->d_parent); v9fs_vfs_symlink_dotl()
723 /* instantiate inode and assign the unopened fid to dentry */ v9fs_vfs_symlink_dotl()
731 v9fs_fid_add(dentry, fid); v9fs_vfs_symlink_dotl()
732 d_instantiate(dentry, inode); v9fs_vfs_symlink_dotl()
742 d_instantiate(dentry, inode); v9fs_vfs_symlink_dotl()
754 * @old_dentry: dentry for file to link to
756 * @dentry: dentry for link
761 v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, v9fs_vfs_link_dotl() argument
762 struct dentry *dentry) v9fs_vfs_link_dotl()
765 struct dentry *dir_dentry; v9fs_vfs_link_dotl()
770 dir->i_ino, old_dentry, dentry); v9fs_vfs_link_dotl()
773 dir_dentry = dentry->d_parent; v9fs_vfs_link_dotl()
782 err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name); v9fs_vfs_link_dotl()
800 d_instantiate(dentry, d_inode(old_dentry)); v9fs_vfs_link_dotl()
808 * @dentry: dentry for file
814 v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, v9fs_vfs_mknod_dotl() argument
825 struct dentry *dir_dentry; v9fs_vfs_mknod_dotl()
829 dir->i_ino, dentry, omode, v9fs_vfs_mknod_dotl()
836 dir_dentry = dentry->d_parent; v9fs_vfs_mknod_dotl()
854 name = (char *) dentry->d_name.name; v9fs_vfs_mknod_dotl()
870 /* instantiate inode and assign the unopened fid to the dentry */ v9fs_vfs_mknod_dotl()
880 v9fs_fid_add(dentry, fid); v9fs_vfs_mknod_dotl()
881 d_instantiate(dentry, inode); v9fs_vfs_mknod_dotl()
895 d_instantiate(dentry, inode); v9fs_vfs_mknod_dotl()
906 * @dentry: dentry for symlink
912 v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) v9fs_vfs_follow_link_dotl() argument
919 p9_debug(P9_DEBUG_VFS, "%pd\n", dentry); v9fs_vfs_follow_link_dotl()
925 fid = v9fs_fid_lookup(dentry); v9fs_vfs_follow_link_dotl()
381 v9fs_vfs_mkdir_dotl(struct inode *dir, struct dentry *dentry, umode_t omode) v9fs_vfs_mkdir_dotl() argument
H A Dxattr.h30 extern ssize_t v9fs_xattr_get(struct dentry *, const char *,
34 extern int v9fs_xattr_set(struct dentry *, const char *,
36 extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t);
H A Dacl.c215 static int v9fs_remote_get_acl(struct dentry *dentry, const char *name, v9fs_remote_get_acl() argument
230 return v9fs_xattr_get(dentry, full_name, buffer, size); v9fs_remote_get_acl()
233 static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, v9fs_xattr_get_acl() argument
243 v9ses = v9fs_dentry2v9ses(dentry); v9fs_xattr_get_acl()
248 return v9fs_remote_get_acl(dentry, name, buffer, size, type); v9fs_xattr_get_acl()
250 acl = v9fs_get_cached_acl(d_inode(dentry), type); v9fs_xattr_get_acl()
261 static int v9fs_remote_set_acl(struct dentry *dentry, const char *name, v9fs_remote_set_acl() argument
277 return v9fs_xattr_set(dentry, full_name, value, size, flags); v9fs_remote_set_acl()
281 static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, v9fs_xattr_set_acl() argument
288 struct inode *inode = d_inode(dentry); v9fs_xattr_set_acl()
293 v9ses = v9fs_dentry2v9ses(dentry); v9fs_xattr_set_acl()
299 return v9fs_remote_set_acl(dentry, name, v9fs_xattr_set_acl()
347 v9fs_vfs_setattr_dotl(dentry, &iattr); v9fs_xattr_set_acl()
361 retval = v9fs_xattr_set(dentry, name, value, size, flags); v9fs_xattr_set_acl()
/linux-4.1.27/fs/hpfs/
H A Ddentry.c2 * linux/fs/hpfs/dentry.c
12 * Note: the dentry argument is the parent dentry.
15 static int hpfs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) hpfs_hash_dentry() argument
31 hash = partial_name_hash(hpfs_upcase(hpfs_sb(dentry->d_sb)->sb_cp_table,qstr->name[i]), hash); hpfs_hash_dentry()
37 static int hpfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, hpfs_compare_dentry() argument
47 * 'str' is the nane of an already existing dentry, so the name hpfs_compare_dentry()
H A DMakefile7 hpfs-objs := alloc.o anode.o buffer.o dentry.o dir.o dnode.o ea.o file.o \
H A Dnamei.c22 static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) hpfs_mkdir() argument
24 const unsigned char *name = dentry->d_name.name; hpfs_mkdir()
25 unsigned len = dentry->d_name.len; hpfs_mkdir()
114 d_instantiate(dentry, result); hpfs_mkdir()
130 static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) hpfs_create() argument
132 const unsigned char *name = dentry->d_name.name; hpfs_create()
133 unsigned len = dentry->d_name.len; hpfs_create()
203 d_instantiate(dentry, result); hpfs_create()
217 static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) hpfs_mknod() argument
219 const unsigned char *name = dentry->d_name.name; hpfs_mknod()
220 unsigned len = dentry->d_name.len; hpfs_mknod()
279 d_instantiate(dentry, result); hpfs_mknod()
293 static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink) hpfs_symlink() argument
295 const unsigned char *name = dentry->d_name.name; hpfs_symlink()
296 unsigned len = dentry->d_name.len; hpfs_symlink()
358 d_instantiate(dentry, result); hpfs_symlink()
371 static int hpfs_unlink(struct inode *dir, struct dentry *dentry) hpfs_unlink() argument
373 const unsigned char *name = dentry->d_name.name; hpfs_unlink()
374 unsigned len = dentry->d_name.len; hpfs_unlink()
377 struct inode *inode = d_inode(dentry); hpfs_unlink()
422 static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) hpfs_rmdir() argument
424 const unsigned char *name = dentry->d_name.name; hpfs_rmdir()
425 unsigned len = dentry->d_name.len; hpfs_rmdir()
428 struct inode *inode = d_inode(dentry); hpfs_rmdir()
512 static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, hpfs_rename()
513 struct inode *new_dir, struct dentry *new_dentry) hpfs_rename()
/linux-4.1.27/fs/minix/
H A Dnamei.c9 static int add_nondir(struct dentry *dentry, struct inode *inode) add_nondir() argument
11 int err = minix_add_link(dentry, inode); add_nondir()
13 d_instantiate(dentry, inode); add_nondir()
21 static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) minix_lookup() argument
26 if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen) minix_lookup()
29 ino = minix_inode_by_name(dentry); minix_lookup()
35 d_add(dentry, inode); minix_lookup()
39 static int minix_mknod(struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) minix_mknod() argument
52 error = add_nondir(dentry, inode); minix_mknod()
57 static int minix_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) minix_tmpfile() argument
64 d_tmpfile(dentry, inode); minix_tmpfile()
69 static int minix_create(struct inode *dir, struct dentry *dentry, umode_t mode, minix_create() argument
72 return minix_mknod(dir, dentry, mode, 0); minix_create()
75 static int minix_symlink(struct inode * dir, struct dentry *dentry, minix_symlink() argument
94 err = add_nondir(dentry, inode); minix_symlink()
104 static int minix_link(struct dentry * old_dentry, struct inode * dir, minix_link() argument
105 struct dentry *dentry) minix_link()
112 return add_nondir(dentry, inode); minix_link()
115 static int minix_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode) minix_mkdir() argument
134 err = minix_add_link(dentry, inode); minix_mkdir()
138 d_instantiate(dentry, inode); minix_mkdir()
151 static int minix_unlink(struct inode * dir, struct dentry *dentry) minix_unlink() argument
154 struct inode * inode = d_inode(dentry); minix_unlink()
158 de = minix_find_entry(dentry, &page); minix_unlink()
172 static int minix_rmdir(struct inode * dir, struct dentry *dentry) minix_rmdir() argument
174 struct inode * inode = d_inode(dentry); minix_rmdir()
178 err = minix_unlink(dir, dentry); minix_rmdir()
187 static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, minix_rename()
188 struct inode * new_dir, struct dentry *new_dentry) minix_rename()
H A Dfile.c24 static int minix_setattr(struct dentry *dentry, struct iattr *attr) minix_setattr() argument
26 struct inode *inode = d_inode(dentry); minix_setattr()
/linux-4.1.27/fs/autofs4/
H A Dexpire.c19 /* Check if a dentry can be expired */ autofs4_can_expire()
20 static inline int autofs4_can_expire(struct dentry *dentry, autofs4_can_expire() argument
23 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_can_expire()
25 /* dentry in the process of being deleted */ autofs4_can_expire()
38 static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) autofs4_mount_busy() argument
40 struct dentry *top = dentry; autofs4_mount_busy()
41 struct path path = {.mnt = mnt, .dentry = dentry}; autofs4_mount_busy()
44 DPRINTK("dentry %p %pd", dentry, dentry); autofs4_mount_busy()
51 if (is_autofs4_dentry(path.dentry)) { autofs4_mount_busy()
52 struct autofs_sb_info *sbi = autofs4_sbi(path.dentry->d_sb); autofs4_mount_busy()
76 static struct dentry *get_next_positive_subdir(struct dentry *prev, get_next_positive_subdir()
77 struct dentry *root) get_next_positive_subdir()
81 struct dentry *q; get_next_positive_subdir()
101 q = list_entry(next, struct dentry, d_child); get_next_positive_subdir()
104 /* Already gone or negative dentry (under construction) - try next */ get_next_positive_subdir()
123 static struct dentry *get_next_positive_dentry(struct dentry *prev, get_next_positive_dentry()
124 struct dentry *root) get_next_positive_dentry()
128 struct dentry *p, *ret; get_next_positive_dentry()
141 struct dentry *parent; get_next_positive_dentry()
163 ret = list_entry(next, struct dentry, d_child); get_next_positive_dentry()
166 /* Negative dentry - try next */ get_next_positive_dentry()
190 struct dentry *top, autofs4_direct_busy()
204 /* Timeout of a direct mount is determined by its top dentry */ autofs4_direct_busy()
215 struct dentry *top, autofs4_tree_busy()
220 struct dentry *p; autofs4_tree_busy()
224 /* Negative dentry - give up */ autofs4_tree_busy()
230 DPRINTK("dentry %p %pd", p, p); autofs4_tree_busy()
235 * count for the autofs dentry. autofs4_tree_busy()
262 /* Timeout of a tree mount is ultimately determined by its top dentry */ autofs4_tree_busy()
269 static struct dentry *autofs4_check_leaves(struct vfsmount *mnt, autofs4_check_leaves()
270 struct dentry *parent, autofs4_check_leaves()
274 struct dentry *p; autofs4_check_leaves()
280 DPRINTK("dentry %p %pd", p, p); autofs4_check_leaves()
296 struct dentry *autofs4_expire_direct(struct super_block *sb, autofs4_expire_direct()
302 struct dentry *root = dget(sb->s_root); autofs4_expire_direct()
339 /* Check if 'dentry' should expire, or return a nearby
340 * dentry that is suitable.
341 * If returned dentry is different from arg dentry,
344 static struct dentry *should_expire(struct dentry *dentry, should_expire() argument
351 struct autofs_info *ino = autofs4_dentry_ino(dentry); should_expire()
364 if (d_mountpoint(dentry)) { should_expire()
365 DPRINTK("checking mountpoint %p %pd", dentry, dentry); should_expire()
368 if (autofs4_mount_busy(mnt, dentry)) should_expire()
372 if (autofs4_can_expire(dentry, timeout, do_now)) should_expire()
373 return dentry; should_expire()
377 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { should_expire()
378 DPRINTK("checking symlink %p %pd", dentry, dentry); should_expire()
383 if (autofs4_can_expire(dentry, timeout, do_now)) should_expire()
384 return dentry; should_expire()
388 if (simple_empty(dentry)) should_expire()
393 /* Path walk currently on this dentry? */ should_expire()
395 if (d_count(dentry) > ino_count) should_expire()
398 if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) should_expire()
399 return dentry; should_expire()
405 /* Path walk currently on this dentry? */ should_expire()
406 struct dentry *expired; should_expire()
408 if (d_count(dentry) > ino_count) should_expire()
411 expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); should_expire()
413 if (expired == dentry) should_expire()
414 dput(dentry); should_expire()
426 struct dentry *autofs4_expire_indirect(struct super_block *sb, autofs4_expire_indirect()
432 struct dentry *root = sb->s_root; autofs4_expire_indirect()
433 struct dentry *dentry; autofs4_expire_indirect() local
434 struct dentry *expired; autofs4_expire_indirect()
443 dentry = NULL; autofs4_expire_indirect()
444 while ((dentry = get_next_positive_subdir(dentry, root))) { autofs4_expire_indirect()
446 ino = autofs4_dentry_ino(dentry); autofs4_expire_indirect()
450 expired = should_expire(dentry, mnt, timeout, how); autofs4_expire_indirect()
461 if (expired != dentry) autofs4_expire_indirect()
462 dput(dentry); autofs4_expire_indirect()
467 if (expired != dentry) autofs4_expire_indirect()
490 int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) autofs4_expire_wait() argument
492 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_expire_wait()
493 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_expire_wait()
506 DPRINTK("waiting for expire %p name=%pd", dentry, dentry); autofs4_expire_wait()
508 status = autofs4_wait(sbi, dentry, NFY_NONE); autofs4_expire_wait()
513 if (d_unhashed(dentry)) autofs4_expire_wait()
531 struct dentry *dentry; autofs4_expire_run() local
539 if ((dentry = autofs4_expire_indirect(sb, mnt, sbi, 0)) == NULL) autofs4_expire_run()
542 pkt.len = dentry->d_name.len; autofs4_expire_run()
543 memcpy(pkt.name, dentry->d_name.name, pkt.len); autofs4_expire_run()
545 dput(dentry); autofs4_expire_run()
551 ino = autofs4_dentry_ino(dentry); autofs4_expire_run()
564 struct dentry *dentry; autofs4_do_expire_multi() local
568 dentry = autofs4_expire_direct(sb, mnt, sbi, when); autofs4_do_expire_multi()
570 dentry = autofs4_expire_indirect(sb, mnt, sbi, when); autofs4_do_expire_multi()
572 if (dentry) { autofs4_do_expire_multi()
573 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_do_expire_multi()
577 ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); autofs4_do_expire_multi()
585 dput(dentry); autofs4_do_expire_multi()
H A Dautofs_i.h54 /* Unified info structure. This is pointed to by both the dentry and
56 structure. It holds a reference to the dentry, so dentries are never
58 dentry level, although the filesystem can interfere in the validation
59 process. Readdir is implemented by traversing the dentry lists. */
61 struct dentry *dentry; member in struct:autofs_info
81 #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */
82 #define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered
86 #define AUTOFS_INF_PENDING (1<<2) /* dentry pending mount */
137 static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) autofs4_dentry_ino() argument
139 return (struct autofs_info *)(dentry->d_fsdata); autofs4_dentry_ino()
154 int is_autofs4_dentry(struct dentry *);
155 int autofs4_expire_wait(struct dentry *dentry, int rcu_walk);
163 struct dentry *autofs4_expire_direct(struct super_block *sb,
166 struct dentry *autofs4_expire_indirect(struct super_block *sb,
184 static inline void __managed_dentry_set_managed(struct dentry *dentry) __managed_dentry_set_managed() argument
186 dentry->d_flags |= (DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT); __managed_dentry_set_managed()
189 static inline void managed_dentry_set_managed(struct dentry *dentry) managed_dentry_set_managed() argument
191 spin_lock(&dentry->d_lock); managed_dentry_set_managed()
192 __managed_dentry_set_managed(dentry); managed_dentry_set_managed()
193 spin_unlock(&dentry->d_lock); managed_dentry_set_managed()
196 static inline void __managed_dentry_clear_managed(struct dentry *dentry) __managed_dentry_clear_managed() argument
198 dentry->d_flags &= ~(DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT); __managed_dentry_clear_managed()
201 static inline void managed_dentry_clear_managed(struct dentry *dentry) managed_dentry_clear_managed() argument
203 spin_lock(&dentry->d_lock); managed_dentry_clear_managed()
204 __managed_dentry_clear_managed(dentry); managed_dentry_clear_managed()
205 spin_unlock(&dentry->d_lock); managed_dentry_clear_managed()
227 int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
241 static inline int simple_positive(struct dentry *dentry) simple_positive() argument
243 return d_really_is_positive(dentry) && !d_unhashed(dentry); simple_positive()
246 static inline void __autofs4_add_expiring(struct dentry *dentry) __autofs4_add_expiring() argument
248 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); __autofs4_add_expiring()
249 struct autofs_info *ino = autofs4_dentry_ino(dentry); __autofs4_add_expiring()
257 static inline void autofs4_add_expiring(struct dentry *dentry) autofs4_add_expiring() argument
259 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_add_expiring()
260 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_add_expiring()
270 static inline void autofs4_del_expiring(struct dentry *dentry) autofs4_del_expiring() argument
272 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_del_expiring()
273 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_del_expiring()
H A Droot.c26 static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
27 static int autofs4_dir_unlink(struct inode *,struct dentry *);
28 static int autofs4_dir_rmdir(struct inode *,struct dentry *);
29 static int autofs4_dir_mkdir(struct inode *,struct dentry *,umode_t);
35 static struct dentry *autofs4_lookup(struct inode *,struct dentry *, unsigned int);
37 static int autofs4_d_manage(struct dentry *, bool);
38 static void autofs4_dentry_release(struct dentry *);
74 static void autofs4_add_active(struct dentry *dentry) autofs4_add_active() argument
76 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_add_active()
77 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_add_active()
90 static void autofs4_del_active(struct dentry *dentry) autofs4_del_active() argument
92 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_del_active()
93 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_del_active()
108 struct dentry *dentry = file->f_path.dentry; autofs4_dir_open() local
109 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_dir_open()
111 DPRINTK("file=%p dentry=%p %pd", file, dentry, dentry); autofs4_dir_open()
126 if (!d_mountpoint(dentry) && simple_empty(dentry)) { autofs4_dir_open()
136 static void autofs4_dentry_release(struct dentry *de) autofs4_dentry_release()
158 static struct dentry *autofs4_lookup_active(struct dentry *dentry) autofs4_lookup_active() argument
160 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_lookup_active()
161 struct dentry *parent = dentry->d_parent; autofs4_lookup_active()
162 struct qstr *name = &dentry->d_name; autofs4_lookup_active()
174 struct dentry *active; list_for_each()
178 active = ino->dentry; list_for_each()
212 static struct dentry *autofs4_lookup_expiring(struct dentry *dentry, autofs4_lookup_expiring() argument
215 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_lookup_expiring()
216 struct dentry *parent = dentry->d_parent; autofs4_lookup_expiring()
217 struct qstr *name = &dentry->d_name; autofs4_lookup_expiring()
229 struct dentry *expiring; list_for_each()
238 expiring = ino->dentry; list_for_each()
272 static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk) autofs4_mount_wait() argument
274 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_mount_wait()
275 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_mount_wait()
281 DPRINTK("waiting for mount name=%pd", dentry); autofs4_mount_wait()
282 status = autofs4_wait(sbi, dentry, NFY_MOUNT); autofs4_mount_wait()
289 static int do_expire_wait(struct dentry *dentry, bool rcu_walk) do_expire_wait() argument
291 struct dentry *expiring; do_expire_wait()
293 expiring = autofs4_lookup_expiring(dentry, rcu_walk); do_expire_wait()
297 return autofs4_expire_wait(dentry, rcu_walk); do_expire_wait()
311 static struct dentry *autofs4_mountpoint_changed(struct path *path) autofs4_mountpoint_changed()
313 struct dentry *dentry = path->dentry; autofs4_mountpoint_changed() local
314 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_mountpoint_changed()
317 * If this is an indirect mount the dentry could have gone away autofs4_mountpoint_changed()
320 if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { autofs4_mountpoint_changed()
321 struct dentry *parent = dentry->d_parent; autofs4_mountpoint_changed()
323 struct dentry *new = d_lookup(parent, &dentry->d_name); autofs4_mountpoint_changed()
328 dput(path->dentry); autofs4_mountpoint_changed()
329 path->dentry = new; autofs4_mountpoint_changed()
331 return path->dentry; autofs4_mountpoint_changed()
336 struct dentry *dentry = path->dentry; autofs4_d_automount() local
337 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_d_automount()
338 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_d_automount()
341 DPRINTK("dentry=%p %pd", dentry, dentry); autofs4_d_automount()
355 status = do_expire_wait(dentry, 0); autofs4_d_automount()
363 status = autofs4_mount_wait(dentry, 0); autofs4_d_automount()
370 * If the dentry is a symlink it's equivalent to a directory autofs4_d_automount()
374 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { autofs4_d_automount()
379 if (!d_mountpoint(dentry)) { autofs4_d_automount()
392 if (have_submounts(dentry)) { autofs4_d_automount()
397 if (!simple_empty(dentry)) { autofs4_d_automount()
404 status = autofs4_mount_wait(dentry, 0); autofs4_d_automount()
414 /* Mount succeeded, check if we ended up with a new dentry */ autofs4_d_automount()
415 dentry = autofs4_mountpoint_changed(path); autofs4_d_automount()
416 if (!dentry) autofs4_d_automount()
422 static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) autofs4_d_manage() argument
424 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_d_manage()
425 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_d_manage()
428 DPRINTK("dentry=%p %pd", dentry, dentry); autofs4_d_manage()
432 if (!d_mountpoint(dentry)) autofs4_d_manage()
438 if (do_expire_wait(dentry, rcu_walk) == -ECHILD) autofs4_d_manage()
442 * This dentry may be under construction so wait on mount autofs4_d_manage()
445 status = autofs4_mount_wait(dentry, rcu_walk); autofs4_d_manage()
460 if (d_mountpoint(dentry)) autofs4_d_manage()
462 inode = d_inode_rcu(dentry); autofs4_d_manage()
465 if (list_empty(&dentry->d_subdirs)) autofs4_d_manage()
467 if (!simple_empty(dentry)) autofs4_d_manage()
474 * If the dentry has been selected for expire while we slept autofs4_d_manage()
487 if ((!d_mountpoint(dentry) && !simple_empty(dentry)) || autofs4_d_manage()
488 (d_really_is_positive(dentry) && d_is_symlink(dentry))) autofs4_d_manage()
497 static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) autofs4_lookup() argument
501 struct dentry *active; autofs4_lookup()
503 DPRINTK("name = %pd", dentry); autofs4_lookup()
506 if (dentry->d_name.len > NAME_MAX) autofs4_lookup()
515 active = autofs4_lookup_active(dentry); autofs4_lookup()
520 * A dentry that is not within the root can never trigger a autofs4_lookup()
525 if (!autofs4_oz_mode(sbi) && !IS_ROOT(dentry->d_parent)) autofs4_lookup()
529 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) autofs4_lookup()
530 __managed_dentry_set_managed(dentry); autofs4_lookup()
536 dentry->d_fsdata = ino; autofs4_lookup()
537 ino->dentry = dentry; autofs4_lookup()
539 autofs4_add_active(dentry); autofs4_lookup()
541 d_instantiate(dentry, NULL); autofs4_lookup()
547 struct dentry *dentry, autofs4_dir_symlink()
551 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_dir_symlink()
557 DPRINTK("%s <- %pd", symname, dentry); autofs4_dir_symlink()
566 autofs4_del_active(dentry); autofs4_dir_symlink()
577 if (!dentry->d_fsdata) autofs4_dir_symlink()
583 d_add(dentry, inode); autofs4_dir_symlink()
585 dget(dentry); autofs4_dir_symlink()
587 p_ino = autofs4_dentry_ino(dentry->d_parent); autofs4_dir_symlink()
588 if (p_ino && !IS_ROOT(dentry)) autofs4_dir_symlink()
601 * VFS layer can turn the dentry into a negative dentry. We don't want
604 * which allows the dentry lookup to check for an incomplete expire.
606 * If a process is blocked on the dentry waiting for the expire to finish,
607 * it will invalidate the dentry and try to mount with a new one.
611 static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) autofs4_dir_unlink() argument
614 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_dir_unlink()
622 p_ino = autofs4_dentry_ino(dentry->d_parent); autofs4_dir_unlink()
623 if (p_ino && !IS_ROOT(dentry)) autofs4_dir_unlink()
626 dput(ino->dentry); autofs4_dir_unlink()
628 d_inode(dentry)->i_size = 0; autofs4_dir_unlink()
629 clear_nlink(d_inode(dentry)); autofs4_dir_unlink()
634 __autofs4_add_expiring(dentry); autofs4_dir_unlink()
635 d_drop(dentry); autofs4_dir_unlink()
652 static void autofs_set_leaf_automount_flags(struct dentry *dentry) autofs_set_leaf_automount_flags() argument
654 struct dentry *parent; autofs_set_leaf_automount_flags()
657 if (IS_ROOT(dentry->d_parent)) autofs_set_leaf_automount_flags()
660 managed_dentry_set_managed(dentry); autofs_set_leaf_automount_flags()
662 parent = dentry->d_parent; autofs_set_leaf_automount_flags()
670 static void autofs_clear_leaf_automount_flags(struct dentry *dentry) autofs_clear_leaf_automount_flags() argument
673 struct dentry *parent; autofs_clear_leaf_automount_flags()
676 if (IS_ROOT(dentry->d_parent)) autofs_clear_leaf_automount_flags()
679 managed_dentry_clear_managed(dentry); autofs_clear_leaf_automount_flags()
681 parent = dentry->d_parent; autofs_clear_leaf_automount_flags()
685 d_child = &dentry->d_child; autofs_clear_leaf_automount_flags()
693 static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) autofs4_dir_rmdir() argument
696 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_dir_rmdir()
699 DPRINTK("dentry %p, removing %pd", dentry, dentry); autofs4_dir_rmdir()
705 if (!simple_empty(dentry)) { autofs4_dir_rmdir()
709 __autofs4_add_expiring(dentry); autofs4_dir_rmdir()
710 d_drop(dentry); autofs4_dir_rmdir()
714 autofs_clear_leaf_automount_flags(dentry); autofs4_dir_rmdir()
717 p_ino = autofs4_dentry_ino(dentry->d_parent); autofs4_dir_rmdir()
718 if (p_ino && dentry->d_parent != dentry) autofs4_dir_rmdir()
721 dput(ino->dentry); autofs4_dir_rmdir()
722 d_inode(dentry)->i_size = 0; autofs4_dir_rmdir()
723 clear_nlink(d_inode(dentry)); autofs4_dir_rmdir()
731 static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) autofs4_dir_mkdir() argument
734 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_dir_mkdir()
741 DPRINTK("dentry %p, creating %pd", dentry, dentry); autofs4_dir_mkdir()
747 autofs4_del_active(dentry); autofs4_dir_mkdir()
752 d_add(dentry, inode); autofs4_dir_mkdir()
755 autofs_set_leaf_automount_flags(dentry); autofs4_dir_mkdir()
757 dget(dentry); autofs4_dir_mkdir()
759 p_ino = autofs4_dentry_ino(dentry->d_parent); autofs4_dir_mkdir()
760 if (p_ino && !IS_ROOT(dentry)) autofs4_dir_mkdir()
837 an extra dentry refcount or not. We only hold a refcount on the
838 dentry if its non-negative (ie, d_inode != NULL)
840 int is_autofs4_dentry(struct dentry *dentry) is_autofs4_dentry() argument
842 return dentry && d_really_is_positive(dentry) && is_autofs4_dentry()
843 dentry->d_op == &autofs4_dentry_operations && is_autofs4_dentry()
844 dentry->d_fsdata != NULL; is_autofs4_dentry()
546 autofs4_dir_symlink(struct inode *dir, struct dentry *dentry, const char *symname) autofs4_dir_symlink() argument
H A Dsymlink.c15 static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) autofs4_follow_link() argument
17 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); autofs4_follow_link()
18 struct autofs_info *ino = autofs4_dentry_ino(dentry); autofs4_follow_link()
21 nd_set_link(nd, d_inode(dentry)->i_private); autofs4_follow_link()
H A Dwaitq.c181 struct dentry *dentry, char **name) autofs4_getpath()
183 struct dentry *root = sbi->sb->s_root; autofs4_getpath()
184 struct dentry *tmp; autofs4_getpath()
197 for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent) autofs4_getpath()
209 p = buf + len - dentry->d_name.len; autofs4_getpath()
210 strncpy(p, dentry->d_name.name, dentry->d_name.len); autofs4_getpath()
212 for (tmp = dentry->d_parent; tmp != root ; tmp = tmp->d_parent) { autofs4_getpath()
251 struct dentry*dentry, enum autofs_notify notify) validate_request()
269 ino = autofs4_dentry_ino(dentry); validate_request()
314 struct dentry *new = NULL; validate_request()
318 * If the dentry was successfully mounted while we slept validate_request()
324 if (!IS_ROOT(dentry)) { validate_request()
325 if (d_really_is_positive(dentry) && d_unhashed(dentry)) { validate_request()
326 struct dentry *parent = dentry->d_parent; validate_request()
327 new = d_lookup(parent, &dentry->d_name); validate_request()
329 dentry = new; validate_request()
332 if (have_submounts(dentry)) validate_request()
343 int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, autofs4_wait() argument
367 if (d_really_is_negative(dentry)) { autofs4_wait()
369 * A wait for a negative dentry is invalid for certain autofs4_wait()
371 * point directory created and so the request dentry must autofs4_wait()
378 else if (!IS_ROOT(dentry->d_parent)) autofs4_wait()
387 if (IS_ROOT(dentry) && autofs_type_trigger(sbi->type)) autofs4_wait()
388 qstr.len = sprintf(name, "%p", dentry); autofs4_wait()
390 qstr.len = autofs4_getpath(sbi, dentry, &name); autofs4_wait()
404 ret = validate_request(&wq, sbi, &qstr, dentry, notify); autofs4_wait()
497 * uid and gid in the dentry info struct. This is so it can be autofs4_wait()
506 struct dentry *de = NULL; autofs4_wait()
509 ino = autofs4_dentry_ino(dentry); autofs4_wait()
511 /* If not lookup actual dentry used */ autofs4_wait()
512 de = d_lookup(dentry->d_parent, &dentry->d_name); autofs4_wait()
180 autofs4_getpath(struct autofs_sb_info *sbi, struct dentry *dentry, char **name) autofs4_getpath() argument
248 validate_request(struct autofs_wait_queue **wait, struct autofs_sb_info *sbi, struct qstr *qstr, struct dentry*dentry, enum autofs_notify notify) validate_request() argument
/linux-4.1.27/fs/sysv/
H A Dnamei.c18 static int add_nondir(struct dentry *dentry, struct inode *inode) add_nondir() argument
20 int err = sysv_add_link(dentry, inode); add_nondir()
22 d_instantiate(dentry, inode); add_nondir()
30 static int sysv_hash(const struct dentry *dentry, struct qstr *qstr) sysv_hash() argument
45 static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags) sysv_lookup() argument
50 if (dentry->d_name.len > SYSV_NAMELEN) sysv_lookup()
52 ino = sysv_inode_by_name(dentry); sysv_lookup()
59 d_add(dentry, inode); sysv_lookup()
63 static int sysv_mknod(struct inode * dir, struct dentry * dentry, umode_t mode, dev_t rdev) sysv_mknod() argument
77 err = add_nondir(dentry, inode); sysv_mknod()
82 static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) sysv_create() argument
84 return sysv_mknod(dir, dentry, mode, 0); sysv_create()
87 static int sysv_symlink(struct inode * dir, struct dentry * dentry, sysv_symlink() argument
108 err = add_nondir(dentry, inode); sysv_symlink()
118 static int sysv_link(struct dentry * old_dentry, struct inode * dir, sysv_link() argument
119 struct dentry * dentry) sysv_link()
127 return add_nondir(dentry, inode); sysv_link()
130 static int sysv_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode) sysv_mkdir() argument
150 err = sysv_add_link(dentry, inode); sysv_mkdir()
154 d_instantiate(dentry, inode); sysv_mkdir()
167 static int sysv_unlink(struct inode * dir, struct dentry * dentry) sysv_unlink() argument
169 struct inode * inode = d_inode(dentry); sysv_unlink()
174 de = sysv_find_entry(dentry, &page); sysv_unlink()
188 static int sysv_rmdir(struct inode * dir, struct dentry * dentry) sysv_rmdir() argument
190 struct inode *inode = d_inode(dentry); sysv_rmdir()
194 err = sysv_unlink(dir, dentry); sysv_rmdir()
208 static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, sysv_rename()
209 struct inode * new_dir, struct dentry * new_dentry) sysv_rename()
H A Dsymlink.c11 static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd) sysv_follow_link() argument
13 nd_set_link(nd, (char *)SYSV_I(d_inode(dentry))->i_data); sysv_follow_link()
H A Dfile.c31 static int sysv_setattr(struct dentry *dentry, struct iattr *attr) sysv_setattr() argument
33 struct inode *inode = d_inode(dentry); sysv_setattr()
/linux-4.1.27/fs/ceph/
H A Dexport.c61 static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) __fh_to_dentry()
65 struct dentry *dentry; __fh_to_dentry() local
91 dentry = d_obtain_alias(inode); __fh_to_dentry()
92 if (IS_ERR(dentry)) { __fh_to_dentry()
94 return dentry; __fh_to_dentry()
96 err = ceph_init_dentry(dentry); __fh_to_dentry()
98 dput(dentry); __fh_to_dentry()
101 dout("__fh_to_dentry %llx %p dentry %p\n", ino, inode, dentry); __fh_to_dentry()
102 return dentry; __fh_to_dentry()
106 * convert regular fh to dentry
108 static struct dentry *ceph_fh_to_dentry(struct super_block *sb, ceph_fh_to_dentry()
124 static struct dentry *__get_parent(struct super_block *sb, __get_parent()
125 struct dentry *child, u64 ino) __get_parent()
130 struct dentry *dentry; __get_parent() local
156 dentry = d_obtain_alias(inode); __get_parent()
157 if (IS_ERR(dentry)) { __get_parent()
159 return dentry; __get_parent()
161 err = ceph_init_dentry(dentry); __get_parent()
163 dput(dentry); __get_parent()
168 dentry, ceph_vinop(inode)); __get_parent()
169 return dentry; __get_parent()
172 static struct dentry *ceph_get_parent(struct dentry *child) ceph_get_parent()
186 static struct dentry *ceph_fh_to_parent(struct super_block *sb, ceph_fh_to_parent()
191 struct dentry *dentry; ceph_fh_to_parent() local
199 dentry = __get_parent(sb, NULL, cfh->ino); ceph_fh_to_parent()
200 if (IS_ERR(dentry) && PTR_ERR(dentry) == -ENOENT) ceph_fh_to_parent()
201 dentry = __fh_to_dentry(sb, cfh->parent_ino); ceph_fh_to_parent()
202 return dentry; ceph_fh_to_parent()
205 static int ceph_get_name(struct dentry *parent, char *name, ceph_get_name()
206 struct dentry *child) ceph_get_name()
H A Ddir.c24 * or dentry operations (a single path component relative to an ino). The
32 * Initialize ceph dentry state.
34 int ceph_init_dentry(struct dentry *dentry) ceph_init_dentry() argument
38 if (dentry->d_fsdata) ceph_init_dentry()
45 spin_lock(&dentry->d_lock); ceph_init_dentry()
46 if (dentry->d_fsdata) { ceph_init_dentry()
52 if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) ceph_init_dentry()
53 d_set_d_op(dentry, &ceph_dentry_ops); ceph_init_dentry()
54 else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR) ceph_init_dentry()
55 d_set_d_op(dentry, &ceph_snapdir_dentry_ops); ceph_init_dentry()
57 d_set_d_op(dentry, &ceph_snap_dentry_ops); ceph_init_dentry()
59 di->dentry = dentry; ceph_init_dentry()
61 dentry->d_time = jiffies; ceph_init_dentry()
64 dentry->d_fsdata = di; ceph_init_dentry()
65 ceph_dentry_lru_add(dentry); ceph_init_dentry()
67 spin_unlock(&dentry->d_lock); ceph_init_dentry()
71 struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry) ceph_get_dentry_parent_inode() argument
75 if (!dentry) ceph_get_dentry_parent_inode()
78 spin_lock(&dentry->d_lock); ceph_get_dentry_parent_inode()
79 if (!IS_ROOT(dentry)) { ceph_get_dentry_parent_inode()
80 inode = d_inode(dentry->d_parent); ceph_get_dentry_parent_inode()
83 spin_unlock(&dentry->d_lock); ceph_get_dentry_parent_inode()
124 struct dentry *parent = file->f_path.dentry; __dcache_readdir()
127 struct dentry *dentry, *last; __dcache_readdir() local
131 /* claim ref on last dentry we returned */ __dcache_readdir()
132 last = fi->dentry; __dcache_readdir()
133 fi->dentry = NULL; __dcache_readdir()
152 dentry = list_entry(p, struct dentry, d_child); __dcache_readdir()
153 di = ceph_dentry(dentry); __dcache_readdir()
156 d_unhashed(dentry) ? "!hashed" : "hashed", __dcache_readdir()
162 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); __dcache_readdir()
164 !d_unhashed(dentry) && d_really_is_positive(dentry) && __dcache_readdir()
165 ceph_snap(d_inode(dentry)) != CEPH_SNAPDIR && __dcache_readdir()
166 ceph_ino(d_inode(dentry)) != CEPH_INO_CEPH && __dcache_readdir()
169 dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, __dcache_readdir()
170 dentry, di->offset, __dcache_readdir()
171 ctx->pos, d_unhashed(dentry) ? " unhashed" : "", __dcache_readdir()
172 !d_inode(dentry) ? " null" : ""); __dcache_readdir()
173 spin_unlock(&dentry->d_lock); __dcache_readdir()
175 dentry = list_entry(p, struct dentry, d_child); __dcache_readdir()
176 di = ceph_dentry(dentry); __dcache_readdir()
179 dget_dlock(dentry); __dcache_readdir()
180 spin_unlock(&dentry->d_lock); __dcache_readdir()
183 /* make sure a dentry wasn't dropped while we didn't have parent lock */ __dcache_readdir()
186 dput(dentry); __dcache_readdir()
191 dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, __dcache_readdir()
192 dentry, dentry, d_inode(dentry)); __dcache_readdir()
193 if (!dir_emit(ctx, dentry->d_name.name, __dcache_readdir()
194 dentry->d_name.len, __dcache_readdir()
195 ceph_translate_ino(dentry->d_sb, d_inode(dentry)->i_ino), __dcache_readdir()
196 d_inode(dentry)->i_mode >> 12)) { __dcache_readdir()
199 fi->dentry = last; __dcache_readdir()
202 dput(dentry); __dcache_readdir()
210 last = dentry; __dcache_readdir()
213 p = p->prev; /* advance to next dentry */ __dcache_readdir()
225 * make note of the last dentry we read, so we can
271 ino_t ino = parent_ino(file->f_path.dentry); ceph_readdir()
283 if ((ctx->pos == 2 || fi->dentry) && ceph_readdir()
299 if (fi->dentry) { ceph_readdir()
300 err = note_last_dentry(fi, fi->dentry->d_name.name, ceph_readdir()
301 fi->dentry->d_name.len); ceph_readdir()
304 dput(fi->dentry); ceph_readdir()
305 fi->dentry = NULL; ceph_readdir()
356 req->r_dentry = dget(file->f_path.dentry); ceph_readdir()
373 /* note next offset and last dentry name */ ceph_readdir()
483 if (fi->dentry) { reset_readdir()
484 dput(fi->dentry); reset_readdir()
485 fi->dentry = NULL; reset_readdir()
543 struct dentry *dentry, int err) ceph_handle_snapdir()
545 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); ceph_handle_snapdir()
546 struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */ ceph_handle_snapdir()
551 strcmp(dentry->d_name.name, ceph_handle_snapdir()
555 dentry, dentry, inode); ceph_handle_snapdir()
556 BUG_ON(!d_unhashed(dentry)); ceph_handle_snapdir()
557 d_add(dentry, inode); ceph_handle_snapdir()
567 * existed) in place of the original VFS-provided dentry when they
572 * care to issue a lease on the negative dentry).
574 struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, ceph_finish_lookup() argument
575 struct dentry *dentry, int err) ceph_finish_lookup()
581 dout("ENOENT and no trace, dentry %p inode %p\n", ceph_finish_lookup()
582 dentry, d_inode(dentry)); ceph_finish_lookup()
583 if (d_really_is_positive(dentry)) { ceph_finish_lookup()
584 d_drop(dentry); ceph_finish_lookup()
587 d_add(dentry, NULL); ceph_finish_lookup()
592 dentry = ERR_PTR(err); ceph_finish_lookup()
593 else if (dentry != req->r_dentry) ceph_finish_lookup()
594 dentry = dget(req->r_dentry); /* we got spliced */ ceph_finish_lookup()
596 dentry = NULL; ceph_finish_lookup()
597 return dentry; ceph_finish_lookup()
600 static int is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) is_root_ceph_dentry() argument
603 strncmp(dentry->d_name.name, ".ceph", 5) == 0; is_root_ceph_dentry()
610 static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, ceph_lookup() argument
619 dout("lookup %p dentry %p '%pd'\n", ceph_lookup()
620 dir, dentry, dentry); ceph_lookup()
622 if (dentry->d_name.len > NAME_MAX) ceph_lookup()
625 err = ceph_init_dentry(dentry); ceph_lookup()
630 if (d_really_is_negative(dentry)) { ceph_lookup()
632 struct ceph_dentry_info *di = ceph_dentry(dentry); ceph_lookup()
636 if (strncmp(dentry->d_name.name, ceph_lookup()
638 dentry->d_name.len) && ceph_lookup()
639 !is_root_ceph_dentry(dir, dentry) && ceph_lookup()
645 d_add(dentry, NULL); ceph_lookup()
657 req->r_dentry = dget(dentry); ceph_lookup()
663 err = ceph_handle_snapdir(req, dentry, err); ceph_lookup()
664 dentry = ceph_finish_lookup(req, dentry, err); ceph_lookup()
665 ceph_mdsc_put_request(req); /* will dput(dentry) */ ceph_lookup()
666 dout("lookup result=%p\n", dentry); ceph_lookup()
667 return dentry; ceph_lookup()
672 * a lookup (the VFS expects us to link up the provided dentry).
674 int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry) ceph_handle_notrace_create() argument
676 struct dentry *result = ceph_lookup(dir, dentry, 0); ceph_handle_notrace_create()
684 * we don't link our dentry to that inode, return an ceph_handle_notrace_create()
697 static int ceph_mknod(struct inode *dir, struct dentry *dentry, ceph_mknod() argument
713 dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n", ceph_mknod()
714 dir, dentry, mode, rdev); ceph_mknod()
720 req->r_dentry = dget(dentry); ceph_mknod()
733 err = ceph_handle_notrace_create(dir, dentry); ceph_mknod()
737 ceph_init_inode_acls(d_inode(dentry), &acls); ceph_mknod()
739 d_drop(dentry); ceph_mknod()
744 static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode, ceph_create() argument
747 return ceph_mknod(dir, dentry, mode, 0); ceph_create()
750 static int ceph_symlink(struct inode *dir, struct dentry *dentry, ceph_symlink() argument
761 dout("symlink in dir %p dentry %p to '%s'\n", dir, dentry, dest); ceph_symlink()
774 req->r_dentry = dget(dentry); ceph_symlink()
780 err = ceph_handle_notrace_create(dir, dentry); ceph_symlink()
784 d_drop(dentry); ceph_symlink()
788 static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ceph_mkdir() argument
801 dentry, dentry); ceph_mkdir()
803 dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode); ceph_mkdir()
820 req->r_dentry = dget(dentry); ceph_mkdir()
834 err = ceph_handle_notrace_create(dir, dentry); ceph_mkdir()
838 ceph_init_inode_acls(d_inode(dentry), &acls); ceph_mkdir()
840 d_drop(dentry); ceph_mkdir()
845 static int ceph_link(struct dentry *old_dentry, struct inode *dir, ceph_link() argument
846 struct dentry *dentry) ceph_link()
856 dout("link in dir %p old_dentry %p dentry %p\n", dir, ceph_link()
857 old_dentry, dentry); ceph_link()
860 d_drop(dentry); ceph_link()
863 req->r_dentry = dget(dentry); ceph_link()
873 d_drop(dentry); ceph_link()
876 d_instantiate(dentry, d_inode(old_dentry)); ceph_link()
905 static int ceph_unlink(struct inode *dir, struct dentry *dentry) ceph_unlink() argument
909 struct inode *inode = d_inode(dentry); ceph_unlink()
916 dout("rmsnap dir %p '%pd' dn %p\n", dir, dentry, dentry); ceph_unlink()
920 dir, dentry, inode); ceph_unlink()
921 op = d_is_dir(dentry) ? ceph_unlink()
930 req->r_dentry = dget(dentry); ceph_unlink()
938 d_delete(dentry); ceph_unlink()
944 static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, ceph_rename()
945 struct inode *new_dir, struct dentry *new_dentry) ceph_rename()
961 dout("rename dir %p dentry %p to dir %p dentry %p\n", ceph_rename()
990 /* ensure target dentry is invalidated, despite ceph_rename()
1004 * Ensure a dentry lease will no longer revalidate.
1006 void ceph_invalidate_dentry_lease(struct dentry *dentry) ceph_invalidate_dentry_lease() argument
1008 spin_lock(&dentry->d_lock); ceph_invalidate_dentry_lease()
1009 dentry->d_time = jiffies; ceph_invalidate_dentry_lease()
1010 ceph_dentry(dentry)->lease_shared_gen = 0; ceph_invalidate_dentry_lease()
1011 spin_unlock(&dentry->d_lock); ceph_invalidate_dentry_lease()
1015 * Check if dentry lease is valid. If not, delete the lease. Try to
1018 static int dentry_lease_is_valid(struct dentry *dentry) dentry_lease_is_valid() argument
1029 spin_lock(&dentry->d_lock); dentry_lease_is_valid()
1030 di = ceph_dentry(dentry); dentry_lease_is_valid()
1039 time_before(jiffies, dentry->d_time) && dentry_lease_is_valid()
1045 dir = d_inode(dentry->d_parent); dentry_lease_is_valid()
1053 spin_unlock(&dentry->d_lock); dentry_lease_is_valid()
1056 ceph_mdsc_lease_send_msg(session, dir, dentry, dentry_lease_is_valid()
1060 dout("dentry_lease_is_valid - dentry %p = %d\n", dentry, valid); dentry_lease_is_valid()
1067 static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry) dir_lease_is_valid() argument
1070 struct ceph_dentry_info *di = ceph_dentry(dentry); dir_lease_is_valid()
1077 dout("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n", dir_lease_is_valid()
1078 dir, (unsigned)ci->i_shared_gen, dentry, dir_lease_is_valid()
1084 * Check if cached dentry can be trusted.
1086 static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) ceph_d_revalidate() argument
1094 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, ceph_d_revalidate()
1095 dentry, d_inode(dentry), ceph_dentry(dentry)->offset); ceph_d_revalidate()
1097 dir = ceph_get_dentry_parent_inode(dentry); ceph_d_revalidate()
1099 /* always trust cached snapped dentries, snapdir dentry */ ceph_d_revalidate()
1101 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, ceph_d_revalidate()
1102 dentry, d_inode(dentry)); ceph_d_revalidate()
1104 } else if (d_really_is_positive(dentry) && ceph_d_revalidate()
1105 ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) { ceph_d_revalidate()
1107 } else if (dentry_lease_is_valid(dentry) || ceph_d_revalidate()
1108 dir_lease_is_valid(dir, dentry)) { ceph_d_revalidate()
1109 if (d_really_is_positive(dentry)) ceph_d_revalidate()
1110 valid = ceph_is_any_caps(d_inode(dentry)); ceph_d_revalidate()
1115 dout("d_revalidate %p %s\n", dentry, valid ? "valid" : "invalid"); ceph_d_revalidate()
1117 ceph_dentry_lru_touch(dentry); ceph_d_revalidate()
1128 static void ceph_d_release(struct dentry *dentry) ceph_d_release() argument
1130 struct ceph_dentry_info *di = ceph_dentry(dentry); ceph_d_release()
1132 dout("d_release %p\n", dentry); ceph_d_release()
1133 ceph_dentry_lru_del(dentry); ceph_d_release()
1137 dentry->d_fsdata = NULL; ceph_d_release()
1140 static int ceph_snapdir_d_revalidate(struct dentry *dentry, ceph_snapdir_d_revalidate() argument
1151 * When the VFS prunes a dentry from the cache, we need to clear the
1154 * Called under dentry->d_lock.
1156 static void ceph_d_prune(struct dentry *dentry) ceph_d_prune() argument
1158 dout("ceph_d_prune %p\n", dentry); ceph_d_prune()
1161 if (IS_ROOT(dentry)) ceph_d_prune()
1165 if (d_unhashed(dentry)) ceph_d_prune()
1172 ceph_dir_clear_complete(d_inode(dentry->d_parent)); ceph_d_prune()
1287 * We maintain a private dentry LRU.
1291 void ceph_dentry_lru_add(struct dentry *dn) ceph_dentry_lru_add()
1304 void ceph_dentry_lru_touch(struct dentry *dn) ceph_dentry_lru_touch()
1317 void ceph_dentry_lru_del(struct dentry *dn) ceph_dentry_lru_del()
1331 * Return name hash for a given dentry. This is dependent on
1334 unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn) ceph_dentry_hash()
542 ceph_handle_snapdir(struct ceph_mds_request *req, struct dentry *dentry, int err) ceph_handle_snapdir() argument
/linux-4.1.27/net/wimax/
H A Ddebugfs.c44 struct dentry *dentry; wimax_debugfs_add() local
48 dentry = debugfs_create_dir(buf, NULL); wimax_debugfs_add()
49 result = PTR_ERR(dentry); wimax_debugfs_add()
50 if (IS_ERR(dentry)) { wimax_debugfs_add()
54 dev_err(dev, "Can't create debugfs dentry: %d\n", wimax_debugfs_add()
58 wimax_dev->debugfs_dentry = dentry; wimax_debugfs_add()
59 __debugfs_register("wimax_dl_", debugfs, dentry); wimax_debugfs_add()
60 __debugfs_register("wimax_dl_", id_table, dentry); wimax_debugfs_add()
61 __debugfs_register("wimax_dl_", op_msg, dentry); wimax_debugfs_add()
62 __debugfs_register("wimax_dl_", op_reset, dentry); wimax_debugfs_add()
63 __debugfs_register("wimax_dl_", op_rfkill, dentry); wimax_debugfs_add()
64 __debugfs_register("wimax_dl_", op_state_get, dentry); wimax_debugfs_add()
65 __debugfs_register("wimax_dl_", stack, dentry); wimax_debugfs_add()
/linux-4.1.27/fs/
H A Ddcache.c54 * dentry->d_sb->s_dentry_lru_lock protects:
67 * dentry->d_inode->i_lock
68 * dentry->d_lock
69 * dentry->d_sb->s_dentry_lru_lock
74 * dentry->d_parent->...->d_parent->d_lock
76 * dentry->d_parent->d_lock
77 * dentry->d_lock
107 static inline struct hlist_bl_head *d_hash(const struct dentry *parent, d_hash()
171 * NOTE! 'cs' and 'scount' come from a dentry, so it has a
216 static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount) dentry_cmp() argument
228 * and a dentry name is guaranteed to be properly dentry_cmp()
235 cs = ACCESS_ONCE(dentry->d_name.name); dentry_cmp()
248 static inline struct external_name *external_name(struct dentry *dentry) external_name() argument
250 return container_of(dentry->d_name.name, struct external_name, name[0]); external_name()
255 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); __d_free() local
257 kmem_cache_free(dentry_cache, dentry); __d_free()
262 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); __d_free_external() local
263 kfree(external_name(dentry)); __d_free_external()
264 kmem_cache_free(dentry_cache, dentry); __d_free_external()
267 static inline int dname_external(const struct dentry *dentry) dname_external() argument
269 return dentry->d_name.name != dentry->d_iname; dname_external()
272 static inline void __d_set_inode_and_type(struct dentry *dentry, __d_set_inode_and_type() argument
278 dentry->d_inode = inode; __d_set_inode_and_type()
279 flags = READ_ONCE(dentry->d_flags); __d_set_inode_and_type()
282 WRITE_ONCE(dentry->d_flags, flags); __d_set_inode_and_type()
285 static inline void __d_clear_type_and_inode(struct dentry *dentry) __d_clear_type_and_inode() argument
287 unsigned flags = READ_ONCE(dentry->d_flags); __d_clear_type_and_inode()
290 WRITE_ONCE(dentry->d_flags, flags); __d_clear_type_and_inode()
291 dentry->d_inode = NULL; __d_clear_type_and_inode()
294 static void dentry_free(struct dentry *dentry) dentry_free() argument
296 WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); dentry_free()
297 if (unlikely(dname_external(dentry))) { dentry_free()
298 struct external_name *p = external_name(dentry); dentry_free()
300 call_rcu(&dentry->d_u.d_rcu, __d_free_external); dentry_free()
304 /* if dentry was never visible to RCU, immediate free is OK */ dentry_free()
305 if (!(dentry->d_flags & DCACHE_RCUACCESS)) dentry_free()
306 __d_free(&dentry->d_u.d_rcu); dentry_free()
308 call_rcu(&dentry->d_u.d_rcu, __d_free); dentry_free()
313 * @dentry: the target dentry
316 * the dentry has not already been unhashed).
318 static inline void dentry_rcuwalk_invalidate(struct dentry *dentry) dentry_rcuwalk_invalidate() argument
320 lockdep_assert_held(&dentry->d_lock); dentry_rcuwalk_invalidate()
322 write_seqcount_invalidate(&dentry->d_seq); dentry_rcuwalk_invalidate()
326 * Release the dentry's inode, using the filesystem
330 static void dentry_iput(struct dentry * dentry)
331 __releases(dentry->d_lock)
332 __releases(dentry->d_inode->i_lock)
334 struct inode *inode = dentry->d_inode;
336 __d_clear_type_and_inode(dentry); variable
337 hlist_del_init(&dentry->d_u.d_alias);
338 spin_unlock(&dentry->d_lock);
342 if (dentry->d_op && dentry->d_op->d_iput)
343 dentry->d_op->d_iput(dentry, inode);
347 spin_unlock(&dentry->d_lock);
352 * Release the dentry's inode, using the filesystem
353 * d_iput() operation if defined. dentry remains in-use.
355 static void dentry_unlink_inode(struct dentry * dentry)
356 __releases(dentry->d_lock)
357 __releases(dentry->d_inode->i_lock)
359 struct inode *inode = dentry->d_inode;
361 raw_write_seqcount_begin(&dentry->d_seq);
362 __d_clear_type_and_inode(dentry); variable
363 hlist_del_init(&dentry->d_u.d_alias);
364 raw_write_seqcount_end(&dentry->d_seq);
365 spin_unlock(&dentry->d_lock);
369 if (dentry->d_op && dentry->d_op->d_iput)
370 dentry->d_op->d_iput(dentry, inode);
380 * The DCACHE_SHRINK_LIST bit is set whenever the dentry is
389 #define D_FLAG_VERIFY(dentry,x) WARN_ON_ONCE(((dentry)->d_flags & (DCACHE_LRU_LIST | DCACHE_SHRINK_LIST)) != (x)) d_lru_add()
390 static void d_lru_add(struct dentry *dentry) d_lru_add() argument
392 D_FLAG_VERIFY(dentry, 0); d_lru_add()
393 dentry->d_flags |= DCACHE_LRU_LIST; d_lru_add()
395 WARN_ON_ONCE(!list_lru_add(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); d_lru_add()
398 static void d_lru_del(struct dentry *dentry) d_lru_del() argument
400 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); d_lru_del()
401 dentry->d_flags &= ~DCACHE_LRU_LIST; d_lru_del()
403 WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); d_lru_del()
406 static void d_shrink_del(struct dentry *dentry) d_shrink_del() argument
408 D_FLAG_VERIFY(dentry, DCACHE_SHRINK_LIST | DCACHE_LRU_LIST); d_shrink_del()
409 list_del_init(&dentry->d_lru); d_shrink_del()
410 dentry->d_flags &= ~(DCACHE_SHRINK_LIST | DCACHE_LRU_LIST); d_shrink_del()
414 static void d_shrink_add(struct dentry *dentry, struct list_head *list) d_shrink_add() argument
416 D_FLAG_VERIFY(dentry, 0); d_shrink_add()
417 list_add(&dentry->d_lru, list); d_shrink_add()
418 dentry->d_flags |= DCACHE_SHRINK_LIST | DCACHE_LRU_LIST; d_shrink_add()
428 static void d_lru_isolate(struct list_lru_one *lru, struct dentry *dentry) d_lru_isolate() argument
430 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); d_lru_isolate()
431 dentry->d_flags &= ~DCACHE_LRU_LIST; d_lru_isolate()
433 list_lru_isolate(lru, &dentry->d_lru); d_lru_isolate()
436 static void d_lru_shrink_move(struct list_lru_one *lru, struct dentry *dentry, d_lru_shrink_move() argument
439 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); d_lru_shrink_move()
440 dentry->d_flags |= DCACHE_SHRINK_LIST; d_lru_shrink_move()
441 list_lru_isolate_move(lru, &dentry->d_lru, list); d_lru_shrink_move()
447 static void dentry_lru_add(struct dentry *dentry) dentry_lru_add() argument
449 if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) dentry_lru_add()
450 d_lru_add(dentry); dentry_lru_add()
454 * d_drop - drop a dentry
455 * @dentry: dentry to drop
457 * d_drop() unhashes the entry from the parent dentry hashes, so that it won't
459 * deleting the dentry - d_delete will try to mark the dentry negative if
463 * d_drop() is used mainly for stuff that wants to invalidate a dentry for some
466 * __d_drop requires dentry->d_lock.
468 void __d_drop(struct dentry *dentry) __d_drop() argument
470 if (!d_unhashed(dentry)) { __d_drop()
473 * Hashed dentries are normally on the dentry hashtable, __d_drop()
477 if (unlikely(IS_ROOT(dentry))) __d_drop()
478 b = &dentry->d_sb->s_anon; __d_drop()
480 b = d_hash(dentry->d_parent, dentry->d_name.hash); __d_drop()
483 __hlist_bl_del(&dentry->d_hash); __d_drop()
484 dentry->d_hash.pprev = NULL; __d_drop()
486 dentry_rcuwalk_invalidate(dentry); __d_drop()
491 void d_drop(struct dentry *dentry) d_drop() argument
493 spin_lock(&dentry->d_lock); d_drop()
494 __d_drop(dentry); d_drop()
495 spin_unlock(&dentry->d_lock); d_drop()
499 static void __dentry_kill(struct dentry *dentry) __dentry_kill() argument
501 struct dentry *parent = NULL; __dentry_kill()
503 if (!IS_ROOT(dentry)) __dentry_kill()
504 parent = dentry->d_parent; __dentry_kill()
507 * The dentry is now unrecoverably dead to the world. __dentry_kill()
509 lockref_mark_dead(&dentry->d_lockref); __dentry_kill()
512 * inform the fs via d_prune that this dentry is about to be __dentry_kill()
515 if (dentry->d_flags & DCACHE_OP_PRUNE) __dentry_kill()
516 dentry->d_op->d_prune(dentry); __dentry_kill()
518 if (dentry->d_flags & DCACHE_LRU_LIST) { __dentry_kill()
519 if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) __dentry_kill()
520 d_lru_del(dentry); __dentry_kill()
523 __d_drop(dentry); __dentry_kill()
524 __list_del_entry(&dentry->d_child); __dentry_kill()
527 * dentry tree __dentry_kill()
529 dentry->d_flags |= DCACHE_DENTRY_KILLED; __dentry_kill()
532 dentry_iput(dentry); __dentry_kill()
535 * transient RCU lookups) can reach this dentry. __dentry_kill()
537 BUG_ON(dentry->d_lockref.count > 0); __dentry_kill()
539 if (dentry->d_op && dentry->d_op->d_release) __dentry_kill()
540 dentry->d_op->d_release(dentry); __dentry_kill()
542 spin_lock(&dentry->d_lock); __dentry_kill()
543 if (dentry->d_flags & DCACHE_SHRINK_LIST) { __dentry_kill()
544 dentry->d_flags |= DCACHE_MAY_FREE; __dentry_kill()
547 spin_unlock(&dentry->d_lock); __dentry_kill()
549 dentry_free(dentry); __dentry_kill()
553 * Finish off a dentry we've decided to kill.
554 * dentry->d_lock must be held, returns with it unlocked.
556 * Returns dentry requiring refcount drop, or NULL if we're done.
558 static struct dentry *dentry_kill(struct dentry *dentry)
559 __releases(dentry->d_lock)
561 struct inode *inode = dentry->d_inode;
562 struct dentry *parent = NULL;
567 if (!IS_ROOT(dentry)) {
568 parent = dentry->d_parent;
576 __dentry_kill(dentry); variable
580 spin_unlock(&dentry->d_lock);
582 return dentry; /* try again with same dentry */
585 static inline struct dentry *lock_parent(struct dentry *dentry) lock_parent() argument
587 struct dentry *parent = dentry->d_parent; lock_parent()
588 if (IS_ROOT(dentry)) lock_parent()
590 if (unlikely(dentry->d_lockref.count < 0)) lock_parent()
595 spin_unlock(&dentry->d_lock); lock_parent()
597 parent = ACCESS_ONCE(dentry->d_parent); lock_parent()
600 * We can't blindly lock dentry until we are sure lock_parent()
602 * Any changes of dentry->d_parent must have lock_parent()
607 if (unlikely(parent != dentry->d_parent)) { lock_parent()
612 if (parent != dentry) lock_parent()
613 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); lock_parent()
622 * If unsuccessful, we return false, having already taken the dentry lock.
624 * The caller needs to hold the RCU read lock, so that the dentry is
627 static inline bool fast_dput(struct dentry *dentry) fast_dput() argument
634 * let the dentry count go to zero, so use "put_or_lock". fast_dput()
636 if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) fast_dput()
637 return lockref_put_or_lock(&dentry->d_lockref); fast_dput()
643 ret = lockref_put_return(&dentry->d_lockref); fast_dput()
651 spin_lock(&dentry->d_lock); fast_dput()
652 if (dentry->d_lockref.count > 1) { fast_dput()
653 dentry->d_lockref.count--; fast_dput()
654 spin_unlock(&dentry->d_lock); fast_dput()
668 * to zero, but we don't hold the dentry lock, so fast_dput()
674 * do: the dentry is still hashed, it does not have fast_dput()
681 * dentry was hashed and the flags had the proper fast_dput()
682 * value. Other dentry users may have re-gotten fast_dput()
683 * a reference to the dentry and change that, but fast_dput()
684 * our work is done - we can leave the dentry fast_dput()
688 d_flags = ACCESS_ONCE(dentry->d_flags); fast_dput()
692 if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) fast_dput()
700 spin_lock(&dentry->d_lock); fast_dput()
708 if (dentry->d_lockref.count) { fast_dput()
709 spin_unlock(&dentry->d_lock); fast_dput()
718 dentry->d_lockref.count = 1; fast_dput()
730 * However, that implies that we have to traverse the dentry
741 * dput - release a dentry
742 * @dentry: dentry to release
744 * Release a dentry. This will drop the usage count and if appropriate
745 * call the dentry unlink method as well as removing it from the queues and
749 void dput(struct dentry *dentry) dput() argument
751 if (unlikely(!dentry)) dput()
756 if (likely(fast_dput(dentry))) { dput()
761 /* Slow case: now with the dentry lock held */ dput()
765 if (unlikely(d_unhashed(dentry))) dput()
768 if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) dput()
771 if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) { dput()
772 if (dentry->d_op->d_delete(dentry)) dput()
776 if (!(dentry->d_flags & DCACHE_REFERENCED)) dput()
777 dentry->d_flags |= DCACHE_REFERENCED; dput()
778 dentry_lru_add(dentry); dput()
780 dentry->d_lockref.count--; dput()
781 spin_unlock(&dentry->d_lock); dput()
785 dentry = dentry_kill(dentry); dput()
786 if (dentry) dput()
793 static inline void __dget_dlock(struct dentry *dentry) __dget_dlock() argument
795 dentry->d_lockref.count++; __dget_dlock()
798 static inline void __dget(struct dentry *dentry) __dget() argument
800 lockref_get(&dentry->d_lockref); __dget()
803 struct dentry *dget_parent(struct dentry *dentry) dget_parent() argument
806 struct dentry *ret; dget_parent()
813 ret = ACCESS_ONCE(dentry->d_parent); dget_parent()
817 if (likely(ret == ACCESS_ONCE(dentry->d_parent))) dget_parent()
828 ret = dentry->d_parent; dget_parent()
830 if (unlikely(ret != dentry->d_parent)) { dget_parent()
857 static struct dentry *__d_find_alias(struct inode *inode) __d_find_alias()
859 struct dentry *alias, *discon_alias; __d_find_alias()
891 struct dentry *d_find_alias(struct inode *inode) d_find_alias()
893 struct dentry *de = NULL; d_find_alias()
910 struct dentry *dentry; d_prune_aliases() local
913 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { d_prune_aliases()
914 spin_lock(&dentry->d_lock); d_prune_aliases()
915 if (!dentry->d_lockref.count) { d_prune_aliases()
916 struct dentry *parent = lock_parent(dentry); d_prune_aliases()
917 if (likely(!dentry->d_lockref.count)) { d_prune_aliases()
918 __dentry_kill(dentry); d_prune_aliases()
925 spin_unlock(&dentry->d_lock); d_prune_aliases()
933 struct dentry *dentry, *parent; shrink_dentry_list() local
937 dentry = list_entry(list->prev, struct dentry, d_lru); shrink_dentry_list()
938 spin_lock(&dentry->d_lock); shrink_dentry_list()
939 parent = lock_parent(dentry); shrink_dentry_list()
946 d_shrink_del(dentry); shrink_dentry_list()
949 * We found an inuse dentry which was not removed from shrink_dentry_list()
952 if (dentry->d_lockref.count > 0) { shrink_dentry_list()
953 spin_unlock(&dentry->d_lock); shrink_dentry_list()
960 if (unlikely(dentry->d_flags & DCACHE_DENTRY_KILLED)) { shrink_dentry_list()
961 bool can_free = dentry->d_flags & DCACHE_MAY_FREE; shrink_dentry_list()
962 spin_unlock(&dentry->d_lock); shrink_dentry_list()
966 dentry_free(dentry); shrink_dentry_list()
970 inode = dentry->d_inode; shrink_dentry_list()
972 d_shrink_add(dentry, list); shrink_dentry_list()
973 spin_unlock(&dentry->d_lock); shrink_dentry_list()
979 __dentry_kill(dentry); shrink_dentry_list()
984 * expected to be beneficial in reducing dentry cache shrink_dentry_list()
987 dentry = parent; shrink_dentry_list()
988 while (dentry && !lockref_put_or_lock(&dentry->d_lockref)) { shrink_dentry_list()
989 parent = lock_parent(dentry); shrink_dentry_list()
990 if (dentry->d_lockref.count != 1) { shrink_dentry_list()
991 dentry->d_lockref.count--; shrink_dentry_list()
992 spin_unlock(&dentry->d_lock); shrink_dentry_list()
997 inode = dentry->d_inode; /* can't be NULL */ shrink_dentry_list()
999 spin_unlock(&dentry->d_lock); shrink_dentry_list()
1005 __dentry_kill(dentry); shrink_dentry_list()
1006 dentry = parent; shrink_dentry_list()
1015 struct dentry *dentry = container_of(item, struct dentry, d_lru); dentry_lru_isolate() local
1019 * we are inverting the lru lock/dentry->d_lock here, dentry_lru_isolate()
1023 if (!spin_trylock(&dentry->d_lock)) dentry_lru_isolate()
1031 if (dentry->d_lockref.count) { dentry_lru_isolate()
1032 d_lru_isolate(lru, dentry); dentry_lru_isolate()
1033 spin_unlock(&dentry->d_lock); dentry_lru_isolate()
1037 if (dentry->d_flags & DCACHE_REFERENCED) { dentry_lru_isolate()
1038 dentry->d_flags &= ~DCACHE_REFERENCED; dentry_lru_isolate()
1039 spin_unlock(&dentry->d_lock); dentry_lru_isolate()
1043 * this point, we've dropped the dentry->d_lock but keep the dentry_lru_isolate()
1063 d_lru_shrink_move(lru, dentry, freeable); dentry_lru_isolate()
1064 spin_unlock(&dentry->d_lock); dentry_lru_isolate()
1096 struct dentry *dentry = container_of(item, struct dentry, d_lru); dentry_lru_isolate_shrink() local
1099 * we are inverting the lru lock/dentry->d_lock here, dentry_lru_isolate_shrink()
1103 if (!spin_trylock(&dentry->d_lock)) dentry_lru_isolate_shrink()
1106 d_lru_shrink_move(lru, dentry, freeable); dentry_lru_isolate_shrink()
1107 spin_unlock(&dentry->d_lock); dentry_lru_isolate_shrink()
1141 * @D_WALK_SKIP: skip this dentry and its children
1151 * d_walk - walk the dentry tree
1154 * @enter: callback when first entering the dentry
1159 static void d_walk(struct dentry *parent, void *data, d_walk()
1160 enum d_walk_ret (*enter)(void *, struct dentry *), d_walk()
1163 struct dentry *this_parent; d_walk()
1190 struct dentry *dentry = list_entry(tmp, struct dentry, d_child); d_walk() local
1193 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); d_walk()
1195 ret = enter(data, dentry); d_walk()
1200 spin_unlock(&dentry->d_lock); d_walk()
1206 spin_unlock(&dentry->d_lock); d_walk()
1210 if (!list_empty(&dentry->d_subdirs)) { d_walk()
1212 spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); d_walk()
1213 this_parent = dentry; d_walk()
1217 spin_unlock(&dentry->d_lock); d_walk()
1225 struct dentry *child = this_parent; d_walk()
1239 child = list_entry(next, struct dentry, d_child); d_walk()
1266 * Search for at least 1 mount point in the dentry's subdirs.
1271 static enum d_walk_ret check_mount(void *data, struct dentry *dentry) check_mount() argument
1274 if (d_mountpoint(dentry)) { check_mount()
1282 * have_submounts - check for mounts over a dentry
1283 * @parent: dentry to check.
1288 int have_submounts(struct dentry *parent) have_submounts()
1300 * reachable (e.g. NFS can unhash a directory dentry and then the complete
1304 * this reason take rename_lock and d_lock on dentry and ancestors.
1306 int d_set_mounted(struct dentry *dentry) d_set_mounted() argument
1308 struct dentry *p; d_set_mounted()
1311 for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) { d_set_mounted()
1320 spin_lock(&dentry->d_lock); d_set_mounted()
1321 if (!d_unlinked(dentry)) { d_set_mounted()
1322 dentry->d_flags |= DCACHE_MOUNTED; d_set_mounted()
1325 spin_unlock(&dentry->d_lock); d_set_mounted()
1332 * Search the dentry child list of the specified parent,
1347 struct dentry *start;
1352 static enum d_walk_ret select_collect(void *_data, struct dentry *dentry) select_collect() argument
1357 if (data->start == dentry) select_collect()
1360 if (dentry->d_flags & DCACHE_SHRINK_LIST) { select_collect()
1363 if (dentry->d_flags & DCACHE_LRU_LIST) select_collect()
1364 d_lru_del(dentry); select_collect()
1365 if (!dentry->d_lockref.count) { select_collect()
1366 d_shrink_add(dentry, &data->dispose); select_collect()
1385 * Prune the dcache to remove unused children of the parent dentry.
1387 void shrink_dcache_parent(struct dentry *parent) shrink_dcache_parent()
1406 static enum d_walk_ret umount_check(void *_data, struct dentry *dentry) umount_check() argument
1409 if (!list_empty(&dentry->d_subdirs)) umount_check()
1413 if (dentry == _data && dentry->d_lockref.count == 1) umount_check()
1418 dentry, umount_check()
1419 dentry->d_inode ? umount_check()
1420 dentry->d_inode->i_ino : 0UL, umount_check()
1421 dentry, umount_check()
1422 dentry->d_lockref.count, umount_check()
1423 dentry->d_sb->s_type->name, umount_check()
1424 dentry->d_sb->s_id); umount_check()
1429 static void do_one_tree(struct dentry *dentry) do_one_tree() argument
1431 shrink_dcache_parent(dentry); do_one_tree()
1432 d_walk(dentry, dentry, umount_check, NULL); do_one_tree()
1433 d_drop(dentry); do_one_tree()
1434 dput(dentry); do_one_tree()
1442 struct dentry *dentry; shrink_dcache_for_umount() local
1446 dentry = sb->s_root; shrink_dcache_for_umount()
1448 do_one_tree(dentry); shrink_dcache_for_umount()
1451 dentry = dget(hlist_bl_entry(hlist_bl_first(&sb->s_anon), struct dentry, d_hash)); shrink_dcache_for_umount()
1452 do_one_tree(dentry); shrink_dcache_for_umount()
1458 struct dentry *mountpoint;
1460 static enum d_walk_ret detach_and_collect(void *_data, struct dentry *dentry) detach_and_collect() argument
1464 if (d_mountpoint(dentry)) { detach_and_collect()
1465 __dget_dlock(dentry); detach_and_collect()
1466 data->mountpoint = dentry; detach_and_collect()
1470 return select_collect(&data->select, dentry); detach_and_collect()
1483 * @dentry: dentry to invalidate (aka detach, prune and drop)
1491 void d_invalidate(struct dentry *dentry) d_invalidate() argument
1496 spin_lock(&dentry->d_lock); d_invalidate()
1497 if (d_unhashed(dentry)) { d_invalidate()
1498 spin_unlock(&dentry->d_lock); d_invalidate()
1501 spin_unlock(&dentry->d_lock); d_invalidate()
1504 if (!dentry->d_inode) { d_invalidate()
1505 d_drop(dentry); d_invalidate()
1514 data.select.start = dentry; d_invalidate()
1517 d_walk(dentry, &data, detach_and_collect, check_and_drop); d_invalidate()
1540 * Allocates a dentry. It returns %NULL if there is insufficient memory
1541 * available. On a success the dentry is returned. The name passed in is
1545 struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) __d_alloc()
1547 struct dentry *dentry; __d_alloc() local
1550 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); __d_alloc()
1551 if (!dentry) __d_alloc()
1560 dentry->d_iname[DNAME_INLINE_LEN-1] = 0; __d_alloc()
1565 kmem_cache_free(dentry_cache, dentry); __d_alloc()
1574 dname = dentry->d_iname; __d_alloc()
1577 dentry->d_name.len = name->len; __d_alloc()
1578 dentry->d_name.hash = name->hash; __d_alloc()
1584 dentry->d_name.name = dname; __d_alloc()
1586 dentry->d_lockref.count = 1; __d_alloc()
1587 dentry->d_flags = 0; __d_alloc()
1588 spin_lock_init(&dentry->d_lock); __d_alloc()
1589 seqcount_init(&dentry->d_seq); __d_alloc()
1590 dentry->d_inode = NULL; __d_alloc()
1591 dentry->d_parent = dentry; __d_alloc()
1592 dentry->d_sb = sb; __d_alloc()
1593 dentry->d_op = NULL; __d_alloc()
1594 dentry->d_fsdata = NULL; __d_alloc()
1595 INIT_HLIST_BL_NODE(&dentry->d_hash); __d_alloc()
1596 INIT_LIST_HEAD(&dentry->d_lru); __d_alloc()
1597 INIT_LIST_HEAD(&dentry->d_subdirs); __d_alloc()
1598 INIT_HLIST_NODE(&dentry->d_u.d_alias); __d_alloc()
1599 INIT_LIST_HEAD(&dentry->d_child); __d_alloc()
1600 d_set_d_op(dentry, dentry->d_sb->s_d_op); __d_alloc()
1604 return dentry; __d_alloc()
1612 * Allocates a dentry. It returns %NULL if there is insufficient memory
1613 * available. On a success the dentry is returned. The name passed in is
1616 struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) d_alloc()
1618 struct dentry *dentry = __d_alloc(parent->d_sb, name); d_alloc() local
1619 if (!dentry) d_alloc()
1621 dentry->d_flags |= DCACHE_RCUACCESS; d_alloc()
1628 dentry->d_parent = parent; d_alloc()
1629 list_add(&dentry->d_child, &parent->d_subdirs); d_alloc()
1632 return dentry; d_alloc()
1637 * d_alloc_pseudo - allocate a dentry (for lookup-less filesystems)
1642 * performs lookups at all, return an unhashed IS_ROOT dentry.
1644 struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) d_alloc_pseudo()
1650 struct dentry *d_alloc_name(struct dentry *parent, const char *name) d_alloc_name()
1661 void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) d_set_d_op() argument
1663 WARN_ON_ONCE(dentry->d_op); d_set_d_op()
1664 WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | d_set_d_op()
1670 dentry->d_op = op; d_set_d_op()
1674 dentry->d_flags |= DCACHE_OP_HASH; d_set_d_op()
1676 dentry->d_flags |= DCACHE_OP_COMPARE; d_set_d_op()
1678 dentry->d_flags |= DCACHE_OP_REVALIDATE; d_set_d_op()
1680 dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; d_set_d_op()
1682 dentry->d_flags |= DCACHE_OP_DELETE; d_set_d_op()
1684 dentry->d_flags |= DCACHE_OP_PRUNE; d_set_d_op()
1686 dentry->d_flags |= DCACHE_OP_SELECT_INODE; d_set_d_op()
1693 * d_set_fallthru - Mark a dentry as falling through to a lower layer
1694 * @dentry - The dentry to mark
1696 * Mark a dentry as falling through to the lower layer (as set with
1699 void d_set_fallthru(struct dentry *dentry) d_set_fallthru() argument
1701 spin_lock(&dentry->d_lock); d_set_fallthru()
1702 dentry->d_flags |= DCACHE_FALLTHRU; d_set_fallthru()
1703 spin_unlock(&dentry->d_lock); d_set_fallthru()
1742 static void __d_instantiate(struct dentry *dentry, struct inode *inode) __d_instantiate() argument
1746 spin_lock(&dentry->d_lock); __d_instantiate()
1748 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); __d_instantiate()
1749 raw_write_seqcount_begin(&dentry->d_seq); __d_instantiate()
1750 __d_set_inode_and_type(dentry, inode, add_flags); __d_instantiate()
1751 raw_write_seqcount_end(&dentry->d_seq); __d_instantiate()
1752 spin_unlock(&dentry->d_lock); __d_instantiate()
1753 fsnotify_d_instantiate(dentry, inode); __d_instantiate()
1757 * d_instantiate - fill in inode information for a dentry
1758 * @entry: dentry to complete
1759 * @inode: inode to attach to this dentry
1771 void d_instantiate(struct dentry *entry, struct inode * inode) d_instantiate()
1784 * d_instantiate_unique - instantiate a non-aliased dentry
1785 * @entry: dentry to instantiate
1786 * @inode: inode to attach to this dentry
1790 * aliased dentry instead and drop one reference to inode.
1799 static struct dentry *__d_instantiate_unique(struct dentry *entry, __d_instantiate_unique()
1802 struct dentry *alias; __d_instantiate_unique()
1834 struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) d_instantiate_unique()
1836 struct dentry *result; d_instantiate_unique()
1859 * d_instantiate_no_diralias - instantiate a non-aliased dentry
1860 * @entry: dentry to complete
1861 * @inode: inode to attach to this dentry
1867 int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) d_instantiate_no_diralias()
1885 struct dentry *d_make_root(struct inode *root_inode) d_make_root()
1887 struct dentry *res = NULL; d_make_root()
1902 static struct dentry * __d_find_any_alias(struct inode *inode) __d_find_any_alias()
1904 struct dentry *alias; __d_find_any_alias()
1908 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); __d_find_any_alias()
1920 struct dentry *d_find_any_alias(struct inode *inode) d_find_any_alias()
1922 struct dentry *de; d_find_any_alias()
1931 static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected) __d_obtain_alias()
1934 struct dentry *tmp; __d_obtain_alias()
1935 struct dentry *res; __d_obtain_alias()
1961 /* attach a disconnected dentry */ __d_obtain_alias()
1987 * d_obtain_alias - find or allocate a DISCONNECTED dentry for a given inode
1988 * @inode: inode to allocate the dentry for
1990 * Obtain a dentry for an inode resulting from NFS filehandle conversion or
1991 * similar open by handle operations. The returned dentry may be anonymous,
1995 * has one dentry. If a dentry is found, that is returned instead of
1999 * to the dentry. In case of an error the reference on the inode is released.
2004 struct dentry *d_obtain_alias(struct inode *inode) d_obtain_alias()
2011 * d_obtain_root - find or allocate a dentry for a given inode
2012 * @inode: inode to allocate the dentry for
2014 * Obtain an IS_ROOT dentry for the root of a filesystem.
2016 * We must ensure that directory inodes only ever have one dentry. If a
2017 * dentry is found, that is returned instead of allocating a new one.
2020 * to the dentry. In case of an error the reference on the inode is
2025 struct dentry *d_obtain_root(struct inode *inode) d_obtain_root()
2032 * d_add_ci - lookup or allocate new dentry with case-exact name
2034 * @dentry: the negative dentry that was passed to the parent's lookup func
2035 * @name: the case-exact name to be associated with the returned dentry
2041 * For a case-insensitive lookup match and if the the case-exact dentry
2044 * If no entry exists with the exact case name, allocate new dentry with
2047 struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, d_add_ci() argument
2050 struct dentry *found; d_add_ci()
2051 struct dentry *new; d_add_ci()
2054 * First check if a dentry matching the name already exists, d_add_ci()
2057 found = d_hash_and_lookup(dentry->d_parent, name); d_add_ci()
2059 new = d_alloc(dentry->d_parent, name); d_add_ci()
2077 * Do the slow-case of the dentry name compare.
2087 * at the dentry inode or name contents directly, since
2097 const struct dentry *parent, slow_dentry_cmp()
2098 struct dentry *dentry, slow_dentry_cmp()
2102 int tlen = dentry->d_name.len; slow_dentry_cmp()
2103 const char *tname = dentry->d_name.name; slow_dentry_cmp()
2105 if (read_seqcount_retry(&dentry->d_seq, seq)) { slow_dentry_cmp()
2109 if (parent->d_op->d_compare(parent, dentry, tlen, tname, name)) slow_dentry_cmp()
2115 * __d_lookup_rcu - search for a dentry (racy, store-free)
2116 * @parent: parent dentry
2118 * @seqp: returns d_seq value at the point where the dentry was found
2119 * Returns: dentry, or NULL
2128 * held, and rcu_read_lock held. The returned dentry must not be stored into
2132 * A refcount may be taken on the found dentry with the d_rcu_to_refcount
2136 * the returned dentry, so long as its parent's seqlock is checked after the
2140 * NOTE! The caller *has* to check the resulting dentry against the sequence
2141 * number we've returned before using any of the resulting dentry state!
2143 struct dentry *__d_lookup_rcu(const struct dentry *parent, __d_lookup_rcu()
2151 struct dentry *dentry; __d_lookup_rcu() local
2163 * Carefully use d_seq when comparing a candidate dentry, to avoid __d_lookup_rcu()
2167 * walk here and result in missing our dentry, resulting in the __d_lookup_rcu()
2173 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { hlist_bl_for_each_entry_rcu()
2178 * The dentry sequence count protects us from concurrent hlist_bl_for_each_entry_rcu()
2182 * to do anything useful with the returned dentry. hlist_bl_for_each_entry_rcu()
2187 * dentry compare, we will do seqretries until it is stable, hlist_bl_for_each_entry_rcu()
2191 seq = raw_seqcount_begin(&dentry->d_seq); hlist_bl_for_each_entry_rcu()
2192 if (dentry->d_parent != parent) hlist_bl_for_each_entry_rcu()
2194 if (d_unhashed(dentry)) hlist_bl_for_each_entry_rcu()
2198 if (dentry->d_name.hash != hashlen_hash(hashlen)) hlist_bl_for_each_entry_rcu()
2201 switch (slow_dentry_cmp(parent, dentry, seq, name)) { hlist_bl_for_each_entry_rcu()
2203 return dentry; hlist_bl_for_each_entry_rcu()
2211 if (dentry->d_name.hash_len != hashlen) hlist_bl_for_each_entry_rcu()
2214 if (!dentry_cmp(dentry, str, hashlen_len(hashlen))) hlist_bl_for_each_entry_rcu()
2215 return dentry; hlist_bl_for_each_entry_rcu()
2221 * d_lookup - search for a dentry
2222 * @parent: parent dentry
2224 * Returns: dentry, or NULL
2226 * d_lookup searches the children of the parent dentry for the name in
2227 * question. If the dentry is found its reference count is incremented and the
2228 * dentry is returned. The caller must use dput to free the entry when it has
2229 * finished using it. %NULL is returned if the dentry does not exist.
2231 struct dentry *d_lookup(const struct dentry *parent, const struct qstr *name) d_lookup()
2233 struct dentry *dentry; d_lookup() local
2238 dentry = __d_lookup(parent, name); d_lookup()
2239 if (dentry) d_lookup()
2242 return dentry; d_lookup()
2247 * __d_lookup - search for a dentry (racy)
2248 * @parent: parent dentry
2250 * Returns: dentry, or NULL
2261 struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) __d_lookup()
2268 struct dentry *found = NULL; __d_lookup()
2269 struct dentry *dentry; __d_lookup() local
2281 * Take d_lock when comparing a candidate dentry, to avoid races __d_lookup()
2285 * walk here and result in missing our dentry, resulting in the __d_lookup()
2293 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { hlist_bl_for_each_entry_rcu()
2295 if (dentry->d_name.hash != hash) hlist_bl_for_each_entry_rcu()
2298 spin_lock(&dentry->d_lock); hlist_bl_for_each_entry_rcu()
2299 if (dentry->d_parent != parent) hlist_bl_for_each_entry_rcu()
2301 if (d_unhashed(dentry)) hlist_bl_for_each_entry_rcu()
2309 int tlen = dentry->d_name.len; hlist_bl_for_each_entry_rcu()
2310 const char *tname = dentry->d_name.name; hlist_bl_for_each_entry_rcu()
2311 if (parent->d_op->d_compare(parent, dentry, tlen, tname, name)) hlist_bl_for_each_entry_rcu()
2314 if (dentry->d_name.len != len) hlist_bl_for_each_entry_rcu()
2316 if (dentry_cmp(dentry, str, len)) hlist_bl_for_each_entry_rcu()
2320 dentry->d_lockref.count++; hlist_bl_for_each_entry_rcu()
2321 found = dentry; hlist_bl_for_each_entry_rcu()
2322 spin_unlock(&dentry->d_lock); hlist_bl_for_each_entry_rcu()
2325 spin_unlock(&dentry->d_lock); hlist_bl_for_each_entry_rcu()
2333 * d_hash_and_lookup - hash the qstr then search for a dentry
2339 struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) d_hash_and_lookup()
2358 * - turn this dentry into a negative dentry
2359 * - unhash this dentry and free it.
2362 * a negative dentry, but if anybody else is
2363 * currently using the dentry or the inode
2370 * d_delete - delete a dentry
2371 * @dentry: The dentry to delete
2373 * Turn the dentry into a negative dentry if possible, otherwise
2377 void d_delete(struct dentry * dentry) d_delete() argument
2385 spin_lock(&dentry->d_lock); d_delete()
2386 inode = dentry->d_inode; d_delete()
2388 if (dentry->d_lockref.count == 1) { d_delete()
2390 spin_unlock(&dentry->d_lock); d_delete()
2394 dentry->d_flags &= ~DCACHE_CANT_MOUNT; d_delete()
2395 dentry_unlink_inode(dentry); d_delete()
2396 fsnotify_nameremove(dentry, isdir); d_delete()
2400 if (!d_unhashed(dentry)) d_delete()
2401 __d_drop(dentry); d_delete()
2403 spin_unlock(&dentry->d_lock); d_delete()
2405 fsnotify_nameremove(dentry, isdir); d_delete()
2409 static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) __d_rehash()
2417 static void _d_rehash(struct dentry * entry) _d_rehash()
2424 * @entry: dentry to add to the hash
2426 * Adds a dentry to the hash according to its name.
2429 void d_rehash(struct dentry * entry) d_rehash()
2438 * dentry_update_name_case - update case insensitive dentry with a new name
2439 * @dentry: dentry to be updated
2442 * Update a case insensitive dentry with new case of name.
2444 * dentry must have been returned by d_lookup with name @name. Old and new
2451 void dentry_update_name_case(struct dentry *dentry, struct qstr *name) dentry_update_name_case() argument
2453 BUG_ON(!mutex_is_locked(&dentry->d_parent->d_inode->i_mutex)); dentry_update_name_case()
2454 BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ dentry_update_name_case()
2456 spin_lock(&dentry->d_lock); dentry_update_name_case()
2457 write_seqcount_begin(&dentry->d_seq); dentry_update_name_case()
2458 memcpy((unsigned char *)dentry->d_name.name, name->name, name->len); dentry_update_name_case()
2459 write_seqcount_end(&dentry->d_seq); dentry_update_name_case()
2460 spin_unlock(&dentry->d_lock); dentry_update_name_case()
2464 static void swap_names(struct dentry *dentry, struct dentry *target) swap_names() argument
2467 if (unlikely(dname_external(dentry))) { swap_names()
2471 swap(target->d_name.name, dentry->d_name.name); swap_names()
2474 * dentry:internal, target:external. Steal target's swap_names()
2477 memcpy(target->d_iname, dentry->d_name.name, swap_names()
2478 dentry->d_name.len + 1); swap_names()
2479 dentry->d_name.name = target->d_name.name; swap_names()
2483 if (unlikely(dname_external(dentry))) { swap_names()
2485 * dentry:external, target:internal. Give dentry's swap_names()
2486 * storage to target and make dentry internal swap_names()
2488 memcpy(dentry->d_iname, target->d_name.name, swap_names()
2490 target->d_name.name = dentry->d_name.name; swap_names()
2491 dentry->d_name.name = dentry->d_iname; swap_names()
2498 kmemcheck_mark_initialized(dentry->d_iname, DNAME_INLINE_LEN); swap_names()
2501 swap(((long *) &dentry->d_iname)[i], swap_names()
2506 swap(dentry->d_name.hash_len, target->d_name.hash_len); swap_names()
2509 static void copy_name(struct dentry *dentry, struct dentry *target) copy_name() argument
2512 if (unlikely(dname_external(dentry))) copy_name()
2513 old_name = external_name(dentry); copy_name()
2516 dentry->d_name = target->d_name; copy_name()
2518 memcpy(dentry->d_iname, target->d_name.name, copy_name()
2520 dentry->d_name.name = dentry->d_iname; copy_name()
2521 dentry->d_name.hash_len = target->d_name.hash_len; copy_name()
2527 static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) dentry_lock_for_move() argument
2532 if (IS_ROOT(dentry) || dentry->d_parent == target->d_parent) dentry_lock_for_move()
2535 if (d_ancestor(dentry->d_parent, target->d_parent)) { dentry_lock_for_move()
2536 spin_lock(&dentry->d_parent->d_lock); dentry_lock_for_move()
2541 spin_lock_nested(&dentry->d_parent->d_lock, dentry_lock_for_move()
2545 if (target < dentry) { dentry_lock_for_move()
2547 spin_lock_nested(&dentry->d_lock, 3); dentry_lock_for_move()
2549 spin_lock_nested(&dentry->d_lock, 2); dentry_lock_for_move()
2554 static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target) dentry_unlock_for_move() argument
2556 if (target->d_parent != dentry->d_parent) dentry_unlock_for_move()
2557 spin_unlock(&dentry->d_parent->d_lock); dentry_unlock_for_move()
2561 spin_unlock(&dentry->d_lock); dentry_unlock_for_move()
2579 * __d_move - move a dentry
2580 * @dentry: entry to move
2581 * @target: new dentry
2589 static void __d_move(struct dentry *dentry, struct dentry *target, __d_move() argument
2592 if (!dentry->d_inode) __d_move()
2595 BUG_ON(d_ancestor(dentry, target)); __d_move()
2596 BUG_ON(d_ancestor(target, dentry)); __d_move()
2598 dentry_lock_for_move(dentry, target); __d_move()
2600 write_seqcount_begin(&dentry->d_seq); __d_move()
2606 * Move the dentry to the target hash queue. Don't bother checking __d_move()
2609 __d_drop(dentry); __d_move()
2610 __d_rehash(dentry, d_hash(target->d_parent, target->d_name.hash)); __d_move()
2619 d_hash(dentry->d_parent, dentry->d_name.hash)); __d_move()
2624 swap_names(dentry, target); __d_move()
2626 copy_name(dentry, target); __d_move()
2629 if (IS_ROOT(dentry)) { __d_move()
2631 dentry->d_flags |= DCACHE_RCUACCESS; __d_move()
2632 dentry->d_parent = target->d_parent; __d_move()
2635 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); __d_move()
2638 swap(dentry->d_parent, target->d_parent); __d_move()
2640 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); __d_move()
2643 fsnotify_d_move(dentry); __d_move()
2647 write_seqcount_end(&dentry->d_seq); __d_move()
2649 dentry_unlock_for_move(dentry, target); __d_move()
2653 * d_move - move a dentry
2654 * @dentry: entry to move
2655 * @target: new dentry
2661 void d_move(struct dentry *dentry, struct dentry *target) d_move() argument
2664 __d_move(dentry, target, false); d_move()
2671 * @dentry1: first dentry
2672 * @dentry2: second dentry
2674 void d_exchange(struct dentry *dentry1, struct dentry *dentry2) d_exchange()
2690 * @p1: ancestor dentry
2691 * @p2: child dentry
2693 * Returns the ancestor dentry of p2 which is a child of p1, if p1 is
2696 struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2) d_ancestor()
2698 struct dentry *p; d_ancestor()
2711 * dentry->d_parent->d_inode->i_mutex, inode->i_lock and rename_lock
2717 struct dentry *dentry, struct dentry *alias) __d_unalias()
2722 /* If alias and dentry share a parent, then no extra locks required */ __d_unalias()
2723 if (alias->d_parent == dentry->d_parent) __d_unalias()
2727 if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) __d_unalias()
2729 m1 = &dentry->d_sb->s_vfs_rename_mutex; __d_unalias()
2734 __d_move(alias, dentry, false); __d_unalias()
2746 * d_splice_alias - splice a disconnected dentry into the tree if one exists
2747 * @inode: the inode which may have a disconnected dentry
2748 * @dentry: a negative dentry which we want to point to the inode.
2751 * place of the given dentry and return it, else simply d_add the inode
2752 * to the dentry and return NULL.
2760 * If a dentry was found and moved, then it is returned. Otherwise NULL
2763 * Cluster filesystems may call this function with a negative, hashed dentry.
2765 * will only occur during atomic_open. So we need to check for the dentry
2768 struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) d_splice_alias() argument
2773 BUG_ON(!d_unhashed(dentry)); d_splice_alias()
2776 __d_instantiate(dentry, NULL); d_splice_alias()
2781 struct dentry *new = __d_find_any_alias(inode); d_splice_alias()
2784 if (unlikely(d_ancestor(new, dentry))) { d_splice_alias()
2792 dentry->d_name.name, d_splice_alias()
2796 int err = __d_unalias(inode, dentry, new); d_splice_alias()
2803 __d_move(new, dentry, false); d_splice_alias()
2813 __d_instantiate(dentry, inode); d_splice_alias()
2816 security_d_instantiate(dentry, inode); d_splice_alias()
2817 d_rehash(dentry); d_splice_alias()
2874 * @path: the dentry/vfsmount to report
2875 * @root: root vfsmnt/dentry
2882 * in the dentry's d_seq will be preceded by changes in the rename_lock
2886 * parent pointer references will keep the dentry chain alive as long as no
2893 struct dentry *dentry; prepend_path() local
2910 dentry = path->dentry; prepend_path()
2914 while (dentry != root->dentry || vfsmnt != root->mnt) { prepend_path()
2915 struct dentry * parent; prepend_path()
2917 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { prepend_path()
2920 if (dentry != vfsmnt->mnt_root) { prepend_path()
2928 dentry = ACCESS_ONCE(mnt->mnt_mountpoint); prepend_path()
2937 parent = dentry->d_parent; prepend_path()
2939 error = prepend_name(&bptr, &blen, &dentry->d_name); prepend_path()
2943 dentry = parent; prepend_path()
2973 * __d_path - return the path of a dentry
2974 * @path: the dentry/vfsmount to report
2975 * @root: root vfsmnt/dentry
2979 * Convert a dentry into an ASCII path name.
3030 if (d_unlinked(path->dentry)) { path_with_deleted()
3055 * d_path - return the path of a dentry
3060 * Convert a dentry into an ASCII path name. If the entry has been deleted
3084 * path->dentry == path->mnt->mnt_root. In that case don't call d_dname d_path()
3087 if (path->dentry->d_op && path->dentry->d_op->d_dname && d_path()
3088 (!IS_ROOT(path->dentry) || path->dentry != path->mnt->mnt_root)) d_path()
3089 return path->dentry->d_op->d_dname(path->dentry, buf, buflen); d_path()
3105 char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen, dynamic_dname() argument
3123 char *simple_dname(struct dentry *dentry, char *buffer, int buflen) simple_dname() argument
3128 prepend(&end, &buflen, dentry->d_name.name, dentry->d_name.len) || simple_dname()
3138 static char *__dentry_path(struct dentry *d, char *buf, int buflen) __dentry_path()
3140 struct dentry *dentry; __dentry_path() local
3150 dentry = d; __dentry_path()
3158 while (!IS_ROOT(dentry)) { __dentry_path()
3159 struct dentry *parent = dentry->d_parent; __dentry_path()
3162 error = prepend_name(&end, &len, &dentry->d_name); __dentry_path()
3167 dentry = parent; __dentry_path()
3183 char *dentry_path_raw(struct dentry *dentry, char *buf, int buflen) dentry_path_raw() argument
3185 return __dentry_path(dentry, buf, buflen); dentry_path_raw()
3189 char *dentry_path(struct dentry *dentry, char *buf, int buflen) dentry_path() argument
3194 if (d_unlinked(dentry)) { dentry_path()
3200 retval = __dentry_path(dentry, buf, buflen); dentry_path()
3251 if (!d_unlinked(pwd.dentry)) { SYSCALL_DEFINE2()
3293 * is_subdir - is new dentry a subdirectory of old_dentry
3294 * @new_dentry: new dentry
3295 * @old_dentry: old dentry
3302 int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) is_subdir()
3328 static enum d_walk_ret d_genocide_kill(void *data, struct dentry *dentry) d_genocide_kill() argument
3330 struct dentry *root = data; d_genocide_kill()
3331 if (dentry != root) { d_genocide_kill()
3332 if (d_unhashed(dentry) || !dentry->d_inode) d_genocide_kill()
3335 if (!(dentry->d_flags & DCACHE_GENOCIDE)) { d_genocide_kill()
3336 dentry->d_flags |= DCACHE_GENOCIDE; d_genocide_kill()
3337 dentry->d_lockref.count--; d_genocide_kill()
3343 void d_genocide(struct dentry *parent) d_genocide()
3348 void d_tmpfile(struct dentry *dentry, struct inode *inode) d_tmpfile() argument
3351 BUG_ON(dentry->d_name.name != dentry->d_iname || d_tmpfile()
3352 !hlist_unhashed(&dentry->d_u.d_alias) || d_tmpfile()
3353 !d_unlinked(dentry)); d_tmpfile()
3354 spin_lock(&dentry->d_parent->d_lock); d_tmpfile()
3355 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); d_tmpfile()
3356 dentry->d_name.len = sprintf(dentry->d_iname, "#%llu", d_tmpfile()
3358 spin_unlock(&dentry->d_lock); d_tmpfile()
3359 spin_unlock(&dentry->d_parent->d_lock); d_tmpfile()
3360 d_instantiate(dentry, inode); d_tmpfile()
3408 dentry_cache = KMEM_CACHE(dentry, dcache_init()
2096 slow_dentry_cmp( const struct dentry *parent, struct dentry *dentry, unsigned int seq, const struct qstr *name) slow_dentry_cmp() argument
2716 __d_unalias(struct inode *inode, struct dentry *dentry, struct dentry *alias) __d_unalias() argument
H A Dnsfs.c14 static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) ns_dname() argument
16 struct inode *inode = d_inode(dentry); ns_dname()
17 const struct proc_ns_operations *ns_ops = dentry->d_fsdata; ns_dname()
19 return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", ns_dname()
23 static void ns_prune_dentry(struct dentry *dentry) ns_prune_dentry() argument
25 struct inode *inode = d_inode(dentry); ns_prune_dentry()
51 struct dentry *dentry; ns_get_path() local
66 dentry = (struct dentry *)d; ns_get_path()
67 if (!lockref_get_not_dead(&dentry->d_lockref)) ns_get_path()
73 path->dentry = dentry; ns_get_path()
90 dentry = d_alloc_pseudo(mnt->mnt_sb, &qname); ns_get_path()
91 if (!dentry) { ns_get_path()
96 d_instantiate(dentry, inode); ns_get_path()
97 dentry->d_fsdata = (void *)ns_ops; ns_get_path()
98 d = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry); ns_get_path()
100 d_delete(dentry); /* make sure ->d_prune() does nothing */ ns_get_path()
101 dput(dentry); ns_get_path()
143 static struct dentry *nsfs_mount(struct file_system_type *fs_type, nsfs_mount()
H A Dbad_inode.c28 static int bad_inode_create (struct inode *dir, struct dentry *dentry, bad_inode_create() argument
34 static struct dentry *bad_inode_lookup(struct inode *dir, bad_inode_lookup() argument
35 struct dentry *dentry, unsigned int flags) bad_inode_lookup()
40 static int bad_inode_link (struct dentry *old_dentry, struct inode *dir, bad_inode_link() argument
41 struct dentry *dentry) bad_inode_link()
46 static int bad_inode_unlink(struct inode *dir, struct dentry *dentry) bad_inode_unlink() argument
51 static int bad_inode_symlink (struct inode *dir, struct dentry *dentry, bad_inode_symlink() argument
57 static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, bad_inode_mkdir() argument
63 static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry) bad_inode_rmdir() argument
68 static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, bad_inode_mknod() argument
74 static int bad_inode_rename2(struct inode *old_dir, struct dentry *old_dentry, bad_inode_rename2()
75 struct inode *new_dir, struct dentry *new_dentry, bad_inode_rename2()
81 static int bad_inode_readlink(struct dentry *dentry, char __user *buffer, bad_inode_readlink() argument
92 static int bad_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, bad_inode_getattr() argument
98 static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs) bad_inode_setattr()
103 static int bad_inode_setxattr(struct dentry *dentry, const char *name, bad_inode_setxattr() argument
109 static ssize_t bad_inode_getxattr(struct dentry *dentry, const char *name, bad_inode_getxattr() argument
115 static ssize_t bad_inode_listxattr(struct dentry *dentry, char *buffer, bad_inode_listxattr() argument
121 static int bad_inode_removexattr(struct dentry *dentry, const char *name) bad_inode_removexattr() argument
H A Dmount.h25 struct dentry *m_dentry;
33 struct dentry *mnt_mountpoint;
67 struct dentry *mnt_ex_mountpoint;
88 extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *);
89 extern struct mount *__lookup_mnt_last(struct vfsmount *, struct dentry *);
93 extern void __detach_mounts(struct dentry *dentry);
95 static inline void detach_mounts(struct dentry *dentry) detach_mounts() argument
97 if (!d_mountpoint(dentry)) detach_mounts()
99 __detach_mounts(dentry); detach_mounts()
133 extern bool __is_local_mountpoint(struct dentry *dentry); is_local_mountpoint()
134 static inline bool is_local_mountpoint(struct dentry *dentry) is_local_mountpoint() argument
136 if (!d_mountpoint(dentry)) is_local_mountpoint()
139 return __is_local_mountpoint(dentry); is_local_mountpoint()
H A Dnamei.c473 * Given a path increment the reference count to the dentry and the vfsmount.
478 dget(path->dentry); path_get()
486 * Given a path decrement the reference count to the dentry and the vfsmount.
490 dput(path->dentry); path_put()
499 struct inode *inode; /* path.dentry.d_inode */
509 * path_connected - Verify that a path->dentry is below path->mnt.mnt_root
523 return is_subdir(path->dentry, mnt->mnt_root); path_connected()
540 * @dentry: child of nd->path.dentry or NULL
543 * unlazy_walk attempts to legitimize the current nd->path, nd->root and dentry
544 * for ref-walk mode. @dentry must be a path found by a do_lookup call on
547 static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) unlazy_walk() argument
550 struct dentry *parent = nd->path.dentry; unlazy_walk()
558 * before returning. Do vfsmount first; if dentry unlazy_walk()
559 * can't be legitimized, just set nd->path.dentry to NULL unlazy_walk()
567 nd->path.dentry = NULL; unlazy_walk()
573 * sequence point, and it only needs to revalidate the parent dentry. unlazy_walk()
576 * dentry from the RCU domain to be properly refcounted. And the unlazy_walk()
577 * sequence number in the dentry validates *both* dentry counters, unlazy_walk()
582 if (!dentry) { unlazy_walk()
587 if (!lockref_get_not_dead(&dentry->d_lockref)) unlazy_walk()
589 if (read_seqcount_retry(&dentry->d_seq, nd->seq)) unlazy_walk()
599 if (nd->root.mnt != fs->root.mnt || nd->root.dentry != fs->root.dentry) unlazy_walk()
612 dput(dentry); unlazy_walk()
622 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) d_revalidate() argument
624 return dentry->d_op->d_revalidate(dentry, flags); d_revalidate()
639 struct dentry *dentry = nd->path.dentry; complete_walk() local
651 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) { complete_walk()
656 if (read_seqcount_retry(&dentry->d_seq, nd->seq)) { complete_walk()
658 dput(dentry); complete_walk()
668 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) complete_walk()
671 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); complete_walk()
697 res = __read_seqcount_begin(&nd->root.dentry->d_seq); set_root_rcu()
704 dput(path->dentry); path_put_conditional()
713 dput(nd->path.dentry); path_to_nameidata()
718 nd->path.dentry = path->dentry; path_to_nameidata()
730 nd->inode = nd->path.dentry->d_inode; nd_jump_link()
748 struct inode *inode = link->dentry->d_inode; put_link()
750 inode->i_op->put_link(link->dentry, nd, cookie); put_link()
782 inode = link->dentry->d_inode; may_follow_link()
787 parent = nd->path.dentry->d_inode; may_follow_link()
857 inode = link->dentry->d_inode; may_linkat()
873 struct dentry *dentry = link->dentry; follow_link() local
892 error = security_inode_follow_link(link->dentry, nd); follow_link()
897 *p = dentry->d_inode->i_op->follow_link(dentry, nd); follow_link()
918 nd->inode = nd->path.dentry->d_inode; follow_link()
937 struct dentry *mountpoint; follow_up_rcu()
943 path->dentry = mountpoint; follow_up_rcu()
962 struct dentry *mountpoint; follow_up()
973 dput(path->dentry); follow_up()
974 path->dentry = mountpoint; follow_up()
992 if (!path->dentry->d_op || !path->dentry->d_op->d_automount) follow_automount()
1008 path->dentry->d_inode) follow_automount()
1015 mnt = path->dentry->d_op->d_automount(path); follow_automount()
1020 * this so that its userspace daemon can mount on this dentry. follow_automount()
1048 path->dentry = dget(mnt->mnt_root); follow_automount()
1057 * Handle a dentry that is managed in some way.
1074 * local variable for each dentry as we look at it so that we don't see follow_managed()
1076 while (managed = ACCESS_ONCE(path->dentry->d_flags), follow_managed()
1082 BUG_ON(!path->dentry->d_op); follow_managed()
1083 BUG_ON(!path->dentry->d_op->d_manage); follow_managed()
1084 ret = path->dentry->d_op->d_manage(path->dentry, false); follow_managed()
1093 dput(path->dentry); follow_managed()
1097 path->dentry = dget(mounted->mnt_root); follow_managed()
1102 /* Something is mounted on this dentry in another follow_managed()
1133 dput(path->dentry); follow_down_one()
1136 path->dentry = dget(mounted->mnt_root); follow_down_one()
1143 static inline int managed_dentry_rcu(struct dentry *dentry) managed_dentry_rcu() argument
1145 return (dentry->d_flags & DCACHE_MANAGE_TRANSIT) ? managed_dentry_rcu()
1146 dentry->d_op->d_manage(dentry, true) : 0; managed_dentry_rcu()
1151 * we meet a managed dentry that would need blocking.
1159 * Don't forget we might have a non-mountpoint managed dentry __follow_mount_rcu()
1162 switch (managed_dentry_rcu(path->dentry)) { __follow_mount_rcu()
1172 if (!d_mountpoint(path->dentry)) __follow_mount_rcu()
1173 return !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); __follow_mount_rcu()
1175 mounted = __lookup_mnt(path->mnt, path->dentry); __follow_mount_rcu()
1179 path->dentry = mounted->mnt.mnt_root; __follow_mount_rcu()
1181 nd->seq = read_seqcount_begin(&path->dentry->d_seq); __follow_mount_rcu()
1184 * dentry sequence number here after this d_inode read, __follow_mount_rcu()
1187 *inode = path->dentry->d_inode; __follow_mount_rcu()
1190 !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); __follow_mount_rcu()
1200 if (nd->path.dentry == nd->root.dentry && follow_dotdot_rcu()
1204 if (nd->path.dentry != nd->path.mnt->mnt_root) { follow_dotdot_rcu()
1205 struct dentry *old = nd->path.dentry; follow_dotdot_rcu()
1206 struct dentry *parent = old->d_parent; follow_dotdot_rcu()
1213 nd->path.dentry = parent; follow_dotdot_rcu()
1221 inode = nd->path.dentry->d_inode; follow_dotdot_rcu()
1222 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); follow_dotdot_rcu()
1224 while (d_mountpoint(nd->path.dentry)) { follow_dotdot_rcu()
1226 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry); follow_dotdot_rcu()
1230 nd->path.dentry = mounted->mnt.mnt_root; follow_dotdot_rcu()
1231 inode = nd->path.dentry->d_inode; follow_dotdot_rcu()
1232 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); follow_dotdot_rcu()
1249 * point, the filesystem owning that dentry may be queried as to whether the
1257 while (managed = ACCESS_ONCE(path->dentry->d_flags), follow_down()
1270 BUG_ON(!path->dentry->d_op); follow_down()
1271 BUG_ON(!path->dentry->d_op->d_manage); follow_down()
1272 ret = path->dentry->d_op->d_manage( follow_down()
1273 path->dentry, false); follow_down()
1283 dput(path->dentry); follow_down()
1286 path->dentry = dget(mounted->mnt_root); follow_down()
1302 while (d_mountpoint(path->dentry)) { follow_mount()
1306 dput(path->dentry); follow_mount()
1309 path->dentry = dget(mounted->mnt_root); follow_mount()
1319 struct dentry *old = nd->path.dentry; follow_dotdot()
1321 if (nd->path.dentry == nd->root.dentry && follow_dotdot()
1325 if (nd->path.dentry != nd->path.mnt->mnt_root) { follow_dotdot()
1327 nd->path.dentry = dget_parent(nd->path.dentry); follow_dotdot()
1339 nd->inode = nd->path.dentry->d_inode; follow_dotdot()
1344 * This looks up the name in dcache, possibly revalidates the old dentry and
1350 static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir, lookup_dcache()
1353 struct dentry *dentry; lookup_dcache() local
1357 dentry = d_lookup(dir, name); lookup_dcache()
1358 if (dentry) { lookup_dcache()
1359 if (dentry->d_flags & DCACHE_OP_REVALIDATE) { lookup_dcache()
1360 error = d_revalidate(dentry, flags); lookup_dcache()
1363 dput(dentry); lookup_dcache()
1366 d_invalidate(dentry); lookup_dcache()
1367 dput(dentry); lookup_dcache()
1368 dentry = NULL; lookup_dcache()
1374 if (!dentry) { lookup_dcache()
1375 dentry = d_alloc(dir, name); lookup_dcache()
1376 if (unlikely(!dentry)) lookup_dcache()
1381 return dentry; lookup_dcache()
1385 * Call i_op->lookup on the dentry. The dentry must be negative and
1390 static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry, lookup_real() argument
1393 struct dentry *old; lookup_real()
1395 /* Don't create child dentry for a dead directory. */ lookup_real()
1397 dput(dentry); lookup_real()
1401 old = dir->i_op->lookup(dir, dentry, flags); lookup_real()
1403 dput(dentry); lookup_real()
1404 dentry = old; lookup_real()
1406 return dentry; lookup_real()
1409 static struct dentry *__lookup_hash(struct qstr *name, __lookup_hash()
1410 struct dentry *base, unsigned int flags) __lookup_hash()
1413 struct dentry *dentry; __lookup_hash() local
1415 dentry = lookup_dcache(name, base, flags, &need_lookup); __lookup_hash()
1417 return dentry; __lookup_hash()
1419 return lookup_real(base->d_inode, dentry, flags); __lookup_hash()
1431 struct dentry *dentry, *parent = nd->path.dentry; lookup_fast() local
1444 dentry = __d_lookup_rcu(parent, &nd->last, &seq); lookup_fast()
1445 if (!dentry) lookup_fast()
1450 * the dentry name information from lookup. lookup_fast()
1452 *inode = dentry->d_inode; lookup_fast()
1453 negative = d_is_negative(dentry); lookup_fast()
1454 if (read_seqcount_retry(&dentry->d_seq, seq)) lookup_fast()
1459 * changes while we did the lookup of the dentry above. lookup_fast()
1468 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { lookup_fast()
1469 status = d_revalidate(dentry, nd->flags); lookup_fast()
1477 * Note: do negative dentry check after revalidation in lookup_fast()
1483 path->dentry = dentry; lookup_fast()
1487 if (unlazy_walk(nd, dentry)) lookup_fast()
1490 dentry = __d_lookup(parent, &nd->last); lookup_fast()
1493 if (unlikely(!dentry)) lookup_fast()
1496 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) lookup_fast()
1497 status = d_revalidate(dentry, nd->flags); lookup_fast()
1500 dput(dentry); lookup_fast()
1503 d_invalidate(dentry); lookup_fast()
1504 dput(dentry); lookup_fast()
1508 if (unlikely(d_is_negative(dentry))) { lookup_fast()
1509 dput(dentry); lookup_fast()
1513 path->dentry = dentry; lookup_fast()
1521 *inode = path->dentry->d_inode; lookup_fast()
1531 struct dentry *dentry, *parent; lookup_slow() local
1534 parent = nd->path.dentry; lookup_slow()
1538 dentry = __lookup_hash(&nd->last, parent, nd->flags); lookup_slow()
1540 if (IS_ERR(dentry)) lookup_slow()
1541 return PTR_ERR(dentry); lookup_slow()
1543 path->dentry = dentry; lookup_slow()
1596 static inline int should_follow_link(struct dentry *dentry, int follow) should_follow_link() argument
1598 return unlikely(d_is_symlink(dentry)) ? follow : 0; should_follow_link()
1623 if (d_is_negative(path->dentry)) walk_component()
1625 inode = path->dentry->d_inode; walk_component()
1628 if (should_follow_link(path->dentry, follow)) { walk_component()
1631 unlazy_walk(nd, path->dentry))) { walk_component()
1636 BUG_ON(inode != path->dentry->d_inode); walk_component()
1688 * We can do the critical dentry name comparison and hashing
1806 * the final dentry. We expect 'base' to be positive and a directory.
1808 * Returns 0 and nd will have valid dentry and mnt on success.
1844 struct dentry *parent = nd->path.dentry; link_path_walk()
1882 if (!d_can_lookup(nd->path.dentry)) { link_path_walk()
1902 struct dentry *root = nd->root.dentry; path_init()
1915 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); path_init()
1945 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); path_init()
1953 struct dentry *dentry; path_init() local
1958 dentry = f.file->f_path.dentry; path_init()
1961 if (!d_can_lookup(dentry)) { path_init()
1971 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); path_init()
1979 nd->inode = nd->path.dentry->d_inode; path_init()
1982 if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq))) path_init()
2055 if (!d_can_lookup(nd->path.dentry)) { path_lookupat()
2075 audit_inode(name, nd->path.dentry, flags & LOOKUP_PARENT); filename_lookup()
2080 struct dentry *kern_path_locked(const char *name, struct path *path) kern_path_locked()
2084 struct dentry *d; kern_path_locked()
2100 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); kern_path_locked()
2101 d = __lookup_hash(&nd.last, nd.path.dentry, 0); kern_path_locked()
2103 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); kern_path_locked()
2130 * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair
2131 * @dentry: pointer to dentry of the base directory
2137 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, vfs_path_lookup() argument
2149 nd.root.dentry = dentry; vfs_path_lookup()
2166 static struct dentry *lookup_hash(struct nameidata *nd) lookup_hash()
2168 return __lookup_hash(&nd->last, nd->path.dentry, nd->flags); lookup_hash()
2180 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) lookup_one_len()
2291 * lookup found a negative dentry. The nd->path reference will also be
2306 struct dentry *dentry; mountpoint_last() local
2307 struct dentry *dir = nd->path.dentry; mountpoint_last()
2323 dentry = dget(nd->path.dentry); mountpoint_last()
2328 dentry = d_lookup(dir, &nd->last); mountpoint_last()
2329 if (!dentry) { mountpoint_last()
2331 * No cached dentry. Mounted dentries are pinned in the cache, mountpoint_last()
2332 * so that means that this dentry is probably a symlink or the mountpoint_last()
2333 * path doesn't actually point to a mounted dentry. mountpoint_last()
2335 dentry = d_alloc(dir, &nd->last); mountpoint_last()
2336 if (!dentry) { mountpoint_last()
2341 dentry = lookup_real(dir->d_inode, dentry, nd->flags); mountpoint_last()
2342 error = PTR_ERR(dentry); mountpoint_last()
2343 if (IS_ERR(dentry)) { mountpoint_last()
2351 if (d_is_negative(dentry)) { mountpoint_last()
2353 dput(dentry); mountpoint_last()
2356 path->dentry = dentry; mountpoint_last()
2358 if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) mountpoint_last()
2421 audit_inode(name, path->dentry, 0); filename_mountpoint()
2435 * simply want track down the dentry and vfsmount attached at the mountpoint
2486 static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) may_delete()
2521 /* Check whether we can create an object with dentry child in directory
2529 static inline int may_create(struct inode *dir, struct dentry *child) may_create()
2542 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) lock_rename()
2544 struct dentry *p; lock_rename()
2573 void unlock_rename(struct dentry *p1, struct dentry *p2) unlock_rename()
2583 int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, vfs_create() argument
2586 int error = may_create(dir, dentry); vfs_create()
2594 error = security_inode_create(dir, dentry, mode); vfs_create()
2597 error = dir->i_op->create(dir, dentry, mode, want_excl); vfs_create()
2599 fsnotify_create(dir, dentry); vfs_create()
2606 struct dentry *dentry = path->dentry; may_open() local
2607 struct inode *inode = dentry->d_inode; may_open()
2659 struct inode *inode = path->dentry->d_inode; handle_truncate()
2670 error = do_truncate(path->dentry, 0, handle_truncate()
2685 static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode) may_o_create() argument
2687 int error = security_path_mknod(dir, dentry, mode, 0); may_o_create()
2691 error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); may_o_create()
2695 return security_inode_create(dir->dentry->d_inode, dentry, mode); may_o_create()
2700 * dentry.
2707 * updated to point to the new dentry. This may be negative.
2711 static int atomic_open(struct nameidata *nd, struct dentry *dentry, atomic_open() argument
2717 struct inode *dir = nd->path.dentry->d_inode; atomic_open()
2723 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; atomic_open()
2726 BUG_ON(dentry->d_inode); atomic_open()
2728 /* Don't create child dentry for a dead directory. */ atomic_open()
2771 error = may_o_create(&nd->path, dentry, mode); atomic_open()
2783 file->f_path.dentry = DENTRY_NOT_SET; atomic_open()
2785 error = dir->i_op->atomic_open(dir, dentry, file, open_flag, mode, atomic_open()
2794 if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { atomic_open()
2798 if (file->f_path.dentry) { atomic_open()
2799 dput(dentry); atomic_open()
2800 dentry = file->f_path.dentry; atomic_open()
2803 fsnotify_create(dir, dentry); atomic_open()
2804 if (!dentry->d_inode) { atomic_open()
2826 fsnotify_create(dir, dentry); atomic_open()
2834 dput(dentry); atomic_open()
2839 dentry = lookup_real(dir, dentry, nd->flags); atomic_open()
2840 if (IS_ERR(dentry)) atomic_open()
2841 return PTR_ERR(dentry); atomic_open()
2843 if (create_error && !dentry->d_inode) { atomic_open()
2848 path->dentry = dentry; atomic_open()
2862 * and creations will have been performed and the dentry returned in @path will
2864 * specified then a negative dentry may be returned.
2868 * FILE_CREATE will be set in @*opened if the dentry was created and will be
2876 struct dentry *dir = nd->path.dentry; lookup_open()
2878 struct dentry *dentry; lookup_open() local
2883 dentry = lookup_dcache(&nd->last, dir, nd->flags, &need_lookup); lookup_open()
2884 if (IS_ERR(dentry)) lookup_open()
2885 return PTR_ERR(dentry); lookup_open()
2887 /* Cached positive dentry: will open in f_op->open */ lookup_open()
2888 if (!need_lookup && dentry->d_inode) lookup_open()
2892 return atomic_open(nd, dentry, path, file, op, got_write, lookup_open()
2897 BUG_ON(dentry->d_inode); lookup_open()
2899 dentry = lookup_real(dir_inode, dentry, nd->flags); lookup_open()
2900 if (IS_ERR(dentry)) lookup_open()
2901 return PTR_ERR(dentry); lookup_open()
2904 /* Negative dentry, just create the file */ lookup_open()
2905 if (!dentry->d_inode && (op->open_flag & O_CREAT)) { lookup_open()
2921 error = security_path_mknod(&nd->path, dentry, mode, 0); lookup_open()
2924 error = vfs_create(dir->d_inode, dentry, mode, lookup_open()
2930 path->dentry = dentry; lookup_open()
2935 dput(dentry); lookup_open()
2946 struct dentry *dir = nd->path.dentry; do_last()
2953 struct path save_parent = { .dentry = NULL, .mnt = NULL }; do_last()
3022 audit_inode(name, file->f_path.dentry, 0); do_last()
3038 if (d_is_positive(path->dentry)) do_last()
3039 audit_inode(name, path->dentry, 0); do_last()
3063 inode = path->dentry->d_inode; do_last()
3065 if (d_is_negative(path->dentry)) { do_last()
3069 inode = path->dentry->d_inode; do_last()
3072 if (should_follow_link(path->dentry, !symlink_ok)) { do_last()
3075 unlazy_walk(nd, path->dentry))) { do_last()
3080 BUG_ON(inode != path->dentry->d_inode); do_last()
3087 save_parent.dentry = nd->path.dentry; do_last()
3089 nd->path.dentry = path->dentry; do_last()
3100 audit_inode(name, nd->path.dentry, 0); do_last()
3102 if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) do_last()
3105 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) do_last()
3107 if (!d_is_reg(nd->path.dentry)) do_last()
3163 if (!save_parent.dentry || retried) do_last()
3166 BUG_ON(save_parent.dentry != dir); do_last()
3171 save_parent.dentry = NULL; do_last()
3186 struct dentry *dentry, *child; do_tmpfile() local
3199 dentry = nd->path.dentry; do_tmpfile()
3200 dir = dentry->d_inode; do_tmpfile()
3205 child = d_alloc(dentry, &name); do_tmpfile()
3212 dput(nd->path.dentry); do_tmpfile()
3213 nd->path.dentry = child; do_tmpfile()
3214 error = dir->i_op->tmpfile(dir, nd->path.dentry, op->mode); do_tmpfile()
3217 audit_inode(pathname, nd->path.dentry, 0); do_tmpfile()
3223 error = finish_open(file, nd->path.dentry, NULL, opened); do_tmpfile()
3320 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, do_file_open_root() argument
3329 nd.root.dentry = dentry; do_file_open_root()
3331 if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) do_file_open_root()
3347 static struct dentry *filename_create(int dfd, struct filename *name, filename_create()
3350 struct dentry *dentry = ERR_PTR(-EEXIST); filename_create() local
3380 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); filename_create()
3381 dentry = lookup_hash(&nd); filename_create()
3382 if (IS_ERR(dentry)) filename_create()
3386 if (d_is_positive(dentry)) filename_create()
3391 * From the vfs_mknod() POV we just have a negative dentry - filename_create()
3404 return dentry; filename_create()
3406 dput(dentry); filename_create()
3407 dentry = ERR_PTR(error); filename_create()
3409 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); filename_create()
3414 return dentry; filename_create()
3417 struct dentry *kern_path_create(int dfd, const char *pathname, kern_path_create()
3421 struct dentry *res; kern_path_create()
3431 void done_path_create(struct path *path, struct dentry *dentry) done_path_create() argument
3433 dput(dentry); done_path_create()
3434 mutex_unlock(&path->dentry->d_inode->i_mutex); done_path_create()
3440 struct dentry *user_path_create(int dfd, const char __user *pathname, user_path_create()
3444 struct dentry *res; user_path_create()
3453 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) vfs_mknod() argument
3455 int error = may_create(dir, dentry); vfs_mknod()
3470 error = security_inode_mknod(dir, dentry, mode, dev); vfs_mknod()
3474 error = dir->i_op->mknod(dir, dentry, mode, dev); vfs_mknod()
3476 fsnotify_create(dir, dentry); vfs_mknod()
3501 struct dentry *dentry; SYSCALL_DEFINE4() local
3510 dentry = user_path_create(dfd, filename, &path, lookup_flags); SYSCALL_DEFINE4()
3511 if (IS_ERR(dentry)) SYSCALL_DEFINE4()
3512 return PTR_ERR(dentry); SYSCALL_DEFINE4()
3514 if (!IS_POSIXACL(path.dentry->d_inode)) SYSCALL_DEFINE4()
3516 error = security_path_mknod(&path, dentry, mode, dev); SYSCALL_DEFINE4()
3521 error = vfs_create(path.dentry->d_inode,dentry,mode,true); SYSCALL_DEFINE4()
3524 error = vfs_mknod(path.dentry->d_inode,dentry,mode, SYSCALL_DEFINE4()
3528 error = vfs_mknod(path.dentry->d_inode,dentry,mode,0); SYSCALL_DEFINE4()
3532 done_path_create(&path, dentry); SYSCALL_DEFINE4()
3545 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) vfs_mkdir() argument
3547 int error = may_create(dir, dentry); vfs_mkdir()
3557 error = security_inode_mkdir(dir, dentry, mode); vfs_mkdir()
3564 error = dir->i_op->mkdir(dir, dentry, mode); vfs_mkdir()
3566 fsnotify_mkdir(dir, dentry); vfs_mkdir()
3573 struct dentry *dentry; SYSCALL_DEFINE3() local
3579 dentry = user_path_create(dfd, pathname, &path, lookup_flags); SYSCALL_DEFINE3()
3580 if (IS_ERR(dentry)) SYSCALL_DEFINE3()
3581 return PTR_ERR(dentry); SYSCALL_DEFINE3()
3583 if (!IS_POSIXACL(path.dentry->d_inode)) SYSCALL_DEFINE3()
3585 error = security_path_mkdir(&path, dentry, mode); SYSCALL_DEFINE3()
3587 error = vfs_mkdir(path.dentry->d_inode, dentry, mode); SYSCALL_DEFINE3()
3588 done_path_create(&path, dentry); SYSCALL_DEFINE3()
3602 * The dentry_unhash() helper will try to drop the dentry early: we
3604 * dentry, and if that is true (possibly after pruning the dcache),
3605 * then we drop the dentry now.
3610 * if (!d_unhashed(dentry))
3616 void dentry_unhash(struct dentry *dentry) dentry_unhash() argument
3618 shrink_dcache_parent(dentry); dentry_unhash()
3619 spin_lock(&dentry->d_lock); dentry_unhash()
3620 if (dentry->d_lockref.count == 1) dentry_unhash()
3621 __d_drop(dentry); dentry_unhash()
3622 spin_unlock(&dentry->d_lock); dentry_unhash()
3626 int vfs_rmdir(struct inode *dir, struct dentry *dentry) vfs_rmdir() argument
3628 int error = may_delete(dir, dentry, 1); vfs_rmdir()
3636 dget(dentry); vfs_rmdir()
3637 mutex_lock(&dentry->d_inode->i_mutex); vfs_rmdir()
3640 if (is_local_mountpoint(dentry)) vfs_rmdir()
3643 error = security_inode_rmdir(dir, dentry); vfs_rmdir()
3647 shrink_dcache_parent(dentry); vfs_rmdir()
3648 error = dir->i_op->rmdir(dir, dentry); vfs_rmdir()
3652 dentry->d_inode->i_flags |= S_DEAD; vfs_rmdir()
3653 dont_mount(dentry); vfs_rmdir()
3654 detach_mounts(dentry); vfs_rmdir()
3657 mutex_unlock(&dentry->d_inode->i_mutex); vfs_rmdir()
3658 dput(dentry); vfs_rmdir()
3660 d_delete(dentry); vfs_rmdir()
3669 struct dentry *dentry; do_rmdir() local
3694 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); do_rmdir()
3695 dentry = lookup_hash(&nd); do_rmdir()
3696 error = PTR_ERR(dentry); do_rmdir()
3697 if (IS_ERR(dentry)) do_rmdir()
3699 if (!dentry->d_inode) { do_rmdir()
3703 error = security_path_rmdir(&nd.path, dentry); do_rmdir()
3706 error = vfs_rmdir(nd.path.dentry->d_inode, dentry); do_rmdir()
3708 dput(dentry); do_rmdir()
3710 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); do_rmdir()
3730 * @dentry: victim
3745 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) vfs_unlink() argument
3747 struct inode *target = dentry->d_inode; vfs_unlink()
3748 int error = may_delete(dir, dentry, 0); vfs_unlink()
3757 if (is_local_mountpoint(dentry)) vfs_unlink()
3760 error = security_inode_unlink(dir, dentry); vfs_unlink()
3765 error = dir->i_op->unlink(dir, dentry); vfs_unlink()
3767 dont_mount(dentry); vfs_unlink()
3768 detach_mounts(dentry); vfs_unlink()
3776 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { vfs_unlink()
3778 d_delete(dentry); vfs_unlink()
3795 struct dentry *dentry; do_unlinkat() local
3814 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); do_unlinkat()
3815 dentry = lookup_hash(&nd); do_unlinkat()
3816 error = PTR_ERR(dentry); do_unlinkat()
3817 if (!IS_ERR(dentry)) { do_unlinkat()
3821 inode = dentry->d_inode; do_unlinkat()
3822 if (d_is_negative(dentry)) do_unlinkat()
3825 error = security_path_unlink(&nd.path, dentry); do_unlinkat()
3828 error = vfs_unlink(nd.path.dentry->d_inode, dentry, &delegated_inode); do_unlinkat()
3830 dput(dentry); do_unlinkat()
3832 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); do_unlinkat()
3853 if (d_is_negative(dentry)) do_unlinkat()
3855 else if (d_is_dir(dentry)) do_unlinkat()
3878 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) vfs_symlink() argument
3880 int error = may_create(dir, dentry); vfs_symlink()
3888 error = security_inode_symlink(dir, dentry, oldname); vfs_symlink()
3892 error = dir->i_op->symlink(dir, dentry, oldname); vfs_symlink()
3894 fsnotify_create(dir, dentry); vfs_symlink()
3904 struct dentry *dentry; SYSCALL_DEFINE3() local
3912 dentry = user_path_create(newdfd, newname, &path, lookup_flags); SYSCALL_DEFINE3()
3913 error = PTR_ERR(dentry); SYSCALL_DEFINE3()
3914 if (IS_ERR(dentry)) SYSCALL_DEFINE3()
3917 error = security_path_symlink(&path, dentry, from->name); SYSCALL_DEFINE3()
3919 error = vfs_symlink(path.dentry->d_inode, dentry, from->name); SYSCALL_DEFINE3()
3920 done_path_create(&path, dentry); SYSCALL_DEFINE3()
3954 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode) vfs_link()
4020 struct dentry *new_dentry; SYSCALL_DEFINE5()
4058 error = security_path_link(old_path.dentry, &new_path, new_dentry); SYSCALL_DEFINE5()
4061 error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode); SYSCALL_DEFINE5()
4128 * has no more than 1 dentry. If "hybrid" objects will ever appear,
4130 * d) conversion from fhandle to dentry may come in the wrong moment - when
4136 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, vfs_rename()
4137 struct inode *new_dir, struct dentry *new_dentry, vfs_rename()
4273 struct dentry *old_dir, *new_dir; SYSCALL_DEFINE5()
4274 struct dentry *old_dentry, *new_dentry; SYSCALL_DEFINE5()
4275 struct dentry *trap; SYSCALL_DEFINE5()
4311 old_dir = oldnd.path.dentry; SYSCALL_DEFINE5()
4316 new_dir = newnd.path.dentry; SYSCALL_DEFINE5()
4425 int vfs_whiteout(struct inode *dir, struct dentry *dentry) vfs_whiteout() argument
4427 int error = may_create(dir, dentry); vfs_whiteout()
4434 return dir->i_op->mknod(dir, dentry, vfs_whiteout()
4460 int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) generic_readlink() argument
4467 cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); generic_readlink()
4472 if (dentry->d_inode->i_op->put_link) generic_readlink()
4473 dentry->d_inode->i_op->put_link(dentry, &nd, cookie); generic_readlink()
4479 static char *page_getlink(struct dentry * dentry, struct page **ppage) page_getlink() argument
4483 struct address_space *mapping = dentry->d_inode->i_mapping; page_getlink()
4489 nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1); page_getlink()
4493 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) page_readlink() argument
4496 int res = readlink_copy(buffer, buflen, page_getlink(dentry, &page)); page_readlink()
4505 void *page_follow_link_light(struct dentry *dentry, struct nameidata *nd) page_follow_link_light() argument
4508 nd_set_link(nd, page_getlink(dentry, &page)); page_follow_link_light()
4513 void page_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) page_put_link() argument
H A Dlibfs.c23 static inline int simple_positive(struct dentry *dentry) simple_positive() argument
25 return d_really_is_positive(dentry) && !d_unhashed(dentry); simple_positive()
28 int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, simple_getattr() argument
31 struct inode *inode = d_inode(dentry); simple_getattr()
38 int simple_statfs(struct dentry *dentry, struct kstatfs *buf) simple_statfs() argument
40 buf->f_type = dentry->d_sb->s_magic; simple_statfs()
51 int always_delete_dentry(const struct dentry *dentry) always_delete_dentry() argument
63 * Lookup the data. This is trivial - if the dentry didn't already
66 struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) simple_lookup() argument
68 if (dentry->d_name.len > NAME_MAX) simple_lookup()
70 if (!dentry->d_sb->s_d_op) simple_lookup()
71 d_set_d_op(dentry, &simple_dentry_operations); simple_lookup()
72 d_add(dentry, NULL); simple_lookup()
81 file->private_data = d_alloc(file->f_path.dentry, &cursor_name); dcache_dir_open()
96 struct dentry *dentry = file->f_path.dentry; dcache_dir_lseek() local
97 mutex_lock(&d_inode(dentry)->i_mutex); dcache_dir_lseek()
105 mutex_unlock(&d_inode(dentry)->i_mutex); dcache_dir_lseek()
112 struct dentry *cursor = file->private_data; dcache_dir_lseek()
115 spin_lock(&dentry->d_lock); dcache_dir_lseek()
118 p = dentry->d_subdirs.next; dcache_dir_lseek()
119 while (n && p != &dentry->d_subdirs) { dcache_dir_lseek()
120 struct dentry *next; dcache_dir_lseek()
121 next = list_entry(p, struct dentry, d_child); dcache_dir_lseek()
129 spin_unlock(&dentry->d_lock); dcache_dir_lseek()
132 mutex_unlock(&d_inode(dentry)->i_mutex); dcache_dir_lseek()
151 struct dentry *dentry = file->f_path.dentry; dcache_readdir() local
152 struct dentry *cursor = file->private_data; dcache_readdir()
157 spin_lock(&dentry->d_lock); dcache_readdir()
159 list_move(q, &dentry->d_subdirs); dcache_readdir()
161 for (p = q->next; p != &dentry->d_subdirs; p = p->next) { dcache_readdir()
162 struct dentry *next = list_entry(p, struct dentry, d_child); dcache_readdir()
170 spin_unlock(&dentry->d_lock); dcache_readdir()
174 spin_lock(&dentry->d_lock); dcache_readdir()
182 spin_unlock(&dentry->d_lock); dcache_readdir()
216 struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, mount_pseudo()
221 struct dentry *dentry; mount_pseudo() local
246 dentry = __d_alloc(s, &d_name); mount_pseudo()
247 if (!dentry) { mount_pseudo()
251 d_instantiate(dentry, root); mount_pseudo()
252 s->s_root = dentry; mount_pseudo()
271 int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) simple_link() argument
278 dget(dentry); simple_link()
279 d_instantiate(dentry, inode); simple_link()
284 int simple_empty(struct dentry *dentry) simple_empty() argument
286 struct dentry *child; simple_empty()
289 spin_lock(&dentry->d_lock); simple_empty()
290 list_for_each_entry(child, &dentry->d_subdirs, d_child) { simple_empty()
300 spin_unlock(&dentry->d_lock); simple_empty()
305 int simple_unlink(struct inode *dir, struct dentry *dentry) simple_unlink() argument
307 struct inode *inode = d_inode(dentry); simple_unlink()
311 dput(dentry); simple_unlink()
316 int simple_rmdir(struct inode *dir, struct dentry *dentry) simple_rmdir() argument
318 if (!simple_empty(dentry)) simple_rmdir()
321 drop_nlink(d_inode(dentry)); simple_rmdir()
322 simple_unlink(dir, dentry); simple_rmdir()
328 int simple_rename(struct inode *old_dir, struct dentry *old_dentry, simple_rename()
329 struct inode *new_dir, struct dentry *new_dentry) simple_rename()
357 * @dentry: dentry
369 int simple_setattr(struct dentry *dentry, struct iattr *iattr) simple_setattr() argument
371 struct inode *inode = d_inode(dentry); simple_setattr()
481 struct dentry *root; simple_fill_super()
482 struct dentry *dentry; simple_fill_super() local
517 dentry = d_alloc_name(root, files->name); simple_fill_super()
518 if (!dentry) simple_fill_super()
522 dput(dentry); simple_fill_super()
529 d_add(dentry, inode); simple_fill_super()
873 struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, generic_fh_to_dentry()
906 struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, generic_fh_to_parent()
1027 void kfree_put_link(struct dentry *dentry, struct nameidata *nd, kfree_put_link() argument
1101 static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) empty_dir_lookup() argument
1106 static int empty_dir_getattr(struct vfsmount *mnt, struct dentry *dentry, empty_dir_getattr() argument
1109 struct inode *inode = d_inode(dentry); empty_dir_getattr()
1114 static int empty_dir_setattr(struct dentry *dentry, struct iattr *attr) empty_dir_setattr() argument
1119 static int empty_dir_setxattr(struct dentry *dentry, const char *name, empty_dir_setxattr() argument
1125 static ssize_t empty_dir_getxattr(struct dentry *dentry, const char *name, empty_dir_getxattr() argument
1131 static int empty_dir_removexattr(struct dentry *dentry, const char *name) empty_dir_removexattr() argument
1136 static ssize_t empty_dir_listxattr(struct dentry *dentry, char *list, size_t size) empty_dir_listxattr() argument
H A Danon_inodes.c31 static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen) anon_inodefs_dname() argument
33 return dynamic_dname(dentry, buffer, buflen, "anon_inode:%s", anon_inodefs_dname()
34 dentry->d_name.name); anon_inodefs_dname()
41 static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, anon_inodefs_mount()
56 * anonymous inode, and a dentry that describe the "class"
67 * hence saving memory and avoiding code duplication for the file/inode/dentry
92 path.dentry = d_alloc_pseudo(anon_inode_mnt->mnt_sb, &this); anon_inode_getfile()
93 if (!path.dentry) anon_inode_getfile()
103 d_instantiate(path.dentry, anon_inode_inode); anon_inode_getfile()
125 * anonymous inode, and a dentry that describe the "class"
136 * hence saving memory and avoiding code duplication for the file/inode/dentry
H A Dxattr.c80 * @dentry - object to perform setxattr on
92 int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, __vfs_setxattr_noperm() argument
95 struct inode *inode = dentry->d_inode; __vfs_setxattr_noperm()
103 error = inode->i_op->setxattr(dentry, name, value, size, flags); __vfs_setxattr_noperm()
105 fsnotify_xattr(dentry); __vfs_setxattr_noperm()
106 security_inode_post_setxattr(dentry, name, value, __vfs_setxattr_noperm()
114 fsnotify_xattr(dentry); __vfs_setxattr_noperm()
122 vfs_setxattr(struct dentry *dentry, const char *name, const void *value, vfs_setxattr() argument
125 struct inode *inode = dentry->d_inode; vfs_setxattr()
133 error = security_inode_setxattr(dentry, name, value, size, flags); vfs_setxattr()
137 error = __vfs_setxattr_noperm(dentry, name, value, size, flags); vfs_setxattr()
181 vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value, vfs_getxattr_alloc() argument
184 struct inode *inode = dentry->d_inode; vfs_getxattr_alloc()
195 error = inode->i_op->getxattr(dentry, name, NULL, 0); vfs_getxattr_alloc()
206 error = inode->i_op->getxattr(dentry, name, value, error); vfs_getxattr_alloc()
212 int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name, vfs_xattr_cmp() argument
218 rc = vfs_getxattr_alloc(dentry, xattr_name, &xattr_value, 0, flags); vfs_xattr_cmp()
231 vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) vfs_getxattr() argument
233 struct inode *inode = dentry->d_inode; vfs_getxattr()
240 error = security_inode_getxattr(dentry, name); vfs_getxattr()
258 error = inode->i_op->getxattr(dentry, name, value, size); vfs_getxattr()
267 vfs_listxattr(struct dentry *d, char *list, size_t size) vfs_listxattr()
287 vfs_removexattr(struct dentry *dentry, const char *name) vfs_removexattr() argument
289 struct inode *inode = dentry->d_inode; vfs_removexattr()
300 error = security_inode_removexattr(dentry, name); vfs_removexattr()
306 error = inode->i_op->removexattr(dentry, name); vfs_removexattr()
310 fsnotify_xattr(dentry); vfs_removexattr()
311 evm_inode_post_removexattr(dentry, name); vfs_removexattr()
322 setxattr(struct dentry *d, const char __user *name, const void __user *value, setxattr()
379 error = setxattr(path.dentry, name, value, size, flags); path_setxattr()
415 error = setxattr(f.file->f_path.dentry, name, value, size, flags); SYSCALL_DEFINE5()
426 getxattr(struct dentry *d, const char __user *name, void __user *value, getxattr()
481 error = getxattr(path.dentry, name, value, size); path_getxattr()
511 error = getxattr(f.file->f_path.dentry, name, value, size); SYSCALL_DEFINE4()
520 listxattr(struct dentry *d, char __user *list, size_t size) listxattr()
563 error = listxattr(path.dentry, list, size); path_listxattr()
592 error = listxattr(f.file->f_path.dentry, list, size); SYSCALL_DEFINE3()
601 removexattr(struct dentry *d, const char __user *name) removexattr()
626 error = removexattr(path.dentry, name); path_removexattr()
659 error = removexattr(f.file->f_path.dentry, name); SYSCALL_DEFINE2()
716 generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size) generic_getxattr() argument
720 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); generic_getxattr()
723 return handler->get(dentry, name, buffer, size, handler->flags); generic_getxattr()
731 generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) generic_listxattr() argument
733 const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; generic_listxattr()
738 size += handler->list(dentry, NULL, 0, NULL, 0, for_each_xattr_handler()
745 size = handler->list(dentry, buf, buffer_size, for_each_xattr_handler()
761 generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) generic_setxattr() argument
767 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); generic_setxattr()
770 return handler->set(dentry, name, value, size, flags, handler->flags); generic_setxattr()
778 generic_removexattr(struct dentry *dentry, const char *name) generic_removexattr() argument
782 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); generic_removexattr()
785 return handler->set(dentry, name, NULL, 0, generic_removexattr()
/linux-4.1.27/fs/debugfs/
H A Dinode.c47 static inline int debugfs_positive(struct dentry *dentry) debugfs_positive() argument
49 return d_really_is_positive(dentry) && !d_unhashed(dentry); debugfs_positive()
155 static int debugfs_show_options(struct seq_file *m, struct dentry *root) debugfs_show_options()
190 f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; debugfs_automount()
191 return f(d_inode(path->dentry)->i_private); debugfs_automount()
235 static struct dentry *debug_mount(struct file_system_type *fs_type, debug_mount()
250 static struct dentry *start_creating(const char *name, struct dentry *parent) start_creating()
252 struct dentry *dentry; start_creating() local
266 * We need the root dentry to do this, which is in the super start_creating()
274 dentry = lookup_one_len(name, parent, strlen(name)); start_creating()
275 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { start_creating()
276 dput(dentry); start_creating()
277 dentry = ERR_PTR(-EEXIST); start_creating()
280 if (IS_ERR(dentry)) { start_creating()
285 return dentry; start_creating()
288 static struct dentry *failed_creating(struct dentry *dentry) failed_creating() argument
290 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); failed_creating()
291 dput(dentry); failed_creating()
296 static struct dentry *end_creating(struct dentry *dentry) end_creating() argument
298 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); end_creating()
299 return dentry; end_creating()
306 * @parent: a pointer to the parent dentry for this file. This should be a
307 * directory dentry if set. If this parameter is NULL, then the
320 * This function will return a pointer to a dentry if it succeeds. This
328 struct dentry *debugfs_create_file(const char *name, umode_t mode, debugfs_create_file()
329 struct dentry *parent, void *data, debugfs_create_file()
332 struct dentry *dentry; debugfs_create_file() local
338 dentry = start_creating(name, parent); debugfs_create_file()
340 if (IS_ERR(dentry)) debugfs_create_file()
343 inode = debugfs_get_inode(dentry->d_sb); debugfs_create_file()
345 return failed_creating(dentry); debugfs_create_file()
350 d_instantiate(dentry, inode); debugfs_create_file()
351 fsnotify_create(d_inode(dentry->d_parent), dentry); debugfs_create_file()
352 return end_creating(dentry); debugfs_create_file()
360 * @parent: a pointer to the parent dentry for this file. This should be a
361 * directory dentry if set. If this parameter is NULL, then the
375 * This function will return a pointer to a dentry if it succeeds. This
383 struct dentry *debugfs_create_file_size(const char *name, umode_t mode, debugfs_create_file_size()
384 struct dentry *parent, void *data, debugfs_create_file_size()
388 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); debugfs_create_file_size()
400 * @parent: a pointer to the parent dentry for this file. This should be a
401 * directory dentry if set. If this parameter is NULL, then the
406 * This function will return a pointer to a dentry if it succeeds. This
414 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) debugfs_create_dir()
416 struct dentry *dentry = start_creating(name, parent); debugfs_create_dir() local
419 if (IS_ERR(dentry)) debugfs_create_dir()
422 inode = debugfs_get_inode(dentry->d_sb); debugfs_create_dir()
424 return failed_creating(dentry); debugfs_create_dir()
432 d_instantiate(dentry, inode); debugfs_create_dir()
433 inc_nlink(d_inode(dentry->d_parent)); debugfs_create_dir()
434 fsnotify_mkdir(d_inode(dentry->d_parent), dentry); debugfs_create_dir()
435 return end_creating(dentry); debugfs_create_dir()
442 * @parent: a pointer to the parent dentry for this file. This should be a
443 * directory dentry if set. If this parameter is NULL, then the
450 struct dentry *debugfs_create_automount(const char *name, debugfs_create_automount()
451 struct dentry *parent, debugfs_create_automount()
455 struct dentry *dentry = start_creating(name, parent); debugfs_create_automount() local
458 if (IS_ERR(dentry)) debugfs_create_automount()
461 inode = debugfs_get_inode(dentry->d_sb); debugfs_create_automount()
463 return failed_creating(dentry); debugfs_create_automount()
468 dentry->d_fsdata = (void *)f; debugfs_create_automount()
469 d_instantiate(dentry, inode); debugfs_create_automount()
470 return end_creating(dentry); debugfs_create_automount()
478 * @parent: a pointer to the parent dentry for this symbolic link. This
479 * should be a directory dentry if set. If this parameter is NULL,
488 * This function will return a pointer to a dentry if it succeeds. This
497 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, debugfs_create_symlink()
500 struct dentry *dentry; debugfs_create_symlink() local
506 dentry = start_creating(name, parent); debugfs_create_symlink()
507 if (IS_ERR(dentry)) { debugfs_create_symlink()
512 inode = debugfs_get_inode(dentry->d_sb); debugfs_create_symlink()
515 return failed_creating(dentry); debugfs_create_symlink()
520 d_instantiate(dentry, inode); debugfs_create_symlink()
521 return end_creating(dentry); debugfs_create_symlink()
525 static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) __debugfs_remove() argument
529 if (debugfs_positive(dentry)) { __debugfs_remove()
530 dget(dentry); __debugfs_remove()
531 if (d_is_dir(dentry)) __debugfs_remove()
532 ret = simple_rmdir(d_inode(parent), dentry); __debugfs_remove()
534 simple_unlink(d_inode(parent), dentry); __debugfs_remove() local
536 d_delete(dentry); __debugfs_remove()
537 dput(dentry); __debugfs_remove()
544 * @dentry: a pointer to a the dentry of the file or directory to be
555 void debugfs_remove(struct dentry *dentry) debugfs_remove() argument
557 struct dentry *parent; debugfs_remove()
560 if (IS_ERR_OR_NULL(dentry)) debugfs_remove()
563 parent = dentry->d_parent; debugfs_remove()
568 ret = __debugfs_remove(dentry, parent); debugfs_remove()
577 * @dentry: a pointer to a the dentry of the directory to be removed.
587 void debugfs_remove_recursive(struct dentry *dentry) debugfs_remove_recursive() argument
589 struct dentry *child, *parent; debugfs_remove_recursive()
591 if (IS_ERR_OR_NULL(dentry)) debugfs_remove_recursive()
594 parent = dentry->d_parent; debugfs_remove_recursive()
598 parent = dentry; debugfs_remove_recursive()
641 if (child != dentry) debugfs_remove_recursive()
653 * @old_dir: a pointer to the parent dentry for the renamed object. This
654 * should be a directory dentry.
655 * @old_dentry: dentry of an object to be renamed.
656 * @new_dir: a pointer to the parent dentry where the object should be
657 * moved. This should be a directory dentry.
670 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, debugfs_rename()
671 struct dentry *new_dir, const char *new_name) debugfs_rename()
674 struct dentry *dentry = NULL, *trap; debugfs_rename() local
685 dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); debugfs_rename()
687 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry)) debugfs_rename()
693 dentry); debugfs_rename()
698 d_move(old_dentry, dentry); debugfs_rename()
704 dput(dentry); debugfs_rename()
707 if (dentry && !IS_ERR(dentry)) debugfs_rename()
708 dput(dentry); debugfs_rename()
H A Dfile.c46 static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) debugfs_follow_link() argument
48 nd_set_link(nd, d_inode(dentry)->i_private); debugfs_follow_link()
75 * @parent: a pointer to the parent dentry for this file. This should be a
76 * directory dentry if set. If this parameter is %NULL, then the
85 * This function will return a pointer to a dentry if it succeeds. This
95 struct dentry *debugfs_create_u8(const char *name, umode_t mode, debugfs_create_u8()
96 struct dentry *parent, u8 *value) debugfs_create_u8()
127 * @parent: a pointer to the parent dentry for this file. This should be a
128 * directory dentry if set. If this parameter is %NULL, then the
137 * This function will return a pointer to a dentry if it succeeds. This
147 struct dentry *debugfs_create_u16(const char *name, umode_t mode, debugfs_create_u16()
148 struct dentry *parent, u16 *value) debugfs_create_u16()
179 * @parent: a pointer to the parent dentry for this file. This should be a
180 * directory dentry if set. If this parameter is %NULL, then the
189 * This function will return a pointer to a dentry if it succeeds. This
199 struct dentry *debugfs_create_u32(const char *name, umode_t mode, debugfs_create_u32()
200 struct dentry *parent, u32 *value) debugfs_create_u32()
232 * @parent: a pointer to the parent dentry for this file. This should be a
233 * directory dentry if set. If this parameter is %NULL, then the
242 * This function will return a pointer to a dentry if it succeeds. This
252 struct dentry *debugfs_create_u64(const char *name, umode_t mode, debugfs_create_u64()
253 struct dentry *parent, u64 *value) debugfs_create_u64()
292 * @parent: a pointer to the parent dentry for this file. This should be a
293 * directory dentry if set. If this parameter is %NULL, then the
298 struct dentry *debugfs_create_x8(const char *name, umode_t mode, debugfs_create_x8()
299 struct dentry *parent, u8 *value) debugfs_create_x8()
316 * @parent: a pointer to the parent dentry for this file. This should be a
317 * directory dentry if set. If this parameter is %NULL, then the
322 struct dentry *debugfs_create_x16(const char *name, umode_t mode, debugfs_create_x16()
323 struct dentry *parent, u16 *value) debugfs_create_x16()
340 * @parent: a pointer to the parent dentry for this file. This should be a
341 * directory dentry if set. If this parameter is %NULL, then the
346 struct dentry *debugfs_create_x32(const char *name, umode_t mode, debugfs_create_x32()
347 struct dentry *parent, u32 *value) debugfs_create_x32()
364 * @parent: a pointer to the parent dentry for this file. This should be a
365 * directory dentry if set. If this parameter is %NULL, then the
370 struct dentry *debugfs_create_x64(const char *name, umode_t mode, debugfs_create_x64()
371 struct dentry *parent, u64 *value) debugfs_create_x64()
395 * @parent: a pointer to the parent dentry for this file. This should be a
396 * directory dentry if set. If this parameter is %NULL, then the
401 struct dentry *debugfs_create_size_t(const char *name, umode_t mode, debugfs_create_size_t()
402 struct dentry *parent, size_t *value) debugfs_create_size_t()
428 * @parent: a pointer to the parent dentry for this file. This should be a
429 * directory dentry if set. If this parameter is %NULL, then the
434 struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, debugfs_create_atomic_t()
435 struct dentry *parent, atomic_t *value) debugfs_create_atomic_t()
495 * @parent: a pointer to the parent dentry for this file. This should be a
496 * directory dentry if set. If this parameter is %NULL, then the
505 * This function will return a pointer to a dentry if it succeeds. This
515 struct dentry *debugfs_create_bool(const char *name, umode_t mode, debugfs_create_bool()
516 struct dentry *parent, u32 *value) debugfs_create_bool()
540 * @parent: a pointer to the parent dentry for this file. This should be a
541 * directory dentry if set. If this parameter is %NULL, then the
550 * This function will return a pointer to a dentry if it succeeds. This
560 struct dentry *debugfs_create_blob(const char *name, umode_t mode, debugfs_create_blob()
561 struct dentry *parent, debugfs_create_blob()
643 * @parent: a pointer to the parent dentry for this file. This should be a
644 * directory dentry if set. If this parameter is %NULL, then the
654 * The function returns a pointer to dentry on success. If debugfs is not
657 struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, debugfs_create_u32_array()
658 struct dentry *parent, debugfs_create_u32_array()
736 * @parent: a pointer to the parent dentry for this file. This should be a
737 * directory dentry if set. If this parameter is %NULL, then the
747 * This function will return a pointer to a dentry if it succeeds. This
757 struct dentry *debugfs_create_regset32(const char *name, umode_t mode, debugfs_create_regset32()
758 struct dentry *parent, debugfs_create_regset32()
792 * @parent: a pointer to the parent dentry for this file. This should be a
793 * directory dentry if set. If this parameter is %NULL, then the
797 struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, debugfs_create_devm_seqfile()
798 struct dentry *parent, debugfs_create_devm_seqfile()
/linux-4.1.27/fs/qnx6/
H A Dnamei.c15 struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, qnx6_lookup() argument
21 const char *name = dentry->d_name.name; qnx6_lookup()
22 int len = dentry->d_name.len; qnx6_lookup()
40 d_add(dentry, foundinode); qnx6_lookup()
/linux-4.1.27/fs/affs/
H A Dnamei.c16 static int affs_hash_dentry(const struct dentry *, struct qstr *);
17 static int affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
20 static int affs_intl_hash_dentry(const struct dentry *, struct qstr *);
21 static int affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
61 * Note: the dentry argument is the parent dentry.
85 affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr) affs_hash_dentry() argument
88 affs_nofilenametruncate(dentry)); affs_hash_dentry()
93 affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr) affs_intl_hash_dentry() argument
96 affs_nofilenametruncate(dentry)); affs_intl_hash_dentry()
108 * 'str' is the name of an already existing dentry, so the name __affs_compare_dentry()
134 affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, affs_compare_dentry() argument
143 affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry, affs_intl_compare_dentry() argument
156 affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper) affs_match() argument
158 const u8 *name = dentry->d_name.name; affs_match()
159 int len = dentry->d_name.len; affs_match()
188 affs_find_entry(struct inode *dir, struct dentry *dentry) affs_find_entry() argument
195 pr_debug("%s(\"%pd\")\n", __func__, dentry); affs_find_entry()
201 key = be32_to_cpu(AFFS_HEAD(bh)->table[affs_hash_name(sb, dentry->d_name.name, dentry->d_name.len)]); affs_find_entry()
210 if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, toupper)) affs_find_entry()
216 struct dentry * affs_lookup()
217 affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) affs_lookup() argument
223 pr_debug("%s(\"%pd\")\n", __func__, dentry); affs_lookup()
226 bh = affs_find_entry(dir, dentry); affs_lookup()
234 dentry->d_fsdata = (void *)(long)ino; affs_lookup()
246 d_add(dentry, inode); affs_lookup()
251 affs_unlink(struct inode *dir, struct dentry *dentry) affs_unlink() argument
254 d_inode(dentry)->i_ino, dentry); affs_unlink()
256 return affs_remove_header(dentry); affs_unlink()
260 affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) affs_create() argument
267 __func__, dir->i_ino, dentry, mode); affs_create()
281 error = affs_add_entry(dir, inode, dentry, ST_FILE); affs_create()
291 affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) affs_mkdir() argument
297 __func__, dir->i_ino, dentry, mode); affs_mkdir()
309 error = affs_add_entry(dir, inode, dentry, ST_USERDIR); affs_mkdir()
320 affs_rmdir(struct inode *dir, struct dentry *dentry) affs_rmdir() argument
323 d_inode(dentry)->i_ino, dentry); affs_rmdir()
325 return affs_remove_header(dentry); affs_rmdir()
329 affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) affs_symlink() argument
339 __func__, dir->i_ino, dentry, symname); affs_symlink()
390 error = affs_add_entry(dir, inode, dentry, ST_SOFTLINK); affs_symlink()
404 affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) affs_link() argument
409 dentry); affs_link()
411 return affs_add_entry(dir, inode, dentry, ST_LINKFILE); affs_link()
415 affs_rename(struct inode *old_dir, struct dentry *old_dentry, affs_rename()
416 struct inode *new_dir, struct dentry *new_dentry) affs_rename()
H A Daffs.h138 extern int affs_remove_header(struct dentry *dentry);
150 extern bool affs_nofilenametruncate(const struct dentry *dentry);
153 extern int affs_copy_name(unsigned char *bstr, struct dentry *dentry);
166 extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int);
167 extern int affs_unlink(struct inode *dir, struct dentry *dentry);
168 extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool);
169 extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
170 extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
171 extern int affs_link(struct dentry *olddentry, struct inode *dir,
172 struct dentry *dentry);
173 extern int affs_symlink(struct inode *dir, struct dentry *dentry,
175 extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
176 struct inode *new_dir, struct dentry *new_dentry);
182 extern int affs_notify_change(struct dentry *dentry, struct iattr *attr);
188 extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type);
/linux-4.1.27/fs/nfs/
H A Dunlink.c41 * nfs_copy_dname - copy dentry name to data structure
42 * @dentry: pointer to dentry
45 static int nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data) nfs_copy_dname() argument
48 int len = dentry->d_name.len; nfs_copy_dname()
50 str = kmemdup(dentry->d_name.name, NAME_ALLOC_LEN(len), GFP_KERNEL); nfs_copy_dname()
117 static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) nfs_do_call_unlink()
132 struct dentry *alias; nfs_do_call_unlink()
141 * the sillyrename information to the aliased dentry. nfs_do_call_unlink()
159 * point dentry is definitely not a root, so we won't need nfs_do_call_unlink()
183 static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) nfs_call_unlink() argument
185 struct dentry *parent; nfs_call_unlink()
190 parent = dget_parent(dentry); nfs_call_unlink()
211 void nfs_wait_on_sillyrename(struct dentry *dentry) nfs_wait_on_sillyrename() argument
213 struct nfs_inode *nfsi = NFS_I(d_inode(dentry)); nfs_wait_on_sillyrename()
218 void nfs_block_sillyrename(struct dentry *dentry) nfs_block_sillyrename() argument
220 struct nfs_inode *nfsi = NFS_I(d_inode(dentry)); nfs_block_sillyrename()
225 void nfs_unblock_sillyrename(struct dentry *dentry) nfs_unblock_sillyrename() argument
227 struct inode *dir = d_inode(dentry); nfs_unblock_sillyrename()
239 if (nfs_do_call_unlink(dentry, dir, data) == 0) nfs_unblock_sillyrename()
248 * @dir: parent directory of dentry
249 * @dentry: dentry to unlink
252 nfs_async_unlink(struct inode *dir, struct dentry *dentry) nfs_async_unlink() argument
270 spin_lock(&dentry->d_lock); nfs_async_unlink()
271 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) nfs_async_unlink()
273 dentry->d_flags |= DCACHE_NFSFS_RENAMED; nfs_async_unlink()
274 devname_garbage = dentry->d_fsdata; nfs_async_unlink()
275 dentry->d_fsdata = data; nfs_async_unlink()
276 spin_unlock(&dentry->d_lock); nfs_async_unlink()
279 * point dentry is definitely not a root, so we won't need nfs_async_unlink()
285 spin_unlock(&dentry->d_lock); nfs_async_unlink()
295 * @dentry: dentry to delete
299 * only use the dentry to find the sillydelete. We then copy the name
303 nfs_complete_unlink(struct dentry *dentry, struct inode *inode) nfs_complete_unlink() argument
307 spin_lock(&dentry->d_lock); nfs_complete_unlink()
308 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { nfs_complete_unlink()
309 dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; nfs_complete_unlink()
310 data = dentry->d_fsdata; nfs_complete_unlink()
311 dentry->d_fsdata = NULL; nfs_complete_unlink()
313 spin_unlock(&dentry->d_lock); nfs_complete_unlink()
315 if (data != NULL && (NFS_STALE(inode) || !nfs_call_unlink(dentry, data))) nfs_complete_unlink()
321 nfs_cancel_async_unlink(struct dentry *dentry) nfs_cancel_async_unlink() argument
323 spin_lock(&dentry->d_lock); nfs_cancel_async_unlink()
324 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { nfs_cancel_async_unlink()
325 struct nfs_unlinkdata *data = dentry->d_fsdata; nfs_cancel_async_unlink()
327 dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; nfs_cancel_async_unlink()
328 dentry->d_fsdata = NULL; nfs_cancel_async_unlink()
329 spin_unlock(&dentry->d_lock); nfs_cancel_async_unlink()
333 spin_unlock(&dentry->d_lock); nfs_cancel_async_unlink()
348 struct dentry *old_dentry = data->old_dentry; nfs_async_rename_done()
396 * @old_dir: directory that currently holds the dentry to be renamed
398 * @old_dentry: original dentry to be renamed
399 * @new_dentry: dentry to which the old_dentry should be renamed
405 struct dentry *old_dentry, struct dentry *new_dentry, nfs_async_rename()
469 struct dentry *dentry = data->old_dentry; nfs_complete_sillyrename() local
472 nfs_cancel_async_unlink(dentry); nfs_complete_sillyrename()
480 fsnotify_nameremove(dentry, 0); nfs_complete_sillyrename()
492 * nfs_sillyrename - Perform a silly-rename of a dentry
493 * @dir: inode of directory that contains dentry
494 * @dentry: dentry to be sillyrenamed
513 nfs_sillyrename(struct inode *dir, struct dentry *dentry) nfs_sillyrename() argument
518 struct dentry *sdentry; nfs_sillyrename()
523 dentry, d_count(dentry)); nfs_sillyrename()
527 * We don't allow a dentry to be silly-renamed twice. nfs_sillyrename()
529 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) nfs_sillyrename()
532 fileid = NFS_FILEID(d_inode(dentry)); nfs_sillyrename()
535 NFS_PROTO(d_inode(dentry))->return_delegation(d_inode(dentry)); nfs_sillyrename()
548 dentry, silly); nfs_sillyrename()
550 sdentry = lookup_one_len(silly, dentry->d_parent, slen); nfs_sillyrename()
562 error = nfs_async_unlink(dir, dentry); nfs_sillyrename()
568 (struct nfs_unlinkdata *)dentry->d_fsdata); nfs_sillyrename()
570 nfs_cancel_async_unlink(dentry); nfs_sillyrename()
575 task = nfs_async_rename(dir, dir, dentry, sdentry, nfs_sillyrename()
579 nfs_cancel_async_unlink(dentry); nfs_sillyrename()
590 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_sillyrename()
591 d_move(dentry, sdentry); nfs_sillyrename()
596 d_drop(dentry); nfs_sillyrename()
H A Dnamespace.c31 * nfs_path - reconstruct the path given an arbitrary dentry
33 * @dentry - pointer to dentry
39 * by arbitrary hashed dentry.
50 char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen, nfs_path() argument
66 spin_lock(&dentry->d_lock); nfs_path()
67 if (IS_ROOT(dentry)) nfs_path()
69 namelen = dentry->d_name.len; nfs_path()
74 memcpy(end, dentry->d_name.name, namelen); nfs_path()
76 spin_unlock(&dentry->d_lock); nfs_path()
77 dentry = dentry->d_parent; nfs_path()
80 spin_unlock(&dentry->d_lock); nfs_path()
86 spin_unlock(&dentry->d_lock); nfs_path()
93 base = dentry->d_fsdata; nfs_path()
95 spin_unlock(&dentry->d_lock); nfs_path()
108 spin_unlock(&dentry->d_lock); nfs_path()
114 spin_unlock(&dentry->d_lock); nfs_path()
118 spin_unlock(&dentry->d_lock); nfs_path()
142 struct nfs_server *server = NFS_SERVER(d_inode(path->dentry)); nfs_d_automount()
149 if (IS_ROOT(path->dentry)) nfs_d_automount()
160 mnt = server->nfs_client->rpc_ops->submount(server, path->dentry, fh, fattr); nfs_d_automount()
181 nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) nfs_namespace_getattr() argument
183 if (NFS_FH(d_inode(dentry))->size != 0) nfs_namespace_getattr()
184 return nfs_getattr(mnt, dentry, stat); nfs_namespace_getattr()
185 generic_fillattr(d_inode(dentry), stat); nfs_namespace_getattr()
190 nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr) nfs_namespace_setattr() argument
192 if (NFS_FH(d_inode(dentry))->size != 0) nfs_namespace_setattr()
193 return nfs_setattr(dentry, attr); nfs_namespace_setattr()
234 * @dentry - parent directory
235 * @fh - filehandle for new root dentry
240 struct vfsmount *nfs_do_submount(struct dentry *dentry, struct nfs_fh *fh, nfs_do_submount() argument
244 .sb = dentry->d_sb, nfs_do_submount()
245 .dentry = dentry, nfs_do_submount()
257 dentry); nfs_do_submount()
260 devname = nfs_devname(dentry, page, PAGE_SIZE); nfs_do_submount()
264 mnt = nfs_do_clone_mount(NFS_SB(dentry->d_sb), devname, &mountdata); nfs_do_submount()
275 struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry, nfs_submount() argument
279 struct dentry *parent = dget_parent(dentry); nfs_submount()
282 err = server->nfs_client->rpc_ops->lookup(d_inode(parent), &dentry->d_name, fh, fattr, NULL); nfs_submount()
287 return nfs_do_submount(dentry, fh, fattr, server->client->cl_auth->au_flavor); nfs_submount()
H A Dnfstrace.h172 const struct dentry *dentry,
176 TP_ARGS(dir, dentry, flags),
182 __string(name, dentry->d_name.name)
189 __assign_str(name, dentry->d_name.name);
206 const struct dentry *dentry, \
209 TP_ARGS(dir, dentry, flags))
214 const struct dentry *dentry,
219 TP_ARGS(dir, dentry, flags, error),
226 __string(name, dentry->d_name.name)
234 __assign_str(name, dentry->d_name.name);
252 const struct dentry *dentry, \
256 TP_ARGS(dir, dentry, flags, error))
293 __string(name, ctx->dentry->d_name.name)
301 __assign_str(name, ctx->dentry->d_name.name);
331 __string(name, ctx->dentry->d_name.name)
340 __assign_str(name, ctx->dentry->d_name.name);
359 const struct dentry *dentry,
363 TP_ARGS(dir, dentry, flags),
369 __string(name, dentry->d_name.name)
376 __assign_str(name, dentry->d_name.name);
392 const struct dentry *dentry,
397 TP_ARGS(dir, dentry, flags, error),
404 __string(name, dentry->d_name.name)
412 __assign_str(name, dentry->d_name.name);
429 const struct dentry *dentry
432 TP_ARGS(dir, dentry),
437 __string(name, dentry->d_name.name)
443 __assign_str(name, dentry->d_name.name);
458 const struct dentry *dentry \
460 TP_ARGS(dir, dentry))
465 const struct dentry *dentry,
469 TP_ARGS(dir, dentry, error),
475 __string(name, dentry->d_name.name)
482 __assign_str(name, dentry->d_name.name);
498 const struct dentry *dentry, \
501 TP_ARGS(dir, dentry, error))
520 const struct dentry *dentry
523 TP_ARGS(inode, dir, dentry),
529 __string(name, dentry->d_name.name)
536 __assign_str(name, dentry->d_name.name);
553 const struct dentry *dentry,
557 TP_ARGS(inode, dir, dentry, error),
564 __string(name, dentry->d_name.name)
572 __assign_str(name, dentry->d_name.name);
589 const struct dentry *old_dentry,
591 const struct dentry *new_dentry
626 const struct dentry *old_dentry, \
628 const struct dentry *new_dentry \
635 const struct dentry *old_dentry,
637 const struct dentry *new_dentry,
677 const struct dentry *old_dentry, \
679 const struct dentry *new_dentry, \
H A Ddir.c121 if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { nfs_opendir()
380 error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, entry->cookie, pages, nfs_readdir_xdr_filler()
415 int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) nfs_same_file() argument
419 if (d_really_is_negative(dentry)) nfs_same_file()
422 nfsi = NFS_I(d_inode(dentry)); nfs_same_file()
470 void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) nfs_prime_dcache()
473 struct dentry *dentry; nfs_prime_dcache() local
474 struct dentry *alias; nfs_prime_dcache()
491 dentry = d_lookup(parent, &filename); nfs_prime_dcache()
492 if (dentry != NULL) { nfs_prime_dcache()
494 if (!nfs_fsid_equal(&NFS_SB(dentry->d_sb)->fsid, nfs_prime_dcache()
497 if (nfs_same_file(dentry, entry)) { nfs_prime_dcache()
498 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_prime_dcache()
499 status = nfs_refresh_inode(d_inode(dentry), entry->fattr); nfs_prime_dcache()
501 nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label); nfs_prime_dcache()
504 d_invalidate(dentry); nfs_prime_dcache()
505 dput(dentry); nfs_prime_dcache()
509 dentry = d_alloc(parent, &filename); nfs_prime_dcache()
510 if (dentry == NULL) nfs_prime_dcache()
513 inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->label); nfs_prime_dcache()
517 alias = d_splice_alias(inode, dentry); nfs_prime_dcache()
524 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_prime_dcache()
527 dput(dentry); nfs_prime_dcache()
563 nfs_prime_dcache(desc->file->f_path.dentry, entry); nfs_readdir_page_filler()
875 struct dentry *dentry = file->f_path.dentry; nfs_readdir() local
876 struct inode *inode = d_inode(dentry); nfs_readdir()
900 nfs_block_sillyrename(dentry); nfs_readdir()
936 nfs_unblock_sillyrename(dentry); nfs_readdir()
1011 static int nfs_check_verifier(struct inode *dir, struct dentry *dentry, nfs_check_verifier() argument
1016 if (IS_ROOT(dentry)) nfs_check_verifier()
1020 if (!nfs_verify_change_attribute(dir, dentry->d_time)) nfs_check_verifier()
1029 if (!nfs_verify_change_attribute(dir, dentry->d_time)) nfs_check_verifier()
1090 int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry, nfs_neg_need_reval() argument
1093 /* Don't revalidate a negative dentry if we're creating a new file */ nfs_neg_need_reval()
1098 return !nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU); nfs_neg_need_reval()
1110 * cached dentry and do a new lookup.
1112 static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags) nfs_lookup_revalidate() argument
1116 struct dentry *parent; nfs_lookup_revalidate()
1123 parent = ACCESS_ONCE(dentry->d_parent); nfs_lookup_revalidate()
1128 parent = dget_parent(dentry); nfs_lookup_revalidate()
1132 inode = d_inode(dentry); nfs_lookup_revalidate()
1135 if (nfs_neg_need_reval(dir, dentry, flags)) { nfs_lookup_revalidate()
1147 __func__, dentry); nfs_lookup_revalidate()
1156 nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU)) { nfs_lookup_revalidate()
1182 trace_nfs_lookup_revalidate_enter(dir, dentry, flags); nfs_lookup_revalidate()
1183 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label); nfs_lookup_revalidate()
1184 trace_nfs_lookup_revalidate_exit(dir, dentry, flags, error); nfs_lookup_revalidate()
1199 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_lookup_revalidate()
1205 if (parent != ACCESS_ONCE(dentry->d_parent)) nfs_lookup_revalidate()
1210 __func__, dentry); nfs_lookup_revalidate()
1229 if (IS_ROOT(dentry)) nfs_lookup_revalidate()
1234 __func__, dentry); nfs_lookup_revalidate()
1243 __func__, dentry, error); nfs_lookup_revalidate()
1248 * A weaker form of d_revalidate for revalidating just the d_inode(dentry)
1249 * when we don't really care about the dentry name. This is called when a
1250 * pathwalk ends on a dentry that was not found via a normal lookup in the
1254 * since the dentry might have changed on the server.
1256 static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) nfs_weak_revalidate() argument
1259 struct inode *inode = d_inode(dentry); nfs_weak_revalidate()
1262 * I believe we can only get a negative dentry here in the case of a nfs_weak_revalidate()
1268 __func__, dentry); nfs_weak_revalidate()
1274 __func__, dentry); nfs_weak_revalidate()
1287 static int nfs_dentry_delete(const struct dentry *dentry) nfs_dentry_delete() argument
1290 dentry, dentry->d_flags); nfs_dentry_delete()
1292 /* Unhash any dentry with a stale inode */ nfs_dentry_delete()
1293 if (d_really_is_positive(dentry) && NFS_STALE(d_inode(dentry))) nfs_dentry_delete()
1296 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { nfs_dentry_delete()
1300 if (!(dentry->d_sb->s_flags & MS_ACTIVE)) { nfs_dentry_delete()
1321 * Called when the dentry loses inode.
1324 static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) nfs_dentry_iput() argument
1330 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { nfs_dentry_iput()
1331 nfs_complete_unlink(dentry, inode); nfs_dentry_iput()
1337 static void nfs_d_release(struct dentry *dentry) nfs_d_release() argument
1340 if (unlikely(dentry->d_fsdata)) { nfs_d_release()
1341 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) nfs_d_release()
1344 kfree(dentry->d_fsdata); nfs_d_release()
1358 struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) nfs_lookup() argument
1360 struct dentry *res; nfs_lookup()
1361 struct dentry *parent; nfs_lookup()
1368 dfprintk(VFS, "NFS: lookup(%pd2)\n", dentry); nfs_lookup()
1372 if (dentry->d_name.len > NFS_SERVER(dir)->namelen) nfs_lookup()
1377 * but don't hash the dentry. nfs_lookup()
1380 d_instantiate(dentry, NULL); nfs_lookup()
1395 parent = dentry->d_parent; nfs_lookup()
1397 trace_nfs_lookup_enter(dir, dentry, flags); nfs_lookup()
1399 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label); nfs_lookup()
1406 inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); nfs_lookup()
1415 res = d_splice_alias(inode, dentry); nfs_lookup()
1419 dentry = res; nfs_lookup()
1421 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_lookup()
1424 trace_nfs_lookup_exit(dir, dentry, flags, error); nfs_lookup()
1434 static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
1455 static struct nfs_open_context *create_nfs_open_context(struct dentry *dentry, int open_flags) create_nfs_open_context() argument
1457 return alloc_nfs_open_context(dentry, flags_to_mode(open_flags)); create_nfs_open_context()
1467 struct dentry *dentry, nfs_finish_open()
1476 err = finish_open(file, dentry, do_open, opened); nfs_finish_open()
1485 int nfs_atomic_open(struct inode *dir, struct dentry *dentry, nfs_atomic_open() argument
1490 struct dentry *res; nfs_atomic_open()
1496 /* Expect a negative dentry */ nfs_atomic_open()
1497 BUG_ON(d_inode(dentry)); nfs_atomic_open()
1500 dir->i_sb->s_id, dir->i_ino, dentry); nfs_atomic_open()
1508 if (!d_unhashed(dentry)) { nfs_atomic_open()
1510 * Hashed negative dentry with O_DIRECTORY: dentry was nfs_atomic_open()
1520 if (dentry->d_name.len > NFS_SERVER(dir)->namelen) nfs_atomic_open()
1532 ctx = create_nfs_open_context(dentry, open_flags); nfs_atomic_open()
1538 nfs_block_sillyrename(dentry->d_parent); nfs_atomic_open()
1540 nfs_unblock_sillyrename(dentry->d_parent); nfs_atomic_open()
1547 d_drop(dentry); nfs_atomic_open()
1548 d_add(dentry, NULL); nfs_atomic_open()
1549 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_atomic_open()
1565 err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened); nfs_atomic_open()
1572 res = nfs_lookup(dir, dentry, lookup_flags); nfs_atomic_open()
1581 static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) nfs4_lookup_revalidate() argument
1588 if (d_mountpoint(dentry)) nfs4_lookup_revalidate()
1590 if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1) nfs4_lookup_revalidate()
1593 inode = d_inode(dentry); nfs4_lookup_revalidate()
1599 struct dentry *parent; nfs4_lookup_revalidate()
1603 parent = ACCESS_ONCE(dentry->d_parent); nfs4_lookup_revalidate()
1608 parent = dget_parent(dentry); nfs4_lookup_revalidate()
1611 if (!nfs_neg_need_reval(dir, dentry, flags)) nfs4_lookup_revalidate()
1617 else if (parent != ACCESS_ONCE(dentry->d_parent)) nfs4_lookup_revalidate()
1625 /* We cannot do exclusive creation on a positive dentry */ nfs4_lookup_revalidate()
1636 return nfs_lookup_revalidate(dentry, flags); nfs4_lookup_revalidate()
1644 int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, nfs_instantiate() argument
1648 struct dentry *parent = dget_parent(dentry); nfs_instantiate()
1653 d_drop(dentry); nfs_instantiate()
1656 if (d_really_is_positive(dentry)) nfs_instantiate()
1659 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL); nfs_instantiate()
1663 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_instantiate()
1665 struct nfs_server *server = NFS_SB(dentry->d_sb); nfs_instantiate()
1670 inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); nfs_instantiate()
1674 d_add(dentry, inode); nfs_instantiate()
1686 * Following a failed create operation, we drop the dentry rather
1687 * than retain a negative dentry. This avoids a problem in the event
1691 int nfs_create(struct inode *dir, struct dentry *dentry, nfs_create() argument
1699 dir->i_sb->s_id, dir->i_ino, dentry); nfs_create()
1704 trace_nfs_create_enter(dir, dentry, open_flags); nfs_create()
1705 error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags); nfs_create()
1706 trace_nfs_create_exit(dir, dentry, open_flags, error); nfs_create()
1711 d_drop(dentry); nfs_create()
1720 nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) nfs_mknod() argument
1726 dir->i_sb->s_id, dir->i_ino, dentry); nfs_mknod()
1734 trace_nfs_mknod_enter(dir, dentry); nfs_mknod()
1735 status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev); nfs_mknod()
1736 trace_nfs_mknod_exit(dir, dentry, status); nfs_mknod()
1741 d_drop(dentry); nfs_mknod()
1749 int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) nfs_mkdir() argument
1755 dir->i_sb->s_id, dir->i_ino, dentry); nfs_mkdir()
1760 trace_nfs_mkdir_enter(dir, dentry); nfs_mkdir()
1761 error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr); nfs_mkdir()
1762 trace_nfs_mkdir_exit(dir, dentry, error); nfs_mkdir()
1767 d_drop(dentry); nfs_mkdir()
1772 static void nfs_dentry_handle_enoent(struct dentry *dentry) nfs_dentry_handle_enoent() argument
1774 if (d_really_is_positive(dentry) && !d_unhashed(dentry)) nfs_dentry_handle_enoent()
1775 d_delete(dentry); nfs_dentry_handle_enoent()
1778 int nfs_rmdir(struct inode *dir, struct dentry *dentry) nfs_rmdir() argument
1783 dir->i_sb->s_id, dir->i_ino, dentry); nfs_rmdir()
1785 trace_nfs_rmdir_enter(dir, dentry); nfs_rmdir()
1786 if (d_really_is_positive(dentry)) { nfs_rmdir()
1787 nfs_wait_on_sillyrename(dentry); nfs_rmdir()
1788 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); nfs_rmdir()
1792 clear_nlink(d_inode(dentry)); nfs_rmdir()
1795 nfs_dentry_handle_enoent(dentry); nfs_rmdir()
1798 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); nfs_rmdir()
1799 trace_nfs_rmdir_exit(dir, dentry, error); nfs_rmdir()
1812 static int nfs_safe_remove(struct dentry *dentry) nfs_safe_remove() argument
1814 struct inode *dir = d_inode(dentry->d_parent); nfs_safe_remove()
1815 struct inode *inode = d_inode(dentry); nfs_safe_remove()
1818 dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry); nfs_safe_remove()
1820 /* If the dentry was sillyrenamed, we simply call d_delete() */ nfs_safe_remove()
1821 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { nfs_safe_remove()
1826 trace_nfs_remove_enter(dir, dentry); nfs_safe_remove()
1829 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); nfs_safe_remove()
1833 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); nfs_safe_remove()
1835 nfs_dentry_handle_enoent(dentry); nfs_safe_remove()
1836 trace_nfs_remove_exit(dir, dentry, error); nfs_safe_remove()
1846 int nfs_unlink(struct inode *dir, struct dentry *dentry) nfs_unlink() argument
1852 dir->i_ino, dentry); nfs_unlink()
1854 trace_nfs_unlink_enter(dir, dentry); nfs_unlink()
1855 spin_lock(&dentry->d_lock); nfs_unlink()
1856 if (d_count(dentry) > 1) { nfs_unlink()
1857 spin_unlock(&dentry->d_lock); nfs_unlink()
1859 write_inode_now(d_inode(dentry), 0); nfs_unlink()
1860 error = nfs_sillyrename(dir, dentry); nfs_unlink()
1863 if (!d_unhashed(dentry)) { nfs_unlink()
1864 __d_drop(dentry); nfs_unlink()
1867 spin_unlock(&dentry->d_lock); nfs_unlink()
1868 error = nfs_safe_remove(dentry); nfs_unlink()
1870 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_unlink()
1872 d_rehash(dentry); nfs_unlink()
1874 trace_nfs_unlink_exit(dir, dentry, error); nfs_unlink()
1894 int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) nfs_symlink() argument
1903 dir->i_ino, dentry, symname); nfs_symlink()
1921 trace_nfs_symlink_enter(dir, dentry); nfs_symlink()
1922 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); nfs_symlink()
1923 trace_nfs_symlink_exit(dir, dentry, error); nfs_symlink()
1927 dentry, symname, error); nfs_symlink()
1928 d_drop(dentry); nfs_symlink()
1937 if (!add_to_page_cache_lru(page, d_inode(dentry)->i_mapping, 0, nfs_symlink()
1954 nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) nfs_link() argument
1960 old_dentry, dentry); nfs_link()
1962 trace_nfs_link_enter(inode, dir, dentry); nfs_link()
1965 d_drop(dentry); nfs_link()
1966 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); nfs_link()
1969 d_add(dentry, inode); nfs_link()
1971 trace_nfs_link_exit(inode, dir, dentry, error); nfs_link()
2000 int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, nfs_rename()
2001 struct inode *new_dir, struct dentry *new_dentry) nfs_rename()
2005 struct dentry *dentry = NULL, *rehash = NULL; nfs_rename() local
2016 * make a copy of the dentry and then do a silly-rename. If the nfs_rename()
2017 * silly-rename succeeds, the copied dentry is hashed and becomes nfs_rename()
2023 * rename, we unhash the dentry in advance. nfs_rename()
2033 /* copy the target dentry's name */ nfs_rename()
2034 dentry = d_alloc(new_dentry->d_parent, nfs_rename()
2036 if (!dentry) nfs_rename()
2044 new_dentry = dentry; nfs_rename()
2079 /* new dentry created? */ nfs_rename()
2080 if (dentry) nfs_rename()
2081 dput(dentry); nfs_rename()
1466 nfs_finish_open(struct nfs_open_context *ctx, struct dentry *dentry, struct file *file, unsigned open_flags, int *opened) nfs_finish_open() argument
H A Dnfs4file.c25 struct dentry *dentry = filp->f_path.dentry; nfs4_file_open() local
26 struct dentry *parent = NULL; nfs4_file_open()
34 * If no cached dentry exists or if it's negative, NFSv4 handled the nfs4_file_open()
37 * We only get this far for a cached positive dentry. We skipped nfs4_file_open()
38 * revalidation, so handle it here by dropping the dentry and returning nfs4_file_open()
42 dprintk("NFS: open file(%pd2)\n", dentry); nfs4_file_open()
50 parent = dget_parent(dentry); nfs4_file_open()
53 ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); nfs4_file_open()
79 if (inode != d_inode(dentry)) nfs4_file_open()
82 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs4_file_open()
94 d_drop(dentry); nfs4_file_open()
H A Dgetroot.c1 /* getroot.c: get the root dentry for an NFS mount
40 * Set the superblock root dentry.
45 /* The mntroot acts as the dummy root dentry for this superblock */ nfs_superblock_set_dummy_root()
52 * Ensure that this dentry is invisible to d_find_alias(). nfs_superblock_set_dummy_root()
69 * get an NFS2/NFS3 root dentry from the root filehandle
71 struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh, nfs_get_root()
76 struct dentry *ret; nfs_get_root()
112 * if the dentry tree reaches them; however if the dentry already nfs_get_root()
117 dprintk("nfs_get_root: get root dentry failed\n"); nfs_get_root()
H A Dnfs4namespace.c83 static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) nfs4_path() argument
86 char *path = nfs_path(&limit, dentry, buffer, buflen, nfs4_path()
98 * believe to be the server path to this dentry
100 static int nfs4_validate_fspath(struct dentry *dentry, nfs4_validate_fspath() argument
106 path = nfs4_path(dentry, page, PAGE_SIZE); nfs4_validate_fspath()
292 * @dentry - parent directory
296 static struct vfsmount *nfs_follow_referral(struct dentry *dentry, nfs_follow_referral() argument
301 .sb = dentry->d_sb, nfs_follow_referral()
302 .dentry = dentry, nfs_follow_referral()
303 .authflavor = NFS_SB(dentry->d_sb)->client->cl_auth->au_flavor, nfs_follow_referral()
311 dprintk("%s: referral at %pd2\n", __func__, dentry); nfs_follow_referral()
321 /* Ensure fs path is a prefix of current dentry path */ nfs_follow_referral()
322 error = nfs4_validate_fspath(dentry, locations, page, page2); nfs_follow_referral()
349 * @dentry - dentry of referral
352 static struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) nfs_do_refmount() argument
355 struct dentry *parent; nfs_do_refmount()
360 /* BUG_ON(IS_ROOT(dentry)); */ nfs_do_refmount()
374 parent = dget_parent(dentry); nfs_do_refmount()
376 __func__, dentry); nfs_do_refmount()
378 err = nfs4_proc_fs_locations(client, d_inode(parent), &dentry->d_name, fs_locations, page); nfs_do_refmount()
385 mnt = nfs_follow_referral(dentry, fs_locations); nfs_do_refmount()
394 struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, nfs4_submount() argument
398 struct dentry *parent = dget_parent(dentry); nfs4_submount()
400 struct qstr *name = &dentry->d_name; nfs4_submount()
411 mnt = nfs_do_refmount(client, dentry); nfs4_submount()
417 mnt = nfs_do_submount(dentry, fh, fattr, flavor); nfs4_submount()
H A Dnfs4super.c20 static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type,
22 static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
24 static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
106 static struct dentry * nfs4_remote_mount()
112 struct dentry *mntroot = ERR_PTR(-ENOMEM); nfs4_remote_mount()
216 static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt, nfs_follow_remote_path()
219 struct dentry *dentry; nfs_follow_remote_path() local
231 dentry = mount_subtree(root_mnt, export_path); nfs_follow_remote_path()
234 return dentry; nfs_follow_remote_path()
237 struct dentry *nfs4_try_mount(int flags, const char *dev_name, nfs4_try_mount()
243 struct dentry *res; nfs4_try_mount()
262 static struct dentry * nfs4_remote_referral_mount()
272 struct dentry *mntroot = ERR_PTR(-ENOMEM); nfs4_remote_referral_mount()
296 static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type, nfs4_referral_mount()
302 struct dentry *res; nfs4_referral_mount()
H A Dinternal.h40 const struct dentry *dentry; member in struct:nfs_clone_mount
137 int (*set_security)(struct super_block *, struct dentry *, struct nfs_mount_info *);
333 struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int);
334 int nfs_create(struct inode *, struct dentry *, umode_t, bool);
335 int nfs_mkdir(struct inode *, struct dentry *, umode_t);
336 int nfs_rmdir(struct inode *, struct dentry *);
337 int nfs_unlink(struct inode *, struct dentry *);
338 int nfs_symlink(struct inode *, struct dentry *, const char *);
339 int nfs_link(struct dentry *, struct inode *, struct dentry *);
340 int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
341 int nfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
377 struct dentry *nfs_try_mount(int, const char *, struct nfs_mount_info *,
380 int nfs_set_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *);
381 int nfs_clone_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *);
382 struct dentry *nfs_fs_mount_common(struct nfs_server *, int, const char *,
384 struct dentry *nfs_fs_mount(struct file_system_type *, int, const char *, void *);
385 struct dentry * nfs_xdev_mount_common(struct file_system_type *, int,
399 extern char *nfs_path(char **p, struct dentry *dentry,
402 struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *,
404 struct vfsmount *nfs_do_submount(struct dentry *, struct nfs_fh *,
408 extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
411 extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *,
428 int nfs_statfs(struct dentry *, struct kstatfs *);
429 int nfs_show_options(struct seq_file *, struct dentry *);
430 int nfs_show_devname(struct seq_file *, struct dentry *);
431 int nfs_show_path(struct seq_file *, struct dentry *);
432 int nfs_show_stats(struct seq_file *, struct dentry *);
491 struct dentry *old_dentry, struct dentry *new_dentry,
493 extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
540 static inline char *nfs_devname(struct dentry *dentry, nfs_devname() argument
544 return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL); nfs_devname()
H A Dnfs3proc.c120 nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, nfs3_proc_setattr() argument
123 struct inode *inode = d_inode(dentry); nfs3_proc_setattr()
299 static int nfs3_do_create(struct inode *dir, struct dentry *dentry, struct nfs3_createdata *data) nfs3_do_create() argument
306 status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); nfs3_do_create()
319 nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, nfs3_proc_create() argument
326 dprintk("NFS call create %pd\n", dentry); nfs3_proc_create()
334 data->arg.create.name = dentry->d_name.name; nfs3_proc_create()
335 data->arg.create.len = dentry->d_name.len; nfs3_proc_create()
350 status = nfs3_do_create(dir, dentry, data); nfs3_proc_create()
388 status = nfs3_proc_setattr(dentry, data->res.fattr, sattr); nfs3_proc_create()
389 nfs_post_op_update_inode(d_inode(dentry), data->res.fattr); nfs3_proc_create()
395 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); nfs3_proc_create()
516 nfs3_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, nfs3_proc_symlink() argument
525 dprintk("NFS call symlink %pd\n", dentry); nfs3_proc_symlink()
532 data->arg.symlink.fromname = dentry->d_name.name; nfs3_proc_symlink()
533 data->arg.symlink.fromlen = dentry->d_name.len; nfs3_proc_symlink()
538 status = nfs3_do_create(dir, dentry, data); nfs3_proc_symlink()
547 nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) nfs3_proc_mkdir() argument
553 dprintk("NFS call mkdir %pd\n", dentry); nfs3_proc_mkdir()
565 data->arg.mkdir.name = dentry->d_name.name; nfs3_proc_mkdir()
566 data->arg.mkdir.len = dentry->d_name.len; nfs3_proc_mkdir()
569 status = nfs3_do_create(dir, dentry, data); nfs3_proc_mkdir()
573 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); nfs3_proc_mkdir()
623 nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, nfs3_proc_readdir() argument
626 struct inode *dir = d_inode(dentry); nfs3_proc_readdir()
671 nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, nfs3_proc_mknod() argument
678 dprintk("NFS call mknod %pd %u:%u\n", dentry, nfs3_proc_mknod()
691 data->arg.mknod.name = dentry->d_name.name; nfs3_proc_mknod()
692 data->arg.mknod.len = dentry->d_name.len; nfs3_proc_mknod()
714 status = nfs3_do_create(dir, dentry, data); nfs3_proc_mknod()
718 status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); nfs3_proc_mknod()
/linux-4.1.27/fs/exportfs/
H A Dexpfs.c22 static int get_name(const struct path *path, char *name, struct dentry *child);
25 static int exportfs_get_name(struct vfsmount *mnt, struct dentry *dir, exportfs_get_name()
26 char *name, struct dentry *child) exportfs_get_name()
29 struct path path = {.mnt = mnt, .dentry = dir}; exportfs_get_name()
38 * Check if the dentry or any of it's aliases is acceptable.
40 static struct dentry * find_acceptable_alias()
41 find_acceptable_alias(struct dentry *result, find_acceptable_alias() argument
42 int (*acceptable)(void *context, struct dentry *dentry), find_acceptable_alias()
45 struct dentry *dentry, *toput = NULL; find_acceptable_alias() local
53 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { find_acceptable_alias()
54 dget(dentry); find_acceptable_alias()
58 if (dentry != result && acceptable(context, dentry)) { find_acceptable_alias()
60 return dentry; find_acceptable_alias()
63 toput = dentry; find_acceptable_alias()
72 static bool dentry_connected(struct dentry *dentry) dentry_connected() argument
74 dget(dentry); dentry_connected()
75 while (dentry->d_flags & DCACHE_DISCONNECTED) { dentry_connected()
76 struct dentry *parent = dget_parent(dentry); dentry_connected()
78 dput(dentry); dentry_connected()
79 if (IS_ROOT(dentry)) { dentry_connected()
83 dentry = parent; dentry_connected()
85 dput(dentry); dentry_connected()
89 static void clear_disconnected(struct dentry *dentry) clear_disconnected() argument
91 dget(dentry); clear_disconnected()
92 while (dentry->d_flags & DCACHE_DISCONNECTED) { clear_disconnected()
93 struct dentry *parent = dget_parent(dentry); clear_disconnected()
95 WARN_ON_ONCE(IS_ROOT(dentry)); clear_disconnected()
97 spin_lock(&dentry->d_lock); clear_disconnected()
98 dentry->d_flags &= ~DCACHE_DISCONNECTED; clear_disconnected()
99 spin_unlock(&dentry->d_lock); clear_disconnected()
101 dput(dentry); clear_disconnected()
102 dentry = parent; clear_disconnected()
104 dput(dentry); clear_disconnected()
108 * Reconnect a directory dentry with its parent.
110 * This can return a dentry, or NULL, or an error.
112 * In the first case the returned dentry is the parent of the given
113 * dentry, and may itself need to be reconnected to its parent.
117 * dentry, so we no longer need to.
119 static struct dentry *reconnect_one(struct vfsmount *mnt, reconnect_one() argument
120 struct dentry *dentry, char *nbuf) reconnect_one()
122 struct dentry *parent; reconnect_one()
123 struct dentry *tmp; reconnect_one()
127 mutex_lock(&dentry->d_inode->i_mutex); reconnect_one()
129 parent = mnt->mnt_sb->s_export_op->get_parent(dentry); reconnect_one()
130 mutex_unlock(&dentry->d_inode->i_mutex); reconnect_one()
134 __func__, dentry->d_inode->i_ino, PTR_ERR(parent)); reconnect_one()
139 dentry->d_inode->i_ino, parent->d_inode->i_ino); reconnect_one()
140 err = exportfs_get_name(mnt, parent, nbuf, dentry); reconnect_one()
153 if (tmp != dentry) { reconnect_one()
158 if (IS_ROOT(dentry)) { reconnect_one()
182 if (!dentry_connected(dentry)) reconnect_one()
188 * Make sure target_dir is fully connected to the dentry tree.
205 reconnect_path(struct vfsmount *mnt, struct dentry *target_dir, char *nbuf) reconnect_path()
207 struct dentry *dentry, *parent; reconnect_path() local
209 dentry = dget(target_dir); reconnect_path()
211 while (dentry->d_flags & DCACHE_DISCONNECTED) { reconnect_path()
212 BUG_ON(dentry == mnt->mnt_sb->s_root); reconnect_path()
214 if (IS_ROOT(dentry)) reconnect_path()
215 parent = reconnect_one(mnt, dentry, nbuf); reconnect_path()
217 parent = dget_parent(dentry); reconnect_path()
221 dput(dentry); reconnect_path()
224 dentry = parent; reconnect_path()
226 dput(dentry); reconnect_path()
265 * @child: the dentry for the child directory.
270 static int get_name(const struct path *path, char *name, struct dentry *child) get_name()
273 struct inode *dir = path->dentry->d_inode; get_name()
279 .dentry = child, get_name()
389 int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, exportfs_encode_fh() argument
393 struct dentry *p = NULL; exportfs_encode_fh()
394 struct inode *inode = dentry->d_inode, *parent = NULL; exportfs_encode_fh()
397 p = dget_parent(dentry); exportfs_encode_fh()
412 struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, exportfs_decode_fh()
414 int (*acceptable)(void *, struct dentry *), void *context) exportfs_decode_fh()
417 struct dentry *result, *alias; exportfs_decode_fh()
422 * Try to get any dentry for the given file handle from the filesystem. exportfs_decode_fh()
436 * On the positive side there is only one dentry for each exportfs_decode_fh()
438 * to ensure our dentry is connected all the way up to the exportfs_decode_fh()
457 struct dentry *target_dir, *nresult; exportfs_decode_fh()
460 * See if either the dentry we just got from the filesystem exportfs_decode_fh()
473 * Try to extract a dentry for the parent directory from the exportfs_decode_fh()
501 * dentry for the inode we're after, make sure that our exportfs_decode_fh()
521 * by the child dentry anyway. exportfs_decode_fh()
526 * And finally make sure the dentry is actually acceptable exportfs_decode_fh()
/linux-4.1.27/fs/ecryptfs/
H A Ddentry.c33 * ecryptfs_d_revalidate - revalidate an ecryptfs dentry
34 * @dentry: The ecryptfs dentry
37 * Called when the VFS needs to revalidate a dentry. This
38 * is called whenever a name lookup finds a dentry in the
45 static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) ecryptfs_d_revalidate() argument
47 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_d_revalidate()
56 if (d_really_is_positive(dentry)) { ecryptfs_d_revalidate()
57 struct inode *inode = d_inode(dentry); ecryptfs_d_revalidate()
76 * @dentry: The ecryptfs dentry
78 * Called when a dentry is really deallocated.
80 static void ecryptfs_d_release(struct dentry *dentry) ecryptfs_d_release() argument
82 struct ecryptfs_dentry_info *p = dentry->d_fsdata; ecryptfs_d_release()
H A Dinode.c39 static struct dentry *lock_parent(struct dentry *dentry) lock_parent() argument
41 struct dentry *dir; lock_parent()
43 dir = dget_parent(dentry); lock_parent()
48 static void unlock_dir(struct dentry *dir) unlock_dir()
123 * @lower_dentry: Existing dentry in the lower filesystem
124 * @dentry: ecryptfs' dentry
131 static int ecryptfs_interpose(struct dentry *lower_dentry, ecryptfs_interpose() argument
132 struct dentry *dentry, struct super_block *sb) ecryptfs_interpose()
138 d_instantiate(dentry, inode); ecryptfs_interpose()
143 static int ecryptfs_do_unlink(struct inode *dir, struct dentry *dentry, ecryptfs_do_unlink() argument
146 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_do_unlink()
148 struct dentry *lower_dir_dentry; ecryptfs_do_unlink()
161 d_drop(dentry); ecryptfs_do_unlink()
170 * @directory_inode: inode of the new file's dentry's parent in ecryptfs
171 * @ecryptfs_dentry: New file's dentry in ecryptfs
173 * @nd: nameidata of ecryptfs' parent's dentry & vfsmount
183 struct dentry *ecryptfs_dentry, umode_t mode) ecryptfs_do_create()
186 struct dentry *lower_dentry; ecryptfs_do_create()
187 struct dentry *lower_dir_dentry; ecryptfs_do_create()
194 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " ecryptfs_do_create()
220 int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, ecryptfs_initialize_file()
242 "the lower file for the dentry with name " ecryptfs_initialize_file()
258 * @dentry: The eCryptfs dentry
266 ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, ecryptfs_create()
297 static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode) ecryptfs_i_size_read() argument
302 rc = ecryptfs_get_lower_file(dentry, inode); ecryptfs_i_size_read()
305 "the lower file for the dentry with name " ecryptfs_i_size_read()
307 dentry, rc); ecryptfs_i_size_read()
319 rc = ecryptfs_read_and_validate_xattr_region(dentry, inode); ecryptfs_i_size_read()
331 static int ecryptfs_lookup_interpose(struct dentry *dentry, ecryptfs_lookup_interpose() argument
332 struct dentry *lower_dentry, ecryptfs_lookup_interpose()
349 lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); ecryptfs_lookup_interpose()
353 ecryptfs_set_dentry_private(dentry, dentry_info); ecryptfs_lookup_interpose()
355 dentry_info->lower_path.dentry = lower_dentry; ecryptfs_lookup_interpose()
359 d_add(dentry, NULL); ecryptfs_lookup_interpose()
369 rc = ecryptfs_i_size_read(dentry, inode); ecryptfs_lookup_interpose()
378 d_add(dentry, inode); ecryptfs_lookup_interpose()
386 * @ecryptfs_dentry: The eCryptfs dentry that we are looking up
390 * dentry cache and continue on to read it from the disk.
392 static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, ecryptfs_lookup()
393 struct dentry *ecryptfs_dentry, ecryptfs_lookup()
399 struct dentry *lower_dir_dentry, *lower_dentry; ecryptfs_lookup()
452 static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, ecryptfs_link()
453 struct dentry *new_dentry) ecryptfs_link()
455 struct dentry *lower_old_dentry; ecryptfs_link()
456 struct dentry *lower_new_dentry; ecryptfs_link()
457 struct dentry *lower_dir_dentry; ecryptfs_link()
486 static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) ecryptfs_unlink() argument
488 return ecryptfs_do_unlink(dir, dentry, d_inode(dentry)); ecryptfs_unlink()
491 static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, ecryptfs_symlink() argument
495 struct dentry *lower_dentry; ecryptfs_symlink()
496 struct dentry *lower_dir_dentry; ecryptfs_symlink()
501 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_symlink()
518 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); ecryptfs_symlink()
526 if (d_really_is_negative(dentry)) ecryptfs_symlink()
527 d_drop(dentry); ecryptfs_symlink()
531 static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ecryptfs_mkdir() argument
534 struct dentry *lower_dentry; ecryptfs_mkdir()
535 struct dentry *lower_dir_dentry; ecryptfs_mkdir()
537 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_mkdir()
542 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); ecryptfs_mkdir()
550 if (d_really_is_negative(dentry)) ecryptfs_mkdir()
551 d_drop(dentry); ecryptfs_mkdir()
555 static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) ecryptfs_rmdir() argument
557 struct dentry *lower_dentry; ecryptfs_rmdir()
558 struct dentry *lower_dir_dentry; ecryptfs_rmdir()
561 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_rmdir()
562 dget(dentry); ecryptfs_rmdir()
567 if (!rc && d_really_is_positive(dentry)) ecryptfs_rmdir()
568 clear_nlink(d_inode(dentry)); ecryptfs_rmdir()
573 d_drop(dentry); ecryptfs_rmdir()
574 dput(dentry); ecryptfs_rmdir()
579 ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) ecryptfs_mknod() argument
582 struct dentry *lower_dentry; ecryptfs_mknod()
583 struct dentry *lower_dir_dentry; ecryptfs_mknod()
585 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_mknod()
590 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); ecryptfs_mknod()
597 if (d_really_is_negative(dentry)) ecryptfs_mknod()
598 d_drop(dentry); ecryptfs_mknod()
603 ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, ecryptfs_rename()
604 struct inode *new_dir, struct dentry *new_dentry) ecryptfs_rename()
607 struct dentry *lower_old_dentry; ecryptfs_rename()
608 struct dentry *lower_new_dentry; ecryptfs_rename()
609 struct dentry *lower_old_dir_dentry; ecryptfs_rename()
610 struct dentry *lower_new_dir_dentry; ecryptfs_rename()
611 struct dentry *trap = NULL; ecryptfs_rename()
652 static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz) ecryptfs_readlink_lower() argument
654 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_readlink_lower()
671 rc = ecryptfs_decode_and_decrypt_filename(&buf, bufsiz, dentry->d_sb, ecryptfs_readlink_lower()
678 static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd) ecryptfs_follow_link() argument
681 char *buf = ecryptfs_readlink_lower(dentry, &len); ecryptfs_follow_link()
684 fsstack_copy_attr_atime(d_inode(dentry), ecryptfs_follow_link()
685 d_inode(ecryptfs_dentry_to_lower(dentry))); ecryptfs_follow_link()
723 * @dentry: The ecryptfs layer dentry
737 static int truncate_upper(struct dentry *dentry, struct iattr *ia, truncate_upper() argument
741 struct inode *inode = d_inode(dentry); truncate_upper()
751 rc = ecryptfs_get_lower_file(dentry, inode); truncate_upper()
754 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; truncate_upper()
847 * @dentry: The ecryptfs layer dentry
855 int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) ecryptfs_truncate() argument
861 rc = ecryptfs_inode_newsize_ok(d_inode(dentry), new_length); ecryptfs_truncate()
865 rc = truncate_upper(dentry, &ia, &lower_ia); ecryptfs_truncate()
867 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_truncate()
884 * @dentry: dentry handle to the inode to modify
894 static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) ecryptfs_setattr() argument
897 struct dentry *lower_dentry; ecryptfs_setattr()
903 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; ecryptfs_setattr()
906 inode = d_inode(dentry); ecryptfs_setattr()
908 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_setattr()
910 if (d_is_dir(dentry)) ecryptfs_setattr()
912 else if (d_is_reg(dentry) ecryptfs_setattr()
918 dentry->d_sb)->mount_crypt_stat; ecryptfs_setattr()
919 rc = ecryptfs_get_lower_file(dentry, inode); ecryptfs_setattr()
924 rc = ecryptfs_read_metadata(dentry); ecryptfs_setattr()
958 rc = truncate_upper(dentry, ia, &lower_ia); ecryptfs_setattr()
978 static int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry, ecryptfs_getattr_link() argument
985 dentry->d_sb)->mount_crypt_stat; ecryptfs_getattr_link()
986 generic_fillattr(d_inode(dentry), stat); ecryptfs_getattr_link()
991 target = ecryptfs_readlink_lower(dentry, &targetsiz); ecryptfs_getattr_link()
1002 static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, ecryptfs_getattr() argument
1008 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat); ecryptfs_getattr()
1010 fsstack_copy_attr_all(d_inode(dentry), ecryptfs_getattr()
1011 ecryptfs_inode_to_lower(d_inode(dentry))); ecryptfs_getattr()
1012 generic_fillattr(d_inode(dentry), stat); ecryptfs_getattr()
1019 ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, ecryptfs_setxattr() argument
1023 struct dentry *lower_dentry; ecryptfs_setxattr()
1025 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_setxattr()
1032 if (!rc && d_really_is_positive(dentry)) ecryptfs_setxattr()
1033 fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); ecryptfs_setxattr()
1039 ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, ecryptfs_getxattr_lower()
1057 ecryptfs_getxattr(struct dentry *dentry, const char *name, void *value, ecryptfs_getxattr() argument
1060 return ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry), name, ecryptfs_getxattr()
1065 ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) ecryptfs_listxattr() argument
1068 struct dentry *lower_dentry; ecryptfs_listxattr()
1070 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_listxattr()
1082 static int ecryptfs_removexattr(struct dentry *dentry, const char *name) ecryptfs_removexattr() argument
1085 struct dentry *lower_dentry; ecryptfs_removexattr()
1087 lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_removexattr()
H A DMakefile7 ecryptfs-y := dentry.o file.o inode.o main.o super.o mmap.o read_write.o \
/linux-4.1.27/fs/ocfs2/
H A Ddcache.c6 * dentry cache handling code
42 void ocfs2_dentry_attach_gen(struct dentry *dentry) ocfs2_dentry_attach_gen() argument
45 OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen; ocfs2_dentry_attach_gen()
46 BUG_ON(d_inode(dentry)); ocfs2_dentry_attach_gen()
47 dentry->d_fsdata = (void *)gen; ocfs2_dentry_attach_gen()
51 static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags) ocfs2_dentry_revalidate() argument
60 inode = d_inode(dentry); ocfs2_dentry_revalidate()
61 osb = OCFS2_SB(dentry->d_sb); ocfs2_dentry_revalidate()
63 trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len, ocfs2_dentry_revalidate()
64 dentry->d_name.name); ocfs2_dentry_revalidate()
66 /* For a negative dentry - ocfs2_dentry_revalidate()
71 unsigned long gen = (unsigned long) dentry->d_fsdata; ocfs2_dentry_revalidate()
73 spin_lock(&dentry->d_lock); ocfs2_dentry_revalidate()
74 pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen; ocfs2_dentry_revalidate()
75 spin_unlock(&dentry->d_lock); ocfs2_dentry_revalidate()
76 trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len, ocfs2_dentry_revalidate()
77 dentry->d_name.name, ocfs2_dentry_revalidate()
111 * If the last lookup failed to create dentry lock, let us ocfs2_dentry_revalidate()
114 if (!dentry->d_fsdata) { ocfs2_dentry_revalidate()
128 static int ocfs2_match_dentry(struct dentry *dentry, ocfs2_match_dentry() argument
137 * ocfs2_dentry_attach_lock() will get its original dentry ocfs2_match_dentry()
140 if (!dentry->d_fsdata) ocfs2_match_dentry()
143 if (!dentry->d_parent) ocfs2_match_dentry()
146 if (skip_unhashed && d_unhashed(dentry)) ocfs2_match_dentry()
149 parent = d_inode(dentry->d_parent); ocfs2_match_dentry()
150 /* Negative parent dentry? */ ocfs2_match_dentry()
162 * Walk the inode alias list, and find a dentry which has a given
168 struct dentry *ocfs2_find_local_alias(struct inode *inode, ocfs2_find_local_alias()
172 struct dentry *dentry; ocfs2_find_local_alias() local
175 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { ocfs2_find_local_alias()
176 spin_lock(&dentry->d_lock); ocfs2_find_local_alias()
177 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { ocfs2_find_local_alias()
178 trace_ocfs2_find_local_alias(dentry->d_name.len, ocfs2_find_local_alias()
179 dentry->d_name.name); ocfs2_find_local_alias()
181 dget_dlock(dentry); ocfs2_find_local_alias()
182 spin_unlock(&dentry->d_lock); ocfs2_find_local_alias()
184 return dentry; ocfs2_find_local_alias()
186 spin_unlock(&dentry->d_lock); ocfs2_find_local_alias()
195 * Attach this dentry to a cluster lock.
216 * attaching and detaching the dentry lock with a
222 * who have seen the dentry will then be informed that they need to
224 * dentry. This happens in ocfs2_dentry_convert_worker().
226 int ocfs2_dentry_attach_lock(struct dentry *dentry, ocfs2_dentry_attach_lock() argument
231 struct dentry *alias; ocfs2_dentry_attach_lock()
232 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; ocfs2_dentry_attach_lock()
234 trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name, ocfs2_dentry_attach_lock()
238 * Negative dentry. We ignore these for now. ocfs2_dentry_attach_lock()
246 if (d_really_is_negative(dentry) && dentry->d_fsdata) { ocfs2_dentry_attach_lock()
247 /* Converting a negative dentry to positive ocfs2_dentry_attach_lock()
248 Clear dentry->d_fsdata */ ocfs2_dentry_attach_lock()
249 dentry->d_fsdata = dl = NULL; ocfs2_dentry_attach_lock()
255 dentry, ocfs2_dentry_attach_lock()
265 * dentry lock already. We can just grab the lock off ocfs2_dentry_attach_lock()
268 * We're depending here on the fact that this dentry ocfs2_dentry_attach_lock()
281 dentry, ocfs2_dentry_attach_lock()
313 dentry->d_fsdata = dl; ocfs2_dentry_attach_lock()
322 ret = ocfs2_dentry_lock(dentry, 0); ocfs2_dentry_attach_lock()
324 ocfs2_dentry_unlock(dentry, 0); ocfs2_dentry_attach_lock()
331 * which means iput() will not be called during dput(dentry). ocfs2_dentry_attach_lock()
337 dentry->d_fsdata = NULL; ocfs2_dentry_attach_lock()
351 * At this point, our particular dentry is detached from the inodes
363 * another process wants to create a new dentry lock. Right now we
394 static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode) ocfs2_dentry_iput() argument
396 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; ocfs2_dentry_iput()
400 * No dentry lock is ok if we're disconnected or ocfs2_dentry_iput()
403 if (!(dentry->d_flags & DCACHE_DISCONNECTED) && ocfs2_dentry_iput()
404 !d_unhashed(dentry)) { ocfs2_dentry_iput()
410 ino, dentry->d_flags, dentry); ocfs2_dentry_iput()
416 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %pd, count: %u\n", ocfs2_dentry_iput()
417 dentry, dl->dl_count); ocfs2_dentry_iput()
419 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl); ocfs2_dentry_iput()
428 * When we are done, "dentry" will have the parent dir and name of
431 * We manually update the lock of "dentry" if need be.
433 * "target" doesn't have it's dentry lock touched - we allow the later
444 void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target, ocfs2_dentry_move() argument
449 struct inode *inode = d_inode(dentry); ocfs2_dentry_move()
460 ocfs2_dentry_lock_put(osb, dentry->d_fsdata); ocfs2_dentry_move()
462 dentry->d_fsdata = NULL; ocfs2_dentry_move()
463 ret = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(new_dir)->ip_blkno); ocfs2_dentry_move()
468 d_move(dentry, target); ocfs2_dentry_move()
H A Ddcache.h44 int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode,
50 struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno,
53 void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
57 void ocfs2_dentry_attach_gen(struct dentry *dentry);
H A Dnamei.c112 static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, ocfs2_lookup() argument
118 struct dentry *ret; ocfs2_lookup()
121 trace_ocfs2_lookup(dir, dentry, dentry->d_name.len, ocfs2_lookup()
122 dentry->d_name.name, ocfs2_lookup()
125 if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) { ocfs2_lookup()
138 status = ocfs2_lookup_ino_from_name(dir, dentry->d_name.name, ocfs2_lookup()
139 dentry->d_name.len, &blkno); ocfs2_lookup()
160 ret = d_splice_alias(inode, dentry); ocfs2_lookup()
165 * dentry, it will d_move() it on top of ourse. The ocfs2_lookup()
170 * NOTE: This dentry already has ->d_op set from ocfs2_lookup()
174 dentry = ret; ocfs2_lookup()
176 status = ocfs2_dentry_attach_lock(dentry, inode, ocfs2_lookup()
184 ocfs2_dentry_attach_gen(dentry); ocfs2_lookup()
189 * dentry under this lock so otherwise we can race this with ocfs2_lookup()
190 * the downconvert thread and have a stale dentry. */ ocfs2_lookup()
221 struct dentry *dentry, struct inode *inode) ocfs2_cleanup_add_entry_failure()
223 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; ocfs2_cleanup_add_entry_failure()
229 dentry->d_fsdata = NULL; ocfs2_cleanup_add_entry_failure()
236 struct dentry *dentry, ocfs2_mknod()
262 trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name, ocfs2_mknod()
290 status = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, ocfs2_mknod()
291 dentry->d_name.len); ocfs2_mknod()
297 dentry->d_name.name, ocfs2_mknod()
298 dentry->d_name.len, &lookup); ocfs2_mknod()
320 status = ocfs2_init_security_get(inode, dir, &dentry->d_name, &si); ocfs2_mknod()
430 * the dentry lock even if ocfs2_add_entry() fails below. ocfs2_mknod()
432 status = ocfs2_dentry_attach_lock(dentry, inode, ocfs2_mknod()
439 dl = dentry->d_fsdata; ocfs2_mknod()
441 status = ocfs2_add_entry(handle, dentry, inode, ocfs2_mknod()
450 d_instantiate(dentry, inode); ocfs2_mknod()
484 ocfs2_cleanup_add_entry_failure(osb, dentry, inode); ocfs2_mknod()
638 struct dentry *dentry, ocfs2_mkdir()
643 trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name, ocfs2_mkdir()
645 ret = ocfs2_mknod(dir, dentry, mode | S_IFDIR, 0); ocfs2_mkdir()
653 struct dentry *dentry, ocfs2_create()
659 trace_ocfs2_create(dir, dentry, dentry->d_name.len, dentry->d_name.name, ocfs2_create()
661 ret = ocfs2_mknod(dir, dentry, mode | S_IFREG, 0); ocfs2_create()
668 static int ocfs2_link(struct dentry *old_dentry, ocfs2_link() argument
670 struct dentry *dentry) ocfs2_link()
687 dentry->d_name.len, dentry->d_name.name); ocfs2_link()
736 err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, ocfs2_link()
737 dentry->d_name.len); ocfs2_link()
742 dentry->d_name.name, ocfs2_link()
743 dentry->d_name.len, &lookup); ocfs2_link()
787 err = ocfs2_add_entry(handle, dentry, inode, ocfs2_link()
797 err = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(dir)->ip_blkno); ocfs2_link()
804 d_instantiate(dentry, inode); ocfs2_link()
828 * Takes and drops an exclusive lock on the given dentry. This will
831 static int ocfs2_remote_dentry_delete(struct dentry *dentry) ocfs2_remote_dentry_delete() argument
835 ret = ocfs2_dentry_lock(dentry, 1); ocfs2_remote_dentry_delete()
839 ocfs2_dentry_unlock(dentry, 1); ocfs2_remote_dentry_delete()
858 struct dentry *dentry) ocfs2_unlink()
863 struct inode *inode = d_inode(dentry); ocfs2_unlink()
875 trace_ocfs2_unlink(dir, dentry, dentry->d_name.len, ocfs2_unlink()
876 dentry->d_name.name, ocfs2_unlink()
882 BUG_ON(d_inode(dentry->d_parent) != dir); ocfs2_unlink()
895 status = ocfs2_find_files_on_disk(dentry->d_name.name, ocfs2_unlink()
896 dentry->d_name.len, &blkno, dir, ocfs2_unlink()
929 status = ocfs2_remote_dentry_delete(dentry); ocfs2_unlink()
1187 struct dentry *old_dentry, ocfs2_rename()
1189 struct dentry *new_dentry) ocfs2_rename()
1292 * dentry locks. ocfs2_rename()
1747 struct dentry *dentry, ocfs2_symlink()
1774 trace_ocfs2_symlink_begin(dir, dentry, symname, ocfs2_symlink()
1775 dentry->d_name.len, dentry->d_name.name); ocfs2_symlink()
1801 status = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, ocfs2_symlink()
1802 dentry->d_name.len); ocfs2_symlink()
1807 dentry->d_name.name, ocfs2_symlink()
1808 dentry->d_name.len, &lookup); ocfs2_symlink()
1829 status = ocfs2_init_security_get(inode, dir, &dentry->d_name, &si); ocfs2_symlink()
1877 trace_ocfs2_symlink_create(dir, dentry, dentry->d_name.len, ocfs2_symlink()
1878 dentry->d_name.name, ocfs2_symlink()
1953 * the dentry lock even if ocfs2_add_entry() fails below. ocfs2_symlink()
1955 status = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(dir)->ip_blkno); ocfs2_symlink()
1961 dl = dentry->d_fsdata; ocfs2_symlink()
1963 status = ocfs2_add_entry(handle, dentry, inode, ocfs2_symlink()
1972 d_instantiate(dentry, inode); ocfs2_symlink()
1998 ocfs2_cleanup_add_entry_failure(osb, dentry, inode); ocfs2_symlink()
2743 struct dentry *dentry) ocfs2_mv_orphaned_inode_to_new()
2755 trace_ocfs2_mv_orphaned_inode_to_new(dir, dentry, ocfs2_mv_orphaned_inode_to_new()
2756 dentry->d_name.len, dentry->d_name.name, ocfs2_mv_orphaned_inode_to_new()
2774 status = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, ocfs2_mv_orphaned_inode_to_new()
2775 dentry->d_name.len); ocfs2_mv_orphaned_inode_to_new()
2781 dentry->d_name.name, ocfs2_mv_orphaned_inode_to_new()
2782 dentry->d_name.len, &lookup); ocfs2_mv_orphaned_inode_to_new()
2843 status = ocfs2_add_entry(handle, dentry, inode, ocfs2_mv_orphaned_inode_to_new()
2851 status = ocfs2_dentry_attach_lock(dentry, inode, ocfs2_mv_orphaned_inode_to_new()
2858 d_instantiate(dentry, inode); ocfs2_mv_orphaned_inode_to_new()
220 ocfs2_cleanup_add_entry_failure(struct ocfs2_super *osb, struct dentry *dentry, struct inode *inode) ocfs2_cleanup_add_entry_failure() argument
235 ocfs2_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) ocfs2_mknod() argument
637 ocfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ocfs2_mkdir() argument
652 ocfs2_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) ocfs2_create() argument
857 ocfs2_unlink(struct inode *dir, struct dentry *dentry) ocfs2_unlink() argument
1746 ocfs2_symlink(struct inode *dir, struct dentry *dentry, const char *symname) ocfs2_symlink() argument
2741 ocfs2_mv_orphaned_inode_to_new(struct inode *dir, struct inode *inode, struct dentry *dentry) ocfs2_mv_orphaned_inode_to_new() argument
/linux-4.1.27/fs/hfsplus/
H A Dxattr_trusted.c14 static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, hfsplus_trusted_getxattr() argument
17 return hfsplus_getxattr(dentry, name, buffer, size, hfsplus_trusted_getxattr()
22 static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, hfsplus_trusted_setxattr() argument
25 return hfsplus_setxattr(dentry, name, buffer, size, flags, hfsplus_trusted_setxattr()
29 static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, hfsplus_trusted_listxattr() argument
H A Dxattr_user.c14 static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, hfsplus_user_getxattr() argument
18 return hfsplus_getxattr(dentry, name, buffer, size, hfsplus_user_getxattr()
22 static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, hfsplus_user_setxattr() argument
25 return hfsplus_setxattr(dentry, name, buffer, size, flags, hfsplus_user_setxattr()
29 static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, hfsplus_user_listxattr() argument
H A Dxattr.h24 int hfsplus_setxattr(struct dentry *dentry, const char *name,
31 ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
35 ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
H A Dxattr_security.c16 static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, hfsplus_security_getxattr() argument
19 return hfsplus_getxattr(dentry, name, buffer, size, hfsplus_security_getxattr()
24 static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, hfsplus_security_setxattr() argument
27 return hfsplus_setxattr(dentry, name, buffer, size, flags, hfsplus_security_setxattr()
32 static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, hfsplus_security_listxattr() argument
H A Ddir.c22 static inline void hfsplus_instantiate(struct dentry *dentry, hfsplus_instantiate() argument
25 dentry->d_fsdata = (void *)(unsigned long)cnid; hfsplus_instantiate()
26 d_instantiate(dentry, inode); hfsplus_instantiate()
29 /* Find the entry inside dir named dentry->d_name */ hfsplus_lookup()
30 static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry, hfsplus_lookup() argument
43 dentry->d_fsdata = NULL; hfsplus_lookup()
48 &dentry->d_name); hfsplus_lookup()
69 dentry->d_fsdata = (void *)(unsigned long)cnid; hfsplus_lookup()
90 if (dentry->d_fsdata) { hfsplus_lookup()
95 cnid = (unsigned long)dentry->d_fsdata; hfsplus_lookup()
98 dentry->d_fsdata = (void *)(unsigned long)cnid; hfsplus_lookup()
110 } else if (!dentry->d_fsdata) hfsplus_lookup()
111 dentry->d_fsdata = (void *)(unsigned long)cnid; hfsplus_lookup()
124 d_add(dentry, inode); hfsplus_lookup()
295 static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, hfsplus_link()
296 struct dentry *dst_dentry) hfsplus_link()
353 static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) hfsplus_unlink() argument
356 struct inode *inode = d_inode(dentry); hfsplus_unlink()
366 cnid = (u32)(unsigned long)dentry->d_fsdata; hfsplus_unlink()
372 dir, &dentry->d_name, hfsplus_unlink()
380 res = hfsplus_delete_cat(cnid, dir, &dentry->d_name); hfsplus_unlink()
410 static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) hfsplus_rmdir() argument
413 struct inode *inode = d_inode(dentry); hfsplus_rmdir()
420 res = hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name); hfsplus_rmdir()
432 static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, hfsplus_symlink() argument
448 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); hfsplus_symlink()
452 res = hfsplus_init_inode_security(inode, dir, &dentry->d_name); hfsplus_symlink()
457 hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name); hfsplus_symlink()
461 hfsplus_instantiate(dentry, inode, inode->i_ino); hfsplus_symlink()
474 static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, hfsplus_mknod() argument
489 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); hfsplus_mknod()
493 res = hfsplus_init_inode_security(inode, dir, &dentry->d_name); hfsplus_mknod()
498 hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name); hfsplus_mknod()
502 hfsplus_instantiate(dentry, inode, inode->i_ino); hfsplus_mknod()
515 static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode, hfsplus_create() argument
518 return hfsplus_mknod(dir, dentry, mode, 0); hfsplus_create()
521 static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) hfsplus_mkdir() argument
523 return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); hfsplus_mkdir()
526 static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, hfsplus_rename()
527 struct inode *new_dir, struct dentry *new_dentry) hfsplus_rename()
H A Dioctl.c28 struct dentry *dentry = file->f_path.dentry; hfsplus_ioctl_bless() local
29 struct inode *inode = d_inode(dentry); hfsplus_ioctl_bless()
33 u32 cnid = (unsigned long)dentry->d_fsdata; hfsplus_ioctl_bless()
42 cpu_to_be32(parent_ino(dentry)); hfsplus_ioctl_bless()
53 cpu_to_be32(parent_ino(dentry)); hfsplus_ioctl_bless()
/linux-4.1.27/fs/jffs2/
H A Dxattr_trusted.c19 static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, jffs2_trusted_getxattr() argument
24 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, jffs2_trusted_getxattr()
28 static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, jffs2_trusted_setxattr() argument
33 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, jffs2_trusted_setxattr()
37 static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, jffs2_trusted_listxattr() argument
H A Dxattr_user.c19 static int jffs2_user_getxattr(struct dentry *dentry, const char *name, jffs2_user_getxattr() argument
24 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER, jffs2_user_getxattr()
28 static int jffs2_user_setxattr(struct dentry *dentry, const char *name, jffs2_user_setxattr() argument
33 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER, jffs2_user_setxattr()
37 static size_t jffs2_user_listxattr(struct dentry *dentry, char *list, jffs2_user_listxattr() argument
H A Dsecurity.c51 static int jffs2_security_getxattr(struct dentry *dentry, const char *name, jffs2_security_getxattr() argument
57 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, jffs2_security_getxattr()
61 static int jffs2_security_setxattr(struct dentry *dentry, const char *name, jffs2_security_setxattr() argument
67 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, jffs2_security_setxattr()
71 static size_t jffs2_security_listxattr(struct dentry *dentry, char *list, jffs2_security_listxattr() argument
H A Ddir.c27 static int jffs2_create (struct inode *,struct dentry *,umode_t,
29 static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
31 static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
32 static int jffs2_unlink (struct inode *,struct dentry *);
33 static int jffs2_symlink (struct inode *,struct dentry *,const char *);
34 static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);
35 static int jffs2_rmdir (struct inode *,struct dentry *);
36 static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t);
37 static int jffs2_rename (struct inode *, struct dentry *,
38 struct inode *, struct dentry *);
77 static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, jffs2_lookup()
158 static int jffs2_create(struct inode *dir_i, struct dentry *dentry, jffs2_create() argument
198 ret = jffs2_do_create(c, dir_f, f, ri, &dentry->d_name); jffs2_create()
211 d_instantiate(dentry, inode); jffs2_create()
223 static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) jffs2_unlink() argument
227 struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode(dentry)); jffs2_unlink()
231 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, jffs2_unlink()
232 dentry->d_name.len, dead_f, now); jffs2_unlink()
234 set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink); jffs2_unlink()
242 static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry) jffs2_link() argument
263 ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, dentry->d_name.name, dentry->d_name.len, now); jffs2_link()
269 d_instantiate(dentry, d_inode(old_dentry)); jffs2_link()
278 static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char *target) jffs2_symlink() argument
306 namelen = dentry->d_name.len; jffs2_symlink()
369 ret = jffs2_init_security(inode, dir_i, &dentry->d_name); jffs2_symlink()
405 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); jffs2_symlink()
407 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL); jffs2_symlink()
431 d_instantiate(dentry, inode); jffs2_symlink()
440 static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode) jffs2_mkdir() argument
464 namelen = dentry->d_name.len; jffs2_mkdir()
513 ret = jffs2_init_security(inode, dir_i, &dentry->d_name); jffs2_mkdir()
549 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); jffs2_mkdir()
551 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL); jffs2_mkdir()
576 d_instantiate(dentry, inode); jffs2_mkdir()
584 static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) jffs2_rmdir() argument
588 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry)); jffs2_rmdir()
598 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, jffs2_rmdir()
599 dentry->d_name.len, f, now); jffs2_rmdir()
602 clear_nlink(d_inode(dentry)); jffs2_rmdir()
608 static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode, dev_t rdev) jffs2_mknod() argument
638 namelen = dentry->d_name.len; jffs2_mknod()
686 ret = jffs2_init_security(inode, dir_i, &dentry->d_name); jffs2_mknod()
725 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); jffs2_mknod()
727 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL); jffs2_mknod()
751 d_instantiate(dentry, inode); jffs2_mknod()
759 static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, jffs2_rename()
760 struct inode *new_dir_i, struct dentry *new_dentry) jffs2_rename()
850 * For one thing, we can't afford dentry aliases for directories. jffs2_rename()
H A Dsymlink.c19 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
32 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) jffs2_follow_link() argument
34 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry)); jffs2_follow_link()
/linux-4.1.27/fs/ext4/
H A Dxattr_trusted.c16 ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, ext4_xattr_trusted_list() argument
34 ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer, ext4_xattr_trusted_get() argument
39 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, ext4_xattr_trusted_get()
44 ext4_xattr_trusted_set(struct dentry *dentry, const char *name, ext4_xattr_trusted_set() argument
49 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, ext4_xattr_trusted_set()
H A Dxattr_user.c15 ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, ext4_xattr_user_list() argument
21 if (!test_opt(dentry->d_sb, XATTR_USER)) ext4_xattr_user_list()
33 ext4_xattr_user_get(struct dentry *dentry, const char *name, ext4_xattr_user_get() argument
38 if (!test_opt(dentry->d_sb, XATTR_USER)) ext4_xattr_user_get()
40 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER, ext4_xattr_user_get()
45 ext4_xattr_user_set(struct dentry *dentry, const char *name, ext4_xattr_user_set() argument
50 if (!test_opt(dentry->d_sb, XATTR_USER)) ext4_xattr_user_set()
52 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, ext4_xattr_user_set()
H A Dxattr_security.c15 ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, ext4_xattr_security_list() argument
31 ext4_xattr_security_get(struct dentry *dentry, const char *name, ext4_xattr_security_get() argument
36 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, ext4_xattr_security_get()
41 ext4_xattr_security_set(struct dentry *dentry, const char *name, ext4_xattr_security_set() argument
46 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, ext4_xattr_security_set()
H A Dsymlink.c26 static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) ext4_follow_link() argument
31 struct inode *inode = d_inode(dentry); ext4_follow_link()
39 return page_follow_link_light(dentry, nd); ext4_follow_link()
100 static void ext4_put_link(struct dentry *dentry, struct nameidata *nd, ext4_put_link() argument
114 static void *ext4_follow_fast_link(struct dentry *dentry, struct nameidata *nd) ext4_follow_fast_link() argument
116 struct ext4_inode_info *ei = EXT4_I(d_inode(dentry)); ext4_follow_fast_link()
/linux-4.1.27/lib/
H A Dnotifier-error-inject.h20 extern struct dentry *notifier_err_inject_dir;
22 extern struct dentry *notifier_err_inject_init(const char *name,
23 struct dentry *parent, struct notifier_err_inject *err_inject,
H A Dnotifier-error-inject.c20 static struct dentry *debugfs_create_errno(const char *name, umode_t mode, debugfs_create_errno()
21 struct dentry *parent, int *value) debugfs_create_errno()
46 struct dentry *notifier_err_inject_dir;
49 struct dentry *notifier_err_inject_init(const char *name, struct dentry *parent, notifier_err_inject_init()
54 struct dentry *dir; notifier_err_inject_init()
55 struct dentry *actions_dir; notifier_err_inject_init()
69 struct dentry *action_dir; notifier_err_inject_init()
/linux-4.1.27/fs/cachefiles/
H A Dxattr.c31 struct dentry *dentry = object->dentry; cachefiles_check_object_type() local
35 ASSERT(dentry); cachefiles_check_object_type()
36 ASSERT(d_backing_inode(dentry)); cachefiles_check_object_type()
46 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, type, 2, cachefiles_check_object_type()
55 dentry, d_backing_inode(dentry)->i_ino, cachefiles_check_object_type()
61 ret = vfs_getxattr(dentry, cachefiles_xattr_cache, xtype, 3); cachefiles_check_object_type()
67 dentry, d_backing_inode(dentry)->i_ino, cachefiles_check_object_type()
87 d_backing_inode(dentry)->i_ino); cachefiles_check_object_type()
94 dentry, d_backing_inode(dentry)->i_ino, cachefiles_check_object_type()
106 struct dentry *dentry = object->dentry; cachefiles_set_object_xattr() local
109 ASSERT(dentry); cachefiles_set_object_xattr()
116 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, cachefiles_set_object_xattr()
134 struct dentry *dentry = object->dentry; cachefiles_update_object_xattr() local
137 ASSERT(dentry); cachefiles_update_object_xattr()
144 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, cachefiles_update_object_xattr()
163 struct dentry *dentry = object->dentry; cachefiles_check_auxdata() local
167 ASSERT(dentry); cachefiles_check_auxdata()
168 ASSERT(d_backing_inode(dentry)); cachefiles_check_auxdata()
175 xlen = vfs_getxattr(dentry, cachefiles_xattr_cache, cachefiles_check_auxdata()
201 struct dentry *dentry = object->dentry; cachefiles_check_object_xattr() local
206 ASSERT(dentry); cachefiles_check_object_xattr()
207 ASSERT(d_backing_inode(dentry)); cachefiles_check_object_xattr()
216 ret = vfs_getxattr(dentry, cachefiles_xattr_cache, cachefiles_check_object_xattr()
228 d_backing_inode(dentry)->i_ino, -ret); cachefiles_check_object_xattr()
272 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, cachefiles_check_object_xattr()
279 d_backing_inode(dentry)->i_ino, -ret); cachefiles_check_object_xattr()
294 d_backing_inode(dentry)->i_ino); cachefiles_check_object_xattr()
307 struct dentry *dentry) cachefiles_remove_object_xattr()
311 ret = vfs_removexattr(dentry, cachefiles_xattr_cache); cachefiles_remove_object_xattr()
319 d_backing_inode(dentry)->i_ino, -ret); cachefiles_remove_object_xattr()
306 cachefiles_remove_object_xattr(struct cachefiles_cache *cache, struct dentry *dentry) cachefiles_remove_object_xattr() argument
H A Dnamei.c94 * mark the owner of a dentry, if there is one, to indicate that that dentry
96 * - the caller must hold the i_mutex on the dentry's parent as required to
100 struct dentry *dentry) cachefiles_mark_object_buried()
105 _enter(",'%pd'", dentry); cachefiles_mark_object_buried()
112 if (object->dentry > dentry) cachefiles_mark_object_buried()
114 else if (object->dentry < dentry) cachefiles_mark_object_buried()
124 /* found the dentry for */ cachefiles_mark_object_buried()
129 dentry); cachefiles_mark_object_buried()
151 struct dentry *dentry; cachefiles_mark_object_active() local
164 dentry = object->dentry; cachefiles_mark_object_active()
173 if (xobject->dentry > dentry) cachefiles_mark_object_active()
175 else if (xobject->dentry < dentry) cachefiles_mark_object_active()
266 struct dentry *dir, cachefiles_bury_object()
267 struct dentry *rep, cachefiles_bury_object()
270 struct dentry *grave, *trap; cachefiles_bury_object()
284 path.dentry = dir; cachefiles_bury_object()
309 /* first step is to make up a grave dentry in the graveyard */ cachefiles_bury_object()
317 /* do some checks before getting the grave dentry */ cachefiles_bury_object()
383 path.dentry = dir; cachefiles_bury_object()
385 path_to_graveyard.dentry = cache->graveyard; cachefiles_bury_object()
412 struct dentry *dir; cachefiles_delete_object()
415 _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry); cachefiles_delete_object()
417 ASSERT(object->dentry); cachefiles_delete_object()
418 ASSERT(d_backing_inode(object->dentry)); cachefiles_delete_object()
419 ASSERT(object->dentry->d_parent); cachefiles_delete_object()
421 dir = dget_parent(object->dentry); cachefiles_delete_object()
434 if (dir == object->dentry->d_parent) { cachefiles_delete_object()
436 object->dentry, false); cachefiles_delete_object()
461 struct dentry *dir, *next = NULL; cachefiles_walk_to_object()
468 parent->fscache.debug_id, parent->dentry, cachefiles_walk_to_object()
475 ASSERT(parent->dentry); cachefiles_walk_to_object()
476 ASSERT(d_backing_inode(parent->dentry)); cachefiles_walk_to_object()
478 if (!(d_is_dir(parent->dentry))) { cachefiles_walk_to_object()
484 dir = dget(parent->dentry); cachefiles_walk_to_object()
527 path.dentry = dir; cachefiles_walk_to_object()
556 path.dentry = dir; cachefiles_walk_to_object()
592 object->dentry = next; cachefiles_walk_to_object()
603 object->dentry = NULL; cachefiles_walk_to_object()
639 path.dentry = next; cachefiles_walk_to_object()
645 if (d_is_reg(object->dentry)) { cachefiles_walk_to_object()
649 aops = d_backing_inode(object->dentry)->i_mapping->a_ops; cachefiles_walk_to_object()
653 object->backer = object->dentry; cachefiles_walk_to_object()
662 _leave(" = 0 [%lu]", d_backing_inode(object->dentry)->i_ino); cachefiles_walk_to_object()
683 dput(object->dentry); cachefiles_walk_to_object()
684 object->dentry = NULL; cachefiles_walk_to_object()
710 struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, cachefiles_get_directory()
711 struct dentry *dir, cachefiles_get_directory()
714 struct dentry *subdir; cachefiles_get_directory()
745 path.dentry = dir; cachefiles_get_directory()
816 static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, cachefiles_check_active()
817 struct dentry *dir, cachefiles_check_active()
822 struct dentry *victim; cachefiles_check_active()
859 if (object->dentry > victim) cachefiles_check_active()
861 else if (object->dentry < victim) cachefiles_check_active()
903 int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, cachefiles_cull()
906 struct dentry *victim; cachefiles_cull()
962 int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir, cachefiles_check_in_use()
965 struct dentry *victim; cachefiles_check_in_use()
99 cachefiles_mark_object_buried(struct cachefiles_cache *cache, struct dentry *dentry) cachefiles_mark_object_buried() argument
/linux-4.1.27/fs/gfs2/
H A Ddentry.c27 * @dentry: the mapping to check
33 * Returns: 1 if the dentry is ok, 0 if it isn't
36 static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) gfs2_drevalidate() argument
38 struct dentry *parent; gfs2_drevalidate()
50 parent = dget_parent(dentry); gfs2_drevalidate()
53 inode = d_inode(dentry); gfs2_drevalidate()
71 error = gfs2_dir_check(d_inode(parent), &dentry->d_name, ip); gfs2_drevalidate()
106 static int gfs2_dhash(const struct dentry *dentry, struct qstr *str) gfs2_dhash() argument
112 static int gfs2_dentry_delete(const struct dentry *dentry) gfs2_dentry_delete() argument
116 if (d_really_is_negative(dentry)) gfs2_dentry_delete()
119 ginode = GFS2_I(d_inode(dentry)); gfs2_dentry_delete()
H A DMakefile5 aops.o dentry.o export.o file.o \
H A Dinode.c574 * @dentry: The new dentry
584 static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, gfs2_create_inode() argument
589 const struct qstr *name = &dentry->d_name; gfs2_create_inode()
620 inode = gfs2_dir_search(dir, &dentry->d_name, !S_ISREG(mode) || excl); gfs2_create_inode()
628 d_instantiate(dentry, inode); gfs2_create_inode()
632 error = finish_open(file, dentry, gfs2_open_common, opened); gfs2_create_inode()
759 d_instantiate(dentry, inode); gfs2_create_inode()
762 error = finish_open(file, dentry, gfs2_open_common, opened); gfs2_create_inode()
805 * @dentry: The dentry of the new file
811 static int gfs2_create(struct inode *dir, struct dentry *dentry, gfs2_create() argument
814 return gfs2_create_inode(dir, dentry, NULL, S_IFREG | mode, 0, NULL, 0, excl, NULL); gfs2_create()
820 * @dentry: The dentry of the new inode
828 static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, __gfs2_lookup() argument
832 struct dentry *d; __gfs2_lookup()
837 inode = gfs2_lookupi(dir, &dentry->d_name, 0); __gfs2_lookup()
839 d_add(dentry, NULL); __gfs2_lookup()
852 d = d_splice_alias(inode, dentry); __gfs2_lookup()
858 error = finish_open(file, dentry, gfs2_open_common, opened); __gfs2_lookup()
868 static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, gfs2_lookup() argument
871 return __gfs2_lookup(dir, dentry, NULL, NULL); gfs2_lookup()
878 * @dentry: The name of the link
881 * name in "dentry".
886 static int gfs2_link(struct dentry *old_dentry, struct inode *dir, gfs2_link() argument
887 struct dentry *dentry) gfs2_link()
924 error = gfs2_dir_check(dir, &dentry->d_name, NULL); gfs2_link()
950 error = gfs2_diradd_alloc_required(dir, &dentry->d_name, &da); gfs2_link()
977 error = gfs2_dir_add(dir, &dentry->d_name, ip, &da); gfs2_link()
985 d_instantiate(dentry, inode); gfs2_link()
1056 const struct dentry *dentry) gfs2_unlink_inode()
1058 struct inode *inode = d_inode(dentry); gfs2_unlink_inode()
1062 error = gfs2_dir_del(dip, dentry); gfs2_unlink_inode()
1082 * @dentry: The file itself
1090 static int gfs2_unlink(struct inode *dir, struct dentry *dentry) gfs2_unlink() argument
1094 struct inode *inode = d_inode(dentry); gfs2_unlink()
1138 error = gfs2_unlink_ok(dip, &dentry->d_name, ip); gfs2_unlink()
1146 error = gfs2_unlink_inode(dip, dentry); gfs2_unlink()
1167 * @dentry: The dentry to put the symlink in
1173 static int gfs2_symlink(struct inode *dir, struct dentry *dentry, gfs2_symlink() argument
1183 return gfs2_create_inode(dir, dentry, NULL, S_IFLNK | S_IRWXUGO, 0, symname, size, 0, NULL); gfs2_symlink()
1189 * @dentry: The dentry of the new directory
1195 static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) gfs2_mkdir() argument
1199 return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0, NULL); gfs2_mkdir()
1205 * @dentry: The dentry of the special file
1211 static int gfs2_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, gfs2_mknod() argument
1214 return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0, NULL); gfs2_mknod()
1220 * @dentry: The proposed new entry
1229 static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, gfs2_atomic_open() argument
1233 struct dentry *d; gfs2_atomic_open()
1236 if (!d_unhashed(dentry)) gfs2_atomic_open()
1239 d = __gfs2_lookup(dir, dentry, file, opened); gfs2_atomic_open()
1243 dentry = d; gfs2_atomic_open()
1244 if (d_really_is_positive(dentry)) { gfs2_atomic_open()
1257 return gfs2_create_inode(dir, dentry, file, S_IFREG | mode, 0, NULL, 0, excl, opened); gfs2_atomic_open()
1312 * @odentry: The old dentry of the file
1314 * @ndentry: The new dentry of the file
1319 static int gfs2_rename(struct inode *odir, struct dentry *odentry, gfs2_rename()
1320 struct inode *ndir, struct dentry *ndentry) gfs2_rename()
1543 * @dentry: The dentry of the link
1551 static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) gfs2_follow_link() argument
1553 struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); gfs2_follow_link()
1734 * @dentry: The dentry which is changing
1743 static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) gfs2_setattr() argument
1745 struct inode *inode = d_inode(dentry); gfs2_setattr()
1786 * @dentry: The dentry to stat
1798 static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, gfs2_getattr() argument
1801 struct inode *inode = d_inode(dentry); gfs2_getattr()
1821 static int gfs2_setxattr(struct dentry *dentry, const char *name, gfs2_setxattr() argument
1824 struct inode *inode = d_inode(dentry); gfs2_setxattr()
1834 ret = generic_setxattr(dentry, name, data, size, flags); gfs2_setxattr()
1841 static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, gfs2_getxattr() argument
1844 struct inode *inode = d_inode(dentry); gfs2_getxattr()
1851 return generic_getxattr(dentry, name, data, size); gfs2_getxattr()
1856 ret = generic_getxattr(dentry, name, data, size); gfs2_getxattr()
1863 static int gfs2_removexattr(struct dentry *dentry, const char *name) gfs2_removexattr() argument
1865 struct inode *inode = d_inode(dentry); gfs2_removexattr()
1875 ret = generic_removexattr(dentry, name); gfs2_removexattr()
1055 gfs2_unlink_inode(struct gfs2_inode *dip, const struct dentry *dentry) gfs2_unlink_inode() argument
/linux-4.1.27/mm/
H A Dhwpoison-inject.c11 static struct dentry *hwpoison_dir;
83 struct dentry *dentry; pfn_inject_init() local
94 dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, pfn_inject_init()
96 if (!dentry) pfn_inject_init()
99 dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, pfn_inject_init()
101 if (!dentry) pfn_inject_init()
104 dentry = debugfs_create_u32("corrupt-filter-enable", 0600, pfn_inject_init()
106 if (!dentry) pfn_inject_init()
109 dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, pfn_inject_init()
111 if (!dentry) pfn_inject_init()
114 dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600, pfn_inject_init()
116 if (!dentry) pfn_inject_init()
119 dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600, pfn_inject_init()
121 if (!dentry) pfn_inject_init()
124 dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600, pfn_inject_init()
126 if (!dentry) pfn_inject_init()
130 dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, pfn_inject_init()
132 if (!dentry) pfn_inject_init()
/linux-4.1.27/fs/tracefs/
H A Dinode.c58 static char *get_dname(struct dentry *dentry) get_dname() argument
62 int len = dentry->d_name.len; get_dname()
64 dname = dentry->d_name.name; get_dname()
73 static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umode_t mode) tracefs_syscall_mkdir() argument
78 name = get_dname(dentry); tracefs_syscall_mkdir()
96 static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry) tracefs_syscall_rmdir() argument
101 name = get_dname(dentry); tracefs_syscall_rmdir()
113 mutex_unlock(&dentry->d_inode->i_mutex); tracefs_syscall_rmdir()
118 mutex_lock(&dentry->d_inode->i_mutex); tracefs_syscall_rmdir()
244 static int tracefs_show_options(struct seq_file *m, struct dentry *root) tracefs_show_options()
302 static struct dentry *trace_mount(struct file_system_type *fs_type, trace_mount()
317 static struct dentry *start_creating(const char *name, struct dentry *parent) start_creating()
319 struct dentry *dentry; start_creating() local
330 * We need the root dentry to do this, which is in the super start_creating()
338 dentry = lookup_one_len(name, parent, strlen(name)); start_creating()
339 if (!IS_ERR(dentry) && dentry->d_inode) { start_creating()
340 dput(dentry); start_creating()
341 dentry = ERR_PTR(-EEXIST); start_creating()
343 if (IS_ERR(dentry)) start_creating()
345 return dentry; start_creating()
348 static struct dentry *failed_creating(struct dentry *dentry) failed_creating() argument
350 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); failed_creating()
351 dput(dentry); failed_creating()
356 static struct dentry *end_creating(struct dentry *dentry) end_creating() argument
358 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); end_creating()
359 return dentry; end_creating()
366 * @parent: a pointer to the parent dentry for this file. This should be a
367 * directory dentry if set. If this parameter is NULL, then the
380 * This function will return a pointer to a dentry if it succeeds. This
388 struct dentry *tracefs_create_file(const char *name, umode_t mode, tracefs_create_file()
389 struct dentry *parent, void *data, tracefs_create_file()
392 struct dentry *dentry; tracefs_create_file() local
398 dentry = start_creating(name, parent); tracefs_create_file()
400 if (IS_ERR(dentry)) tracefs_create_file()
403 inode = tracefs_get_inode(dentry->d_sb); tracefs_create_file()
405 return failed_creating(dentry); tracefs_create_file()
410 d_instantiate(dentry, inode); tracefs_create_file()
411 fsnotify_create(dentry->d_parent->d_inode, dentry); tracefs_create_file()
412 return end_creating(dentry); tracefs_create_file()
415 static struct dentry *__create_dir(const char *name, struct dentry *parent, __create_dir()
418 struct dentry *dentry = start_creating(name, parent); __create_dir() local
421 if (IS_ERR(dentry)) __create_dir()
424 inode = tracefs_get_inode(dentry->d_sb); __create_dir()
426 return failed_creating(dentry); __create_dir()
434 d_instantiate(dentry, inode); __create_dir()
435 inc_nlink(dentry->d_parent->d_inode); __create_dir()
436 fsnotify_mkdir(dentry->d_parent->d_inode, dentry); __create_dir()
437 return end_creating(dentry); __create_dir()
444 * @parent: a pointer to the parent dentry for this file. This should be a
445 * directory dentry if set. If this parameter is NULL, then the
450 * This function will return a pointer to a dentry if it succeeds. This
457 struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) tracefs_create_dir()
477 * Returns the dentry of the instances directory.
479 struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent, tracefs_create_instance_dir()
483 struct dentry *dentry; tracefs_create_instance_dir() local
489 dentry = __create_dir(name, parent, &tracefs_dir_inode_operations); tracefs_create_instance_dir()
490 if (!dentry) tracefs_create_instance_dir()
496 return dentry; tracefs_create_instance_dir()
499 static inline int tracefs_positive(struct dentry *dentry) tracefs_positive() argument
501 return dentry->d_inode && !d_unhashed(dentry); tracefs_positive()
504 static int __tracefs_remove(struct dentry *dentry, struct dentry *parent) __tracefs_remove() argument
508 if (tracefs_positive(dentry)) { __tracefs_remove()
509 if (dentry->d_inode) { __tracefs_remove()
510 dget(dentry); __tracefs_remove()
511 switch (dentry->d_inode->i_mode & S_IFMT) { __tracefs_remove()
513 ret = simple_rmdir(parent->d_inode, dentry); __tracefs_remove()
516 simple_unlink(parent->d_inode, dentry); __tracefs_remove()
520 d_delete(dentry); __tracefs_remove()
521 dput(dentry); __tracefs_remove()
529 * @dentry: a pointer to a the dentry of the file or directory to be
536 void tracefs_remove(struct dentry *dentry) tracefs_remove() argument
538 struct dentry *parent; tracefs_remove()
541 if (IS_ERR_OR_NULL(dentry)) tracefs_remove()
544 parent = dentry->d_parent; tracefs_remove()
549 ret = __tracefs_remove(dentry, parent); tracefs_remove()
557 * @dentry: a pointer to a the dentry of the directory to be removed.
563 void tracefs_remove_recursive(struct dentry *dentry) tracefs_remove_recursive() argument
565 struct dentry *child, *parent; tracefs_remove_recursive()
567 if (IS_ERR_OR_NULL(dentry)) tracefs_remove_recursive()
570 parent = dentry->d_parent; tracefs_remove_recursive()
574 parent = dentry; tracefs_remove_recursive()
617 if (child != dentry) tracefs_remove_recursive()
/linux-4.1.27/fs/configfs/
H A Dconfigfs_internal.h46 struct dentry * s_dentry;
72 extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct inode *));
76 struct dentry *, void *, umode_t, int);
79 extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
82 extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent);
83 extern int configfs_setattr(struct dentry *dentry, struct iattr *iattr);
85 extern struct dentry *configfs_pin_fs(void);
97 extern int configfs_symlink(struct inode *dir, struct dentry *dentry,
99 extern int configfs_unlink(struct inode *dir, struct dentry *dentry);
107 struct dentry *parent,
108 struct dentry *dentry);
110 static inline struct config_item * to_item(struct dentry * dentry) to_item() argument
112 struct configfs_dirent * sd = dentry->d_fsdata; to_item()
116 static inline struct configfs_attribute * to_attr(struct dentry * dentry) to_attr() argument
118 struct configfs_dirent * sd = dentry->d_fsdata; to_attr()
122 static inline struct config_item *configfs_get_config_item(struct dentry *dentry) configfs_get_config_item() argument
126 spin_lock(&dentry->d_lock); configfs_get_config_item()
127 if (!d_unhashed(dentry)) { configfs_get_config_item()
128 struct configfs_dirent * sd = dentry->d_fsdata; configfs_get_config_item()
135 spin_unlock(&dentry->d_lock); configfs_get_config_item()
H A Ddir.c53 static void configfs_d_iput(struct dentry * dentry, configfs_d_iput() argument
56 struct configfs_dirent *sd = dentry->d_fsdata; configfs_d_iput()
63 * Only set sd->dentry to null when this dentry is the only configfs_d_iput()
226 struct dentry * dentry, void * element, configfs_make_dirent()
236 sd->s_dentry = dentry; configfs_make_dirent()
237 if (dentry) configfs_make_dirent()
238 dentry->d_fsdata = configfs_get(sd); configfs_make_dirent()
266 * @dentry: config_item's dentry.
272 static int configfs_create_dir(struct config_item *item, struct dentry *dentry) configfs_create_dir() argument
276 struct dentry *p = dentry->d_parent; configfs_create_dir()
280 error = configfs_dirent_exists(p->d_fsdata, dentry->d_name.name); configfs_create_dir()
284 error = configfs_make_dirent(p->d_fsdata, dentry, item, mode, configfs_create_dir()
289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata); configfs_create_dir()
290 error = configfs_create(dentry, mode, init_dir); configfs_create_dir()
293 item->ci_dentry = dentry; configfs_create_dir()
295 struct configfs_dirent *sd = dentry->d_fsdata; configfs_create_dir()
345 struct dentry *parent, configfs_create_link()
346 struct dentry *dentry) configfs_create_link()
351 err = configfs_make_dirent(parent->d_fsdata, dentry, sl, mode, configfs_create_link()
354 err = configfs_create(dentry, mode, init_symlink); configfs_create_link()
356 struct configfs_dirent *sd = dentry->d_fsdata; configfs_create_link()
368 static void remove_dir(struct dentry * d) remove_dir()
370 struct dentry * parent = dget(d->d_parent); remove_dir()
399 struct dentry * dentry = dget(item->ci_dentry); configfs_remove_dir() local
401 if (!dentry) configfs_remove_dir()
404 remove_dir(dentry); configfs_remove_dir()
408 dput(dentry); configfs_remove_dir()
412 /* attaches attribute's configfs_dirent to the dentry corresponding to the
415 static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry) configfs_attach_attr() argument
421 dentry->d_fsdata = configfs_get(sd); configfs_attach_attr()
422 sd->s_dentry = dentry; configfs_attach_attr()
425 error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG, configfs_attach_attr()
432 d_rehash(dentry); configfs_attach_attr()
437 static struct dentry * configfs_lookup(struct inode *dir, configfs_lookup() argument
438 struct dentry *dentry, configfs_lookup()
441 struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata; configfs_lookup()
462 if (strcmp(name, dentry->d_name.name)) configfs_lookup()
466 err = configfs_attach_attr(sd, dentry); configfs_lookup()
476 if (dentry->d_name.len > NAME_MAX) configfs_lookup()
478 d_add(dentry, NULL); configfs_lookup()
494 static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex) configfs_detach_prep() argument
496 struct configfs_dirent *parent_sd = dentry->d_fsdata; configfs_detach_prep()
541 static void configfs_detach_rollback(struct dentry *dentry) configfs_detach_rollback() argument
543 struct configfs_dirent *parent_sd = dentry->d_fsdata; configfs_detach_rollback()
555 struct dentry * dentry = dget(item->ci_dentry); detach_attrs() local
559 if (!dentry) detach_attrs()
563 dentry->d_name.name); detach_attrs()
565 parent_sd = dentry->d_fsdata; detach_attrs()
572 configfs_drop_dentry(sd, dentry); detach_attrs()
579 dput(dentry); detach_attrs()
606 struct dentry *dentry);
611 struct dentry * dentry = dget(group->cg_item.ci_dentry); detach_groups() local
612 struct dentry *child; detach_groups()
616 if (!dentry) detach_groups()
619 parent_sd = dentry->d_fsdata; detach_groups()
642 dput(dentry); detach_groups()
647 * creates a dentry, attachs it, and then does fixup
659 struct dentry *child, *parent = parent_group->cg_item.ci_dentry; create_default_group()
795 * the dentry allocated, and the dcache is all ready to go.
808 struct dentry *dentry) configfs_attach_item()
812 ret = configfs_create_dir(item, dentry); configfs_attach_item()
817 * We are going to remove an inode and its dentry but configfs_attach_item()
821 mutex_lock(&d_inode(dentry)->i_mutex); configfs_attach_item()
823 d_inode(dentry)->i_flags |= S_DEAD; configfs_attach_item()
824 dont_mount(dentry); configfs_attach_item()
825 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_attach_item()
826 d_delete(dentry); configfs_attach_item()
842 struct dentry *dentry) configfs_attach_group()
847 ret = configfs_attach_item(parent_item, item, dentry); configfs_attach_group()
849 sd = dentry->d_fsdata; configfs_attach_group()
861 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); configfs_attach_group()
866 d_inode(dentry)->i_flags |= S_DEAD; configfs_attach_group()
867 dont_mount(dentry); configfs_attach_group()
870 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_attach_group()
872 d_delete(dentry); configfs_attach_group()
1008 * Here we do a depth-first search of the dentry hierarchy looking for
1027 static int configfs_depend_prep(struct dentry *origin, configfs_depend_prep()
1063 struct dentry *root; configfs_depend_item()
1155 static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) configfs_mkdir() argument
1168 sd = dentry->d_parent->d_fsdata; configfs_mkdir()
1185 parent_item = configfs_get_config_item(dentry->d_parent); configfs_mkdir()
1212 name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL); configfs_mkdir()
1218 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); configfs_mkdir()
1286 ret = configfs_attach_group(parent_item, item, dentry); configfs_mkdir()
1288 ret = configfs_attach_item(parent_item, item, dentry); configfs_mkdir()
1293 configfs_dir_set_ready(dentry->d_fsdata); configfs_mkdir()
1330 static int configfs_rmdir(struct inode *dir, struct dentry *dentry) configfs_rmdir() argument
1339 sd = dentry->d_fsdata; configfs_rmdir()
1344 parent_item = configfs_get_config_item(dentry->d_parent); configfs_rmdir()
1373 ret = configfs_detach_prep(dentry, &wait_mutex); configfs_rmdir()
1375 configfs_detach_rollback(dentry); configfs_rmdir()
1393 item = configfs_get_config_item(dentry); configfs_rmdir()
1445 struct dentry * new_dentry, * parent;
1454 parent = item->parent->dentry;
1464 d_move(item->dentry, new_dentry);
1481 struct dentry * dentry = file->f_path.dentry; configfs_dir_open() local
1482 struct configfs_dirent * parent_sd = dentry->d_fsdata; configfs_dir_open()
1485 mutex_lock(&d_inode(dentry)->i_mutex); configfs_dir_open()
1498 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_dir_open()
1505 struct dentry * dentry = file->f_path.dentry; configfs_dir_close() local
1508 mutex_lock(&d_inode(dentry)->i_mutex); configfs_dir_close()
1512 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_dir_close()
1527 struct dentry *dentry = file->f_path.dentry; configfs_readdir() local
1528 struct super_block *sb = dentry->d_sb; configfs_readdir()
1529 struct configfs_dirent * parent_sd = dentry->d_fsdata; configfs_readdir()
1555 * We'll have a dentry and an inode for configfs_readdir()
1568 dentry = next->s_dentry; configfs_readdir()
1569 if (dentry) configfs_readdir()
1570 inode = d_inode(dentry); configfs_readdir()
1591 struct dentry * dentry = file->f_path.dentry; configfs_dir_lseek() local
1593 mutex_lock(&d_inode(dentry)->i_mutex); configfs_dir_lseek()
1601 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_dir_lseek()
1607 struct configfs_dirent *sd = dentry->d_fsdata; configfs_dir_lseek()
1627 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_dir_lseek()
1643 struct dentry *dentry; configfs_register_subsystem() local
1644 struct dentry *root; configfs_register_subsystem()
1660 dentry = d_alloc_name(root, group->cg_item.ci_name); configfs_register_subsystem()
1661 if (dentry) { configfs_register_subsystem()
1662 d_add(dentry, NULL); configfs_register_subsystem()
1665 dentry); configfs_register_subsystem()
1667 BUG_ON(d_inode(dentry)); configfs_register_subsystem()
1668 d_drop(dentry); configfs_register_subsystem()
1669 dput(dentry); configfs_register_subsystem()
1672 configfs_dir_set_ready(dentry->d_fsdata); configfs_register_subsystem()
1690 struct dentry *dentry = group->cg_item.ci_dentry; configfs_unregister_subsystem() local
1691 struct dentry *root = dentry->d_sb->s_root; configfs_unregister_subsystem()
1693 if (dentry->d_parent != root) { configfs_unregister_subsystem()
1700 mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); configfs_unregister_subsystem()
1703 if (configfs_detach_prep(dentry, NULL)) { configfs_unregister_subsystem()
1709 d_inode(dentry)->i_flags |= S_DEAD; configfs_unregister_subsystem()
1710 dont_mount(dentry); configfs_unregister_subsystem()
1711 mutex_unlock(&d_inode(dentry)->i_mutex); configfs_unregister_subsystem()
1713 d_delete(dentry); configfs_unregister_subsystem()
1717 dput(dentry); configfs_unregister_subsystem()
225 configfs_make_dirent(struct configfs_dirent * parent_sd, struct dentry * dentry, void * element, umode_t mode, int type) configfs_make_dirent() argument
344 configfs_create_link(struct configfs_symlink *sl, struct dentry *parent, struct dentry *dentry) configfs_create_link() argument
806 configfs_attach_item(struct config_item *parent_item, struct config_item *item, struct dentry *dentry) configfs_attach_item() argument
840 configfs_attach_group(struct config_item *parent_item, struct config_item *item, struct dentry *dentry) configfs_attach_group() argument
H A Dinode.c4 * inode.c - basic inode and dentry operations.
57 int configfs_setattr(struct dentry * dentry, struct iattr * iattr) configfs_setattr() argument
59 struct inode * inode = d_inode(dentry); configfs_setattr()
60 struct configfs_dirent * sd = dentry->d_fsdata; configfs_setattr()
83 error = simple_setattr(dentry, iattr); configfs_setattr()
179 int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct inode *)) configfs_create() argument
186 if (!dentry) configfs_create()
189 if (d_really_is_positive(dentry)) configfs_create()
192 sd = dentry->d_fsdata; configfs_create()
193 inode = configfs_new_inode(mode, sd, dentry->d_sb); configfs_create()
197 p_inode = d_inode(dentry->d_parent); configfs_create()
202 d_instantiate(dentry, inode); configfs_create()
204 dget(dentry); /* pin link and directory dentries in core */ configfs_create()
217 /* These always have a dentry, so use that */ configfs_get_name()
230 * Unhashes the dentry corresponding to given configfs_dirent
233 void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) configfs_drop_dentry()
235 struct dentry * dentry = sd->s_dentry; configfs_drop_dentry() local
237 if (dentry) { configfs_drop_dentry()
238 spin_lock(&dentry->d_lock); configfs_drop_dentry()
239 if (!d_unhashed(dentry) && d_really_is_positive(dentry)) { configfs_drop_dentry()
240 dget_dlock(dentry); configfs_drop_dentry()
241 __d_drop(dentry); configfs_drop_dentry()
242 spin_unlock(&dentry->d_lock); configfs_drop_dentry()
243 simple_unlink(d_inode(parent), dentry); configfs_drop_dentry() local
245 spin_unlock(&dentry->d_lock); configfs_drop_dentry()
249 void configfs_hash_and_remove(struct dentry * dir, const char * name) configfs_hash_and_remove()
H A Dsymlink.c74 struct dentry *dentry) create_link()
97 dentry); create_link()
119 if (path->dentry->d_sb == sb) { get_target()
120 *target = configfs_get_config_item(path->dentry); get_target()
135 int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) configfs_symlink() argument
144 sd = dentry->d_parent->d_fsdata; configfs_symlink()
153 parent_item = configfs_get_config_item(dentry->d_parent); configfs_symlink()
161 ret = get_target(symname, &path, &target_item, dentry->d_sb); configfs_symlink()
168 ret = create_link(parent_item, target_item, dentry); configfs_symlink()
185 int configfs_unlink(struct inode *dir, struct dentry *dentry) configfs_unlink() argument
187 struct configfs_dirent *sd = dentry->d_fsdata; configfs_unlink()
199 parent_item = configfs_get_config_item(dentry->d_parent); configfs_unlink()
205 configfs_drop_dentry(sd, dentry->d_parent); configfs_unlink()
206 dput(dentry); configfs_unlink()
257 static int configfs_getlink(struct dentry *dentry, char * path) configfs_getlink() argument
262 item = configfs_get_config_item(dentry->d_parent); configfs_getlink()
266 target_item = configfs_get_config_item(dentry); configfs_getlink()
282 static void *configfs_follow_link(struct dentry *dentry, struct nameidata *nd) configfs_follow_link() argument
288 error = configfs_getlink(dentry, (char *)page); configfs_follow_link()
299 static void configfs_put_link(struct dentry *dentry, struct nameidata *nd, configfs_put_link() argument
72 create_link(struct config_item *parent_item, struct config_item *item, struct dentry *dentry) create_link() argument
/linux-4.1.27/net/sunrpc/
H A Drpc_pipe.c87 struct dentry *dentry; rpc_timeout_upcall_queue() local
95 dentry = dget(pipe->dentry); rpc_timeout_upcall_queue()
97 rpc_purge_list(dentry ? &RPC_I(d_inode(dentry))->waitq : NULL, rpc_timeout_upcall_queue()
99 dput(dentry); rpc_timeout_upcall_queue()
136 struct dentry *dentry; rpc_queue_upcall() local
152 dentry = dget(pipe->dentry); rpc_queue_upcall()
154 if (dentry) { rpc_queue_upcall()
155 wake_up(&RPC_I(d_inode(dentry))->waitq); rpc_queue_upcall()
156 dput(dentry); rpc_queue_upcall()
182 pipe->dentry = NULL; rpc_close_pipes()
428 spin_lock(&file->f_path.dentry->d_lock); rpc_info_open()
429 if (!d_unhashed(file->f_path.dentry)) rpc_info_open()
432 spin_unlock(&file->f_path.dentry->d_lock); rpc_info_open()
435 spin_unlock(&file->f_path.dentry->d_lock); rpc_info_open()
492 static int __rpc_create_common(struct inode *dir, struct dentry *dentry, __rpc_create_common() argument
499 d_drop(dentry); __rpc_create_common()
508 d_add(dentry, inode); __rpc_create_common()
511 printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %pd\n", __rpc_create_common()
512 __FILE__, __func__, dentry); __rpc_create_common()
513 dput(dentry); __rpc_create_common()
517 static int __rpc_create(struct inode *dir, struct dentry *dentry, __rpc_create() argument
524 err = __rpc_create_common(dir, dentry, S_IFREG | mode, i_fop, private); __rpc_create()
527 fsnotify_create(dir, dentry); __rpc_create()
531 static int __rpc_mkdir(struct inode *dir, struct dentry *dentry, __rpc_mkdir() argument
538 err = __rpc_create_common(dir, dentry, S_IFDIR | mode, i_fop, private); __rpc_mkdir()
542 fsnotify_mkdir(dir, dentry); __rpc_mkdir()
559 pipe->dentry = NULL; init_pipe()
582 static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, __rpc_mkpipe_dentry() argument
591 err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); __rpc_mkpipe_dentry()
594 rpci = RPC_I(d_inode(dentry)); __rpc_mkpipe_dentry()
597 fsnotify_create(dir, dentry); __rpc_mkpipe_dentry()
601 static int __rpc_rmdir(struct inode *dir, struct dentry *dentry) __rpc_rmdir() argument
605 dget(dentry); __rpc_rmdir()
606 ret = simple_rmdir(dir, dentry); __rpc_rmdir()
607 d_delete(dentry); __rpc_rmdir()
608 dput(dentry); __rpc_rmdir()
612 int rpc_rmdir(struct dentry *dentry) rpc_rmdir() argument
614 struct dentry *parent; rpc_rmdir()
618 parent = dget_parent(dentry); rpc_rmdir()
621 error = __rpc_rmdir(dir, dentry); rpc_rmdir()
628 static int __rpc_unlink(struct inode *dir, struct dentry *dentry) __rpc_unlink() argument
632 dget(dentry); __rpc_unlink()
633 ret = simple_unlink(dir, dentry); __rpc_unlink()
634 d_delete(dentry); __rpc_unlink()
635 dput(dentry); __rpc_unlink()
639 static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) __rpc_rmpipe() argument
641 struct inode *inode = d_inode(dentry); __rpc_rmpipe()
644 return __rpc_unlink(dir, dentry); __rpc_rmpipe()
647 static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, __rpc_lookup_create_exclusive()
651 struct dentry *dentry = d_hash_and_lookup(parent, &q); __rpc_lookup_create_exclusive() local
652 if (!dentry) { __rpc_lookup_create_exclusive()
653 dentry = d_alloc(parent, &q); __rpc_lookup_create_exclusive()
654 if (!dentry) __rpc_lookup_create_exclusive()
657 if (d_really_is_negative(dentry)) __rpc_lookup_create_exclusive()
658 return dentry; __rpc_lookup_create_exclusive()
659 dput(dentry); __rpc_lookup_create_exclusive()
666 static void __rpc_depopulate(struct dentry *parent, __rpc_depopulate()
671 struct dentry *dentry; __rpc_depopulate() local
678 dentry = d_hash_and_lookup(parent, &name); __rpc_depopulate()
680 if (dentry == NULL) __rpc_depopulate()
682 if (d_really_is_negative(dentry)) __rpc_depopulate()
684 switch (d_inode(dentry)->i_mode & S_IFMT) { __rpc_depopulate()
688 __rpc_unlink(dir, dentry); __rpc_depopulate()
691 __rpc_rmdir(dir, dentry); __rpc_depopulate()
694 dput(dentry); __rpc_depopulate()
698 static void rpc_depopulate(struct dentry *parent, rpc_depopulate()
709 static int rpc_populate(struct dentry *parent, rpc_populate()
715 struct dentry *dentry; rpc_populate() local
720 dentry = __rpc_lookup_create_exclusive(parent, files[i].name); rpc_populate()
721 err = PTR_ERR(dentry); rpc_populate()
722 if (IS_ERR(dentry)) rpc_populate()
728 err = __rpc_create(dir, dentry, rpc_populate()
734 err = __rpc_mkdir(dir, dentry, rpc_populate()
752 static struct dentry *rpc_mkdir_populate(struct dentry *parent, rpc_mkdir_populate()
754 int (*populate)(struct dentry *, void *), void *args_populate) rpc_mkdir_populate()
756 struct dentry *dentry; rpc_mkdir_populate() local
761 dentry = __rpc_lookup_create_exclusive(parent, name); rpc_mkdir_populate()
762 if (IS_ERR(dentry)) rpc_mkdir_populate()
764 error = __rpc_mkdir(dir, dentry, mode, NULL, private); rpc_mkdir_populate()
768 error = populate(dentry, args_populate); rpc_mkdir_populate()
774 return dentry; rpc_mkdir_populate()
776 __rpc_rmdir(dir, dentry); rpc_mkdir_populate()
778 dentry = ERR_PTR(error); rpc_mkdir_populate()
782 static int rpc_rmdir_depopulate(struct dentry *dentry, rpc_rmdir_depopulate() argument
783 void (*depopulate)(struct dentry *)) rpc_rmdir_depopulate()
785 struct dentry *parent; rpc_rmdir_depopulate()
789 parent = dget_parent(dentry); rpc_rmdir_depopulate()
793 depopulate(dentry); rpc_rmdir_depopulate()
794 error = __rpc_rmdir(dir, dentry); rpc_rmdir_depopulate()
802 * @parent: dentry of directory to create new "pipe" in
818 struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name, rpc_mkpipe_dentry()
821 struct dentry *dentry; rpc_mkpipe_dentry() local
832 dentry = __rpc_lookup_create_exclusive(parent, name); rpc_mkpipe_dentry()
833 if (IS_ERR(dentry)) rpc_mkpipe_dentry()
835 err = __rpc_mkpipe_dentry(dir, dentry, umode, &rpc_pipe_fops, rpc_mkpipe_dentry()
841 return dentry; rpc_mkpipe_dentry()
843 dentry = ERR_PTR(err); rpc_mkpipe_dentry()
853 * @dentry: dentry for the pipe, as returned from rpc_mkpipe
860 rpc_unlink(struct dentry *dentry) rpc_unlink() argument
862 struct dentry *parent; rpc_unlink()
866 parent = dget_parent(dentry); rpc_unlink()
869 error = __rpc_rmpipe(dir, dentry); rpc_unlink()
1013 struct dentry *dir = pdh->pdh_dentry; rpc_create_pipe_dir_objects()
1023 struct dentry *dir = pdh->pdh_dentry; rpc_destroy_pipe_dir_objects()
1042 static int rpc_clntdir_populate(struct dentry *dentry, void *private) rpc_clntdir_populate() argument
1044 return rpc_populate(dentry, rpc_clntdir_populate()
1049 static void rpc_clntdir_depopulate(struct dentry *dentry) rpc_clntdir_depopulate() argument
1051 rpc_depopulate(dentry, authfiles, RPCAUTH_info, RPCAUTH_EOF); rpc_clntdir_depopulate()
1056 * @dentry: the parent of new directory
1065 struct dentry *rpc_create_client_dir(struct dentry *dentry, rpc_create_client_dir() argument
1069 struct dentry *ret; rpc_create_client_dir()
1071 ret = rpc_mkdir_populate(dentry, name, S_IRUGO | S_IXUGO, NULL, rpc_create_client_dir()
1086 struct dentry *dentry = rpc_client->cl_pipedir_objects.pdh_dentry; rpc_remove_client_dir() local
1088 if (dentry == NULL) rpc_remove_client_dir()
1092 return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate); rpc_remove_client_dir()
1113 static int rpc_cachedir_populate(struct dentry *dentry, void *private) rpc_cachedir_populate() argument
1115 return rpc_populate(dentry, rpc_cachedir_populate()
1120 static void rpc_cachedir_depopulate(struct dentry *dentry) rpc_cachedir_depopulate() argument
1122 rpc_depopulate(dentry, cache_pipefs_files, 0, 3); rpc_cachedir_depopulate()
1125 struct dentry *rpc_create_cache_dir(struct dentry *parent, const char *name, rpc_create_cache_dir()
1132 void rpc_remove_cache_dir(struct dentry *dentry) rpc_remove_cache_dir() argument
1134 rpc_rmdir_depopulate(dentry, rpc_cachedir_depopulate); rpc_remove_cache_dir()
1206 struct dentry *rpc_d_lookup_sb(const struct super_block *sb, rpc_d_lookup_sb()
1325 static struct dentry * rpc_gssd_dummy_populate()
1326 rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) rpc_gssd_dummy_populate()
1329 struct dentry *gssd_dentry; rpc_gssd_dummy_populate()
1330 struct dentry *clnt_dentry = NULL; rpc_gssd_dummy_populate()
1331 struct dentry *pipe_dentry = NULL; rpc_gssd_dummy_populate()
1373 rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry) rpc_gssd_dummy_depopulate()
1375 struct dentry *clnt_dir = pipe_dentry->d_parent; rpc_gssd_dummy_depopulate()
1376 struct dentry *gssd_dir = clnt_dir->d_parent; rpc_gssd_dummy_depopulate()
1388 struct dentry *root, *gssd_dentry; rpc_fill_super()
1447 static struct dentry * rpc_mount()
/linux-4.1.27/fs/proc/
H A Dnamespaces.c33 static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) proc_ns_follow_link() argument
35 struct inode *inode = d_inode(dentry); proc_ns_follow_link()
54 static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) proc_ns_readlink() argument
56 struct inode *inode = d_inode(dentry); proc_ns_readlink()
82 struct dentry *dentry, struct task_struct *task, const void *ptr) proc_ns_instantiate()
97 d_set_d_op(dentry, &pid_dentry_operations); proc_ns_instantiate()
98 d_add(dentry, inode); proc_ns_instantiate()
99 /* Close the race of the process dying before we return the dentry */ proc_ns_instantiate()
100 if (pid_revalidate(dentry, 0)) proc_ns_instantiate()
138 static struct dentry *proc_ns_dir_lookup(struct inode *dir, proc_ns_dir_lookup() argument
139 struct dentry *dentry, unsigned int flags) proc_ns_dir_lookup()
144 unsigned int len = dentry->d_name.len; proc_ns_dir_lookup()
155 if (!memcmp(dentry->d_name.name, (*entry)->name, len)) proc_ns_dir_lookup()
161 error = proc_ns_instantiate(dir, dentry, task, *entry); proc_ns_dir_lookup()
81 proc_ns_instantiate(struct inode *dir, struct dentry *dentry, struct task_struct *task, const void *ptr) proc_ns_instantiate() argument
H A Dfd.c83 static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags) tid_fd_revalidate() argument
94 inode = d_inode(dentry); tid_fd_revalidate()
148 static int proc_fd_link(struct dentry *dentry, struct path *path) proc_fd_link() argument
154 task = get_proc_task(d_inode(dentry)); proc_fd_link()
161 int fd = proc_fd(d_inode(dentry)); proc_fd_link()
179 proc_fd_instantiate(struct inode *dir, struct dentry *dentry, proc_fd_instantiate() argument
199 d_set_d_op(dentry, &tid_fd_dentry_operations); proc_fd_instantiate()
200 d_add(dentry, inode); proc_fd_instantiate()
202 /* Close the race of the process dying before we return the dentry */ proc_fd_instantiate()
203 if (tid_fd_revalidate(dentry, 0)) proc_fd_instantiate()
209 static struct dentry *proc_lookupfd_common(struct inode *dir, proc_lookupfd_common() argument
210 struct dentry *dentry, proc_lookupfd_common()
215 unsigned fd = name_to_int(&dentry->d_name); proc_lookupfd_common()
222 result = instantiate(dir, dentry, task, (void *)(unsigned long)fd); proc_lookupfd_common()
282 static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry, proc_lookupfd() argument
285 return proc_lookupfd_common(dir, dentry, proc_fd_instantiate); proc_lookupfd()
309 proc_fdinfo_instantiate(struct inode *dir, struct dentry *dentry, proc_fdinfo_instantiate() argument
326 d_set_d_op(dentry, &tid_fd_dentry_operations); proc_fdinfo_instantiate()
327 d_add(dentry, inode); proc_fdinfo_instantiate()
329 /* Close the race of the process dying before we return the dentry */ proc_fdinfo_instantiate()
330 if (tid_fd_revalidate(dentry, 0)) proc_fdinfo_instantiate()
336 static struct dentry * proc_lookupfdinfo()
337 proc_lookupfdinfo(struct inode *dir, struct dentry *dentry, unsigned int flags) proc_lookupfdinfo() argument
339 return proc_lookupfd_common(dir, dentry, proc_fdinfo_instantiate); proc_lookupfdinfo()
H A Dself.c10 static int proc_self_readlink(struct dentry *dentry, char __user *buffer, proc_self_readlink() argument
13 struct pid_namespace *ns = dentry->d_sb->s_fs_info; proc_self_readlink()
22 static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) proc_self_follow_link() argument
24 struct pid_namespace *ns = dentry->d_sb->s_fs_info; proc_self_follow_link()
51 struct dentry *self; proc_setup_self()
H A Dthread_self.c10 static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer, proc_thread_self_readlink() argument
13 struct pid_namespace *ns = dentry->d_sb->s_fs_info; proc_thread_self_readlink()
23 static void *proc_thread_self_follow_link(struct dentry *dentry, struct nameidata *nd) proc_thread_self_follow_link() argument
25 struct pid_namespace *ns = dentry->d_sb->s_fs_info; proc_thread_self_follow_link()
52 struct dentry *thread_self; proc_setup_thread_self()
/linux-4.1.27/security/integrity/evm/
H A Devm_main.c74 static int evm_find_protected_xattrs(struct dentry *dentry) evm_find_protected_xattrs() argument
76 struct inode *inode = d_backing_inode(dentry); evm_find_protected_xattrs()
85 error = inode->i_op->getxattr(dentry, *xattr, NULL, 0); evm_find_protected_xattrs()
100 * Compute the HMAC on the dentry's protected set of extended attributes
110 static enum integrity_status evm_verify_hmac(struct dentry *dentry, evm_verify_hmac() argument
127 rc = vfs_getxattr_alloc(dentry, XATTR_NAME_EVM, (char **)&xattr_data, 0, evm_verify_hmac()
132 rc = evm_find_protected_xattrs(dentry); evm_verify_hmac()
148 rc = evm_calc_hmac(dentry, xattr_name, xattr_value, evm_verify_hmac()
158 rc = evm_calc_hash(dentry, xattr_name, xattr_value, evm_verify_hmac()
169 if (!IS_RDONLY(d_backing_inode(dentry)) && evm_verify_hmac()
170 !IS_IMMUTABLE(d_backing_inode(dentry))) evm_verify_hmac()
171 evm_update_evmxattr(dentry, xattr_name, evm_verify_hmac()
216 * @dentry: object of the verify xattr
221 * Calculate the HMAC for the given dentry and verify it against the stored
230 enum integrity_status evm_verifyxattr(struct dentry *dentry, evm_verifyxattr() argument
239 iint = integrity_iint_find(d_backing_inode(dentry)); evm_verifyxattr()
243 return evm_verify_hmac(dentry, xattr_name, xattr_value, evm_verifyxattr()
249 * evm_verify_current_integrity - verify the dentry's metadata integrity
250 * @dentry: pointer to the affected dentry
252 * Verify and return the dentry's metadata integrity. The exceptions are
255 static enum integrity_status evm_verify_current_integrity(struct dentry *dentry) evm_verify_current_integrity() argument
257 struct inode *inode = d_backing_inode(dentry); evm_verify_current_integrity()
261 return evm_verify_hmac(dentry, NULL, NULL, 0, NULL); evm_verify_current_integrity()
276 static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, evm_protect_xattr() argument
287 evm_status = evm_verify_current_integrity(dentry); evm_protect_xattr()
293 evm_status = evm_verify_current_integrity(dentry); evm_protect_xattr()
297 iint = integrity_iint_find(d_backing_inode(dentry)); evm_protect_xattr()
302 if (dentry->d_inode->i_sb->s_magic == TMPFS_MAGIC evm_protect_xattr()
303 || dentry->d_inode->i_sb->s_magic == SYSFS_MAGIC) evm_protect_xattr()
307 dentry->d_inode, dentry->d_name.name, evm_protect_xattr()
314 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), evm_protect_xattr()
315 dentry->d_name.name, "appraise_metadata", evm_protect_xattr()
323 * @dentry: pointer to the affected dentry
334 int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name, evm_inode_setxattr() argument
345 return evm_protect_xattr(dentry, xattr_name, xattr_value, evm_inode_setxattr()
351 * @dentry: pointer to the affected dentry
357 int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name) evm_inode_removexattr() argument
359 return evm_protect_xattr(dentry, xattr_name, NULL, 0); evm_inode_removexattr()
364 * @dentry: pointer to the affected dentry
375 void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name, evm_inode_post_setxattr() argument
382 evm_update_evmxattr(dentry, xattr_name, xattr_value, xattr_value_len); evm_inode_post_setxattr()
387 * @dentry: pointer to the affected dentry
392 void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) evm_inode_post_removexattr() argument
394 struct inode *inode = d_backing_inode(dentry); evm_inode_post_removexattr()
400 evm_update_evmxattr(dentry, xattr_name, NULL, 0); evm_inode_post_removexattr()
406 * @dentry: pointer to the affected dentry
408 int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) evm_inode_setattr() argument
415 evm_status = evm_verify_current_integrity(dentry); evm_inode_setattr()
419 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), evm_inode_setattr()
420 dentry->d_name.name, "appraise_metadata", evm_inode_setattr()
427 * @dentry: pointer to the affected dentry
436 void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) evm_inode_post_setattr() argument
442 evm_update_evmxattr(dentry, NULL, NULL, 0); evm_inode_post_setattr()
H A Devm.h39 int evm_update_evmxattr(struct dentry *dentry,
43 int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
46 int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
H A Devm_crypto.c128 static int evm_calc_hmac_or_hash(struct dentry *dentry, evm_calc_hmac_or_hash() argument
134 struct inode *inode = d_backing_inode(dentry); evm_calc_hmac_or_hash()
157 size = vfs_getxattr_alloc(dentry, *xattrname, evm_calc_hmac_or_hash()
178 int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name, evm_calc_hmac() argument
182 return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value, evm_calc_hmac()
186 int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name, evm_calc_hash() argument
190 return evm_calc_hmac_or_hash(dentry, req_xattr_name, req_xattr_value, evm_calc_hash()
199 int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, evm_update_evmxattr() argument
202 struct inode *inode = d_backing_inode(dentry); evm_update_evmxattr()
206 rc = evm_calc_hmac(dentry, xattr_name, xattr_value, evm_update_evmxattr()
210 rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, evm_update_evmxattr()
214 rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); evm_update_evmxattr()
/linux-4.1.27/arch/s390/hypfs/
H A Dhypfs.h22 extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
24 extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
27 extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
33 extern int hypfs_diag_create_files(struct dentry *root);
38 extern int hypfs_vm_create_files(struct dentry *root);
68 struct dentry *dentry; member in struct:hypfs_dbfs_file
H A Dinode.c31 static struct dentry *hypfs_create_update_file(struct dentry *dir);
36 struct dentry *update_file; /* file to trigger update */
46 static struct dentry *hypfs_last_dentry;
59 static void hypfs_add_dentry(struct dentry *dentry) hypfs_add_dentry() argument
61 dentry->d_fsdata = hypfs_last_dentry; hypfs_add_dentry()
62 hypfs_last_dentry = dentry; hypfs_add_dentry()
65 static inline int hypfs_positive(struct dentry *dentry) hypfs_positive() argument
67 return d_really_is_positive(dentry) && !d_unhashed(dentry); hypfs_positive()
70 static void hypfs_remove(struct dentry *dentry) hypfs_remove() argument
72 struct dentry *parent; hypfs_remove()
74 parent = dentry->d_parent; hypfs_remove()
76 if (hypfs_positive(dentry)) { hypfs_remove()
77 if (d_is_dir(dentry)) hypfs_remove()
78 simple_rmdir(d_inode(parent), dentry); hypfs_remove() local
80 simple_unlink(d_inode(parent), dentry); hypfs_remove() local
82 d_delete(dentry); hypfs_remove()
83 dput(dentry); hypfs_remove()
87 static void hypfs_delete_tree(struct dentry *root) hypfs_delete_tree()
90 struct dentry *next_dentry; hypfs_delete_tree()
263 static int hypfs_show_options(struct seq_file *s, struct dentry *root) hypfs_show_options()
275 struct dentry *root_dentry; hypfs_fill_super()
314 static struct dentry *hypfs_mount(struct file_system_type *fst, int flags, hypfs_mount()
333 static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, hypfs_create_file()
336 struct dentry *dentry; hypfs_create_file() local
340 dentry = lookup_one_len(name, parent, strlen(name)); hypfs_create_file()
341 if (IS_ERR(dentry)) { hypfs_create_file()
342 dentry = ERR_PTR(-ENOMEM); hypfs_create_file()
347 dput(dentry); hypfs_create_file()
348 dentry = ERR_PTR(-ENOMEM); hypfs_create_file()
364 d_instantiate(dentry, inode); hypfs_create_file()
365 dget(dentry); hypfs_create_file()
368 return dentry; hypfs_create_file()
371 struct dentry *hypfs_mkdir(struct dentry *parent, const char *name) hypfs_mkdir()
373 struct dentry *dentry; hypfs_mkdir() local
375 dentry = hypfs_create_file(parent, name, NULL, S_IFDIR | DIR_MODE); hypfs_mkdir()
376 if (IS_ERR(dentry)) hypfs_mkdir()
377 return dentry; hypfs_mkdir()
378 hypfs_add_dentry(dentry); hypfs_mkdir()
379 return dentry; hypfs_mkdir()
382 static struct dentry *hypfs_create_update_file(struct dentry *dir) hypfs_create_update_file()
384 struct dentry *dentry; hypfs_create_update_file() local
386 dentry = hypfs_create_file(dir, "update", NULL, hypfs_create_update_file()
393 return dentry; hypfs_create_update_file()
396 struct dentry *hypfs_create_u64(struct dentry *dir, hypfs_create_u64()
401 struct dentry *dentry; hypfs_create_u64() local
407 dentry = hypfs_create_u64()
409 if (IS_ERR(dentry)) { hypfs_create_u64()
413 hypfs_add_dentry(dentry); hypfs_create_u64()
414 return dentry; hypfs_create_u64()
417 struct dentry *hypfs_create_str(struct dentry *dir, hypfs_create_str()
421 struct dentry *dentry; hypfs_create_str() local
427 dentry = hypfs_create_str()
429 if (IS_ERR(dentry)) { hypfs_create_str()
433 hypfs_add_dentry(dentry); hypfs_create_str()
434 return dentry; hypfs_create_str()
H A Dhypfs_dbfs.c11 static struct dentry *dbfs_dir;
82 df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df, hypfs_dbfs_create_file()
84 if (IS_ERR(df->dentry)) hypfs_dbfs_create_file()
85 return PTR_ERR(df->dentry); hypfs_dbfs_create_file()
92 debugfs_remove(df->dentry); hypfs_dbfs_remove_file()
/linux-4.1.27/security/
H A Dinode.c28 static inline int positive(struct dentry *dentry) positive() argument
30 return d_really_is_positive(dentry) && !d_unhashed(dentry); positive()
40 static struct dentry *get_sb(struct file_system_type *fs_type, get_sb()
59 * @parent: a pointer to the parent dentry for this file. This should be a
60 * directory dentry if set. If this parameter is %NULL, then the
73 * This function returns a pointer to a dentry if it succeeds. This
82 struct dentry *securityfs_create_file(const char *name, umode_t mode, securityfs_create_file()
83 struct dentry *parent, void *data, securityfs_create_file()
86 struct dentry *dentry; securityfs_create_file() local
108 dentry = lookup_one_len(name, parent, strlen(name)); securityfs_create_file()
109 if (IS_ERR(dentry)) securityfs_create_file()
112 if (d_really_is_positive(dentry)) { securityfs_create_file()
135 d_instantiate(dentry, inode); securityfs_create_file()
136 dget(dentry); securityfs_create_file()
138 return dentry; securityfs_create_file()
141 dput(dentry); securityfs_create_file()
142 dentry = ERR_PTR(error); securityfs_create_file()
146 return dentry; securityfs_create_file()
155 * @parent: a pointer to the parent dentry for this file. This should be a
156 * directory dentry if set. If this parameter is %NULL, then the
161 * This function returns a pointer to a dentry if it succeeds. This
171 struct dentry *securityfs_create_dir(const char *name, struct dentry *parent) securityfs_create_dir()
182 * @dentry: a pointer to a the dentry of the file or directory to be removed.
192 void securityfs_remove(struct dentry *dentry) securityfs_remove() argument
194 struct dentry *parent; securityfs_remove()
196 if (!dentry || IS_ERR(dentry)) securityfs_remove()
199 parent = dentry->d_parent; securityfs_remove()
204 if (positive(dentry)) { securityfs_remove()
205 if (d_really_is_positive(dentry)) { securityfs_remove()
206 if (d_is_dir(dentry)) securityfs_remove()
207 simple_rmdir(d_inode(parent), dentry); securityfs_remove() local
209 simple_unlink(d_inode(parent), dentry); securityfs_remove() local
210 dput(dentry); securityfs_remove()
H A Dsecurity.c217 int security_quota_on(struct dentry *dentry) security_quota_on() argument
219 return security_ops->quota_on(dentry); security_quota_on()
298 int security_sb_statfs(struct dentry *dentry) security_sb_statfs() argument
300 return security_ops->sb_statfs(dentry); security_sb_statfs()
354 int security_dentry_init_security(struct dentry *dentry, int mode, security_dentry_init_security() argument
358 return security_ops->dentry_init_security(dentry, mode, name, security_dentry_init_security()
410 int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, security_path_mknod() argument
413 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) security_path_mknod()
415 return security_ops->path_mknod(dir, dentry, mode, dev); security_path_mknod()
419 int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) security_path_mkdir() argument
421 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) security_path_mkdir()
423 return security_ops->path_mkdir(dir, dentry, mode); security_path_mkdir()
427 int security_path_rmdir(struct path *dir, struct dentry *dentry) security_path_rmdir() argument
429 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) security_path_rmdir()
431 return security_ops->path_rmdir(dir, dentry); security_path_rmdir()
434 int security_path_unlink(struct path *dir, struct dentry *dentry) security_path_unlink() argument
436 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) security_path_unlink()
438 return security_ops->path_unlink(dir, dentry); security_path_unlink()
442 int security_path_symlink(struct path *dir, struct dentry *dentry, security_path_symlink() argument
445 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) security_path_symlink()
447 return security_ops->path_symlink(dir, dentry, old_name); security_path_symlink()
450 int security_path_link(struct dentry *old_dentry, struct path *new_dir, security_path_link()
451 struct dentry *new_dentry) security_path_link()
458 int security_path_rename(struct path *old_dir, struct dentry *old_dentry, security_path_rename()
459 struct path *new_dir, struct dentry *new_dentry, security_path_rename()
480 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) security_path_truncate()
487 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) security_path_chmod()
494 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) security_path_chown()
505 int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode) security_inode_create() argument
509 return security_ops->inode_create(dir, dentry, mode); security_inode_create()
513 int security_inode_link(struct dentry *old_dentry, struct inode *dir, security_inode_link()
514 struct dentry *new_dentry) security_inode_link()
521 int security_inode_unlink(struct inode *dir, struct dentry *dentry) security_inode_unlink() argument
523 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_unlink()
525 return security_ops->inode_unlink(dir, dentry); security_inode_unlink()
528 int security_inode_symlink(struct inode *dir, struct dentry *dentry, security_inode_symlink() argument
533 return security_ops->inode_symlink(dir, dentry, old_name); security_inode_symlink()
536 int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) security_inode_mkdir() argument
540 return security_ops->inode_mkdir(dir, dentry, mode); security_inode_mkdir()
544 int security_inode_rmdir(struct inode *dir, struct dentry *dentry) security_inode_rmdir() argument
546 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_rmdir()
548 return security_ops->inode_rmdir(dir, dentry); security_inode_rmdir()
551 int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) security_inode_mknod() argument
555 return security_ops->inode_mknod(dir, dentry, mode, dev); security_inode_mknod()
558 int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, security_inode_rename()
559 struct inode *new_dir, struct dentry *new_dentry, security_inode_rename()
577 int security_inode_readlink(struct dentry *dentry) security_inode_readlink() argument
579 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_readlink()
581 return security_ops->inode_readlink(dentry); security_inode_readlink()
584 int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) security_inode_follow_link() argument
586 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_follow_link()
588 return security_ops->inode_follow_link(dentry, nd); security_inode_follow_link()
598 int security_inode_setattr(struct dentry *dentry, struct iattr *attr) security_inode_setattr() argument
602 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_setattr()
604 ret = security_ops->inode_setattr(dentry, attr); security_inode_setattr()
607 return evm_inode_setattr(dentry, attr); security_inode_setattr()
613 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) security_inode_getattr()
618 int security_inode_setxattr(struct dentry *dentry, const char *name, security_inode_setxattr() argument
623 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_setxattr()
625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags); security_inode_setxattr()
628 ret = ima_inode_setxattr(dentry, name, value, size); security_inode_setxattr()
631 return evm_inode_setxattr(dentry, name, value, size); security_inode_setxattr()
634 void security_inode_post_setxattr(struct dentry *dentry, const char *name, security_inode_post_setxattr() argument
637 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_post_setxattr()
639 security_ops->inode_post_setxattr(dentry, name, value, size, flags); security_inode_post_setxattr()
640 evm_inode_post_setxattr(dentry, name, value, size); security_inode_post_setxattr()
643 int security_inode_getxattr(struct dentry *dentry, const char *name) security_inode_getxattr() argument
645 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_getxattr()
647 return security_ops->inode_getxattr(dentry, name); security_inode_getxattr()
650 int security_inode_listxattr(struct dentry *dentry) security_inode_listxattr() argument
652 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_listxattr()
654 return security_ops->inode_listxattr(dentry); security_inode_listxattr()
657 int security_inode_removexattr(struct dentry *dentry, const char *name) security_inode_removexattr() argument
661 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) security_inode_removexattr()
663 ret = security_ops->inode_removexattr(dentry, name); security_inode_removexattr()
666 ret = ima_inode_removexattr(dentry, name); security_inode_removexattr()
669 return evm_inode_removexattr(dentry, name); security_inode_removexattr()
672 int security_inode_need_killpriv(struct dentry *dentry) security_inode_need_killpriv() argument
674 return security_ops->inode_need_killpriv(dentry); security_inode_need_killpriv()
677 int security_inode_killpriv(struct dentry *dentry) security_inode_killpriv() argument
679 return security_ops->inode_killpriv(dentry); security_inode_killpriv()
1090 void security_d_instantiate(struct dentry *dentry, struct inode *inode) security_d_instantiate() argument
1094 security_ops->d_instantiate(dentry, inode); security_d_instantiate()
1143 int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) security_inode_setsecctx() argument
1145 return security_ops->inode_setsecctx(dentry, ctx, ctxlen); security_inode_setsecctx()
H A Dcapability.c48 static int cap_quota_on(struct dentry *dentry) cap_quota_on() argument
95 static int cap_sb_statfs(struct dentry *dentry) cap_sb_statfs() argument
138 static int cap_dentry_init_security(struct dentry *dentry, int mode, cap_dentry_init_security() argument
161 static int cap_inode_create(struct inode *inode, struct dentry *dentry, cap_inode_create() argument
167 static int cap_inode_link(struct dentry *old_dentry, struct inode *inode, cap_inode_link()
168 struct dentry *new_dentry) cap_inode_link()
173 static int cap_inode_unlink(struct inode *inode, struct dentry *dentry) cap_inode_unlink() argument
178 static int cap_inode_symlink(struct inode *inode, struct dentry *dentry, cap_inode_symlink() argument
184 static int cap_inode_mkdir(struct inode *inode, struct dentry *dentry, cap_inode_mkdir() argument
190 static int cap_inode_rmdir(struct inode *inode, struct dentry *dentry) cap_inode_rmdir() argument
195 static int cap_inode_mknod(struct inode *inode, struct dentry *dentry, cap_inode_mknod() argument
201 static int cap_inode_rename(struct inode *old_inode, struct dentry *old_dentry, cap_inode_rename()
202 struct inode *new_inode, struct dentry *new_dentry) cap_inode_rename()
207 static int cap_inode_readlink(struct dentry *dentry) cap_inode_readlink() argument
212 static int cap_inode_follow_link(struct dentry *dentry, cap_inode_follow_link() argument
223 static int cap_inode_setattr(struct dentry *dentry, struct iattr *iattr) cap_inode_setattr() argument
233 static void cap_inode_post_setxattr(struct dentry *dentry, const char *name, cap_inode_post_setxattr() argument
238 static int cap_inode_getxattr(struct dentry *dentry, const char *name) cap_inode_getxattr() argument
243 static int cap_inode_listxattr(struct dentry *dentry) cap_inode_listxattr() argument
272 static int cap_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, cap_path_mknod() argument
278 static int cap_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) cap_path_mkdir() argument
283 static int cap_path_rmdir(struct path *dir, struct dentry *dentry) cap_path_rmdir() argument
288 static int cap_path_unlink(struct path *dir, struct dentry *dentry) cap_path_unlink() argument
293 static int cap_path_symlink(struct path *dir, struct dentry *dentry, cap_path_symlink() argument
299 static int cap_path_link(struct dentry *old_dentry, struct path *new_dir, cap_path_link()
300 struct dentry *new_dentry) cap_path_link()
305 static int cap_path_rename(struct path *old_path, struct dentry *old_dentry, cap_path_rename()
306 struct path *new_path, struct dentry *new_dentry) cap_path_rename()
844 static void cap_d_instantiate(struct dentry *dentry, struct inode *inode) cap_d_instantiate() argument
884 static int cap_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) cap_inode_setsecctx() argument
/linux-4.1.27/drivers/base/
H A Ddevtmpfs.c57 static struct dentry *dev_mount(struct file_system_type *fs_type, int flags, dev_mount()
152 struct dentry *dentry; dev_mkdir() local
156 dentry = kern_path_create(AT_FDCWD, name, &path, LOOKUP_DIRECTORY); dev_mkdir()
157 if (IS_ERR(dentry)) dev_mkdir()
158 return PTR_ERR(dentry); dev_mkdir()
160 err = vfs_mkdir(d_inode(path.dentry), dentry, mode); dev_mkdir()
163 d_inode(dentry)->i_private = &thread; dev_mkdir()
164 done_path_create(&path, dentry); dev_mkdir()
198 struct dentry *dentry; handle_create() local
202 dentry = kern_path_create(AT_FDCWD, nodename, &path, 0); handle_create()
203 if (dentry == ERR_PTR(-ENOENT)) { handle_create()
205 dentry = kern_path_create(AT_FDCWD, nodename, &path, 0); handle_create()
207 if (IS_ERR(dentry)) handle_create()
208 return PTR_ERR(dentry); handle_create()
210 err = vfs_mknod(d_inode(path.dentry), dentry, mode, dev->devt); handle_create()
218 mutex_lock(&d_inode(dentry)->i_mutex); handle_create()
219 notify_change(dentry, &newattrs, NULL); handle_create()
220 mutex_unlock(&d_inode(dentry)->i_mutex); handle_create()
223 d_inode(dentry)->i_private = &thread; handle_create()
225 done_path_create(&path, dentry); handle_create()
232 struct dentry *dentry; dev_rmdir() local
235 dentry = kern_path_locked(name, &parent); dev_rmdir()
236 if (IS_ERR(dentry)) dev_rmdir()
237 return PTR_ERR(dentry); dev_rmdir()
238 if (d_really_is_positive(dentry)) { dev_rmdir()
239 if (d_inode(dentry)->i_private == &thread) dev_rmdir()
240 err = vfs_rmdir(d_inode(parent.dentry), dentry); dev_rmdir()
246 dput(dentry); dev_rmdir()
247 mutex_unlock(&d_inode(parent.dentry)->i_mutex); dev_rmdir()
301 struct dentry *dentry; handle_remove() local
305 dentry = kern_path_locked(nodename, &parent); handle_remove()
306 if (IS_ERR(dentry)) handle_remove()
307 return PTR_ERR(dentry); handle_remove()
309 if (d_really_is_positive(dentry)) { handle_remove()
311 struct path p = {.mnt = parent.mnt, .dentry = dentry}; handle_remove()
313 if (!err && dev_mynode(dev, d_inode(dentry), &stat)) { handle_remove()
324 mutex_lock(&d_inode(dentry)->i_mutex); handle_remove()
325 notify_change(dentry, &newattrs, NULL); handle_remove()
326 mutex_unlock(&d_inode(dentry)->i_mutex); handle_remove()
327 err = vfs_unlink(d_inode(parent.dentry), dentry, NULL); handle_remove()
334 dput(dentry); handle_remove()
335 mutex_unlock(&d_inode(parent.dentry)->i_mutex); handle_remove()
/linux-4.1.27/fs/ufs/
H A Dnamei.c37 static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) ufs_add_nondir() argument
39 int err = ufs_add_link(dentry, inode); ufs_add_nondir()
42 d_instantiate(dentry, inode); ufs_add_nondir()
51 static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) ufs_lookup() argument
56 if (dentry->d_name.len > UFS_MAXNAMLEN) ufs_lookup()
60 ino = ufs_inode_by_name(dir, &dentry->d_name); ufs_lookup()
64 return d_splice_alias(inode, dentry); ufs_lookup()
75 static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode, ufs_create() argument
92 err = ufs_add_nondir(dentry, inode); ufs_create()
99 static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) ufs_mknod() argument
114 err = ufs_add_nondir(dentry, inode); ufs_mknod()
120 static int ufs_symlink (struct inode * dir, struct dentry * dentry, ufs_symlink() argument
152 err = ufs_add_nondir(dentry, inode); ufs_symlink()
165 static int ufs_link (struct dentry * old_dentry, struct inode * dir, ufs_link() argument
166 struct dentry *dentry) ufs_link()
177 error = ufs_add_link(dentry, inode); ufs_link()
182 d_instantiate(dentry, inode); ufs_link()
187 static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ufs_mkdir() argument
210 err = ufs_add_link(dentry, inode); ufs_mkdir()
216 d_instantiate(dentry, inode); ufs_mkdir()
231 static int ufs_unlink(struct inode *dir, struct dentry *dentry) ufs_unlink() argument
233 struct inode * inode = d_inode(dentry); ufs_unlink()
238 de = ufs_find_entry(dir, &dentry->d_name, &page); ufs_unlink()
253 static int ufs_rmdir (struct inode * dir, struct dentry *dentry) ufs_rmdir() argument
255 struct inode * inode = d_inode(dentry); ufs_rmdir()
260 err = ufs_unlink(dir, dentry); ufs_rmdir()
271 static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, ufs_rename()
272 struct inode *new_dir, struct dentry *new_dentry) ufs_rename()
H A Dsymlink.c35 static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) ufs_follow_link() argument
37 struct ufs_inode_info *p = UFS_I(d_inode(dentry)); ufs_follow_link()
/linux-4.1.27/fs/exofs/
H A Dnamei.c36 static inline int exofs_add_nondir(struct dentry *dentry, struct inode *inode) exofs_add_nondir() argument
38 int err = exofs_add_link(dentry, inode); exofs_add_nondir()
40 d_instantiate(dentry, inode); exofs_add_nondir()
48 static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry, exofs_lookup() argument
54 if (dentry->d_name.len > EXOFS_NAME_LEN) exofs_lookup()
57 ino = exofs_inode_by_name(dir, dentry); exofs_lookup()
59 return d_splice_alias(inode, dentry); exofs_lookup()
62 static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode, exofs_create() argument
72 err = exofs_add_nondir(dentry, inode); exofs_create()
77 static int exofs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, exofs_mknod() argument
91 err = exofs_add_nondir(dentry, inode); exofs_mknod()
96 static int exofs_symlink(struct inode *dir, struct dentry *dentry, exofs_symlink() argument
131 err = exofs_add_nondir(dentry, inode); exofs_symlink()
141 static int exofs_link(struct dentry *old_dentry, struct inode *dir, exofs_link() argument
142 struct dentry *dentry) exofs_link()
150 return exofs_add_nondir(dentry, inode); exofs_link()
153 static int exofs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) exofs_mkdir() argument
175 err = exofs_add_link(dentry, inode); exofs_mkdir()
179 d_instantiate(dentry, inode); exofs_mkdir()
192 static int exofs_unlink(struct inode *dir, struct dentry *dentry) exofs_unlink() argument
194 struct inode *inode = d_inode(dentry); exofs_unlink()
199 de = exofs_find_entry(dir, dentry, &page); exofs_unlink()
214 static int exofs_rmdir(struct inode *dir, struct dentry *dentry) exofs_rmdir() argument
216 struct inode *inode = d_inode(dentry); exofs_rmdir()
220 err = exofs_unlink(dir, dentry); exofs_rmdir()
230 static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, exofs_rename()
231 struct inode *new_dir, struct dentry *new_dentry) exofs_rename()
/linux-4.1.27/include/linux/sunrpc/
H A Drpc_pipe_fs.h10 struct dentry *pdh_dentry;
22 int (*create)(struct dentry *dir,
24 void (*destroy)(struct dentry *dir,
56 struct dentry *dentry; member in struct:rpc_pipe
85 extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
97 extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
118 extern struct dentry *rpc_create_cache_dir(struct dentry *,
122 extern void rpc_remove_cache_dir(struct dentry *);
124 extern int rpc_rmdir(struct dentry *dentry);
128 extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
130 extern int rpc_unlink(struct dentry *);
/linux-4.1.27/fs/ncpfs/
H A Ddir.c33 static int ncp_create(struct inode *, struct dentry *, umode_t, bool);
34 static struct dentry *ncp_lookup(struct inode *, struct dentry *, unsigned int);
35 static int ncp_unlink(struct inode *, struct dentry *);
36 static int ncp_mkdir(struct inode *, struct dentry *, umode_t);
37 static int ncp_rmdir(struct inode *, struct dentry *);
38 static int ncp_rename(struct inode *, struct dentry *,
39 struct inode *, struct dentry *);
40 static int ncp_mknod(struct inode * dir, struct dentry *dentry,
43 extern int ncp_symlink(struct inode *, struct dentry *, const char *);
75 static int ncp_lookup_validate(struct dentry *, unsigned int);
76 static int ncp_hash_dentry(const struct dentry *, struct qstr *);
77 static int ncp_compare_dentry(const struct dentry *, const struct dentry *,
79 static int ncp_delete_dentry(const struct dentry *);
80 static void ncp_d_prune(struct dentry *dentry);
128 ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) ncp_hash_dentry() argument
130 struct inode *inode = d_inode_rcu(dentry); ncp_hash_dentry()
136 struct super_block *sb = dentry->d_sb; ncp_hash_dentry()
157 ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry, ncp_compare_dentry() argument
181 ncp_delete_dentry(const struct dentry * dentry) ncp_delete_dentry() argument
183 struct inode *inode = d_inode(dentry); ncp_delete_dentry()
217 ncp_force_unlink(struct inode *dir, struct dentry* dentry) ncp_force_unlink() argument
227 inode = d_inode(dentry); ncp_force_unlink()
236 res = ncp_del_file_or_subdir2(NCP_SERVER(dir), dentry); ncp_force_unlink()
252 ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_name, ncp_force_rename()
253 struct inode *new_dir, struct dentry* new_dentry, char *_new_name) ncp_force_rename()
311 ncp_lookup_validate(struct dentry *dentry, unsigned int flags) ncp_lookup_validate() argument
314 struct dentry *parent; ncp_lookup_validate()
320 if (dentry == dentry->d_sb->s_root) ncp_lookup_validate()
326 parent = dget_parent(dentry); ncp_lookup_validate()
329 if (d_really_is_negative(dentry)) ncp_lookup_validate()
336 * The default validation is based on dentry age: ncp_lookup_validate()
340 val = NCP_TEST_AGE(server, dentry); ncp_lookup_validate()
345 dentry, NCP_GET_AGE(dentry)); ncp_lookup_validate()
349 res = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_lookup_validate()
350 dentry->d_name.len, 1); ncp_lookup_validate()
357 res = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_lookup_validate()
358 dentry->d_name.len, !ncp_preserve_case(dir)); ncp_lookup_validate()
364 dentry->d_parent, __name, res); ncp_lookup_validate()
370 struct inode *inode = d_inode(dentry); ncp_lookup_validate()
374 ncp_new_dentry(dentry); ncp_lookup_validate()
389 static time_t ncp_obtain_mtime(struct dentry *dentry) ncp_obtain_mtime() argument
391 struct inode *inode = d_inode(dentry); ncp_obtain_mtime()
405 ncp_invalidate_dircache_entries(struct dentry *parent) ncp_invalidate_dircache_entries()
408 struct dentry *dentry; ncp_invalidate_dircache_entries() local
411 list_for_each_entry(dentry, &parent->d_subdirs, d_child) { ncp_invalidate_dircache_entries()
412 dentry->d_fsdata = NULL; ncp_invalidate_dircache_entries()
413 ncp_age_dentry(server, dentry); ncp_invalidate_dircache_entries()
420 struct dentry *dentry = file->f_path.dentry; ncp_readdir() local
421 struct inode *inode = d_inode(dentry); ncp_readdir()
457 mtime = ncp_obtain_mtime(dentry); ncp_readdir()
480 struct dentry *dent; ncp_readdir()
483 spin_lock(&dentry->d_lock); ncp_readdir()
485 spin_unlock(&dentry->d_lock); ncp_readdir()
488 dent = ctl.cache->dentry[ctl.idx]; ncp_readdir()
490 spin_unlock(&dentry->d_lock); ncp_readdir()
493 spin_unlock(&dentry->d_lock); ncp_readdir()
528 ncp_invalidate_dircache_entries(dentry); ncp_readdir()
530 mtime = ncp_obtain_mtime(dentry); ncp_readdir()
542 spin_lock(&dentry->d_lock); ncp_readdir()
544 spin_unlock(&dentry->d_lock); ncp_readdir()
570 static void ncp_d_prune(struct dentry *dentry) ncp_d_prune() argument
572 if (!dentry->d_fsdata) /* not referenced from page cache */ ncp_d_prune()
574 NCP_FINFO(d_inode(dentry->d_parent))->flags &= ~NCPI_DIR_CACHE; ncp_d_prune()
582 struct dentry *newdent, *dentry = file->f_path.dentry; ncp_fill_cache() local
583 struct inode *dir = d_inode(dentry); ncp_fill_cache()
599 newdent = d_hash_and_lookup(dentry, &qname); ncp_fill_cache()
603 newdent = d_alloc(dentry, &qname); ncp_fill_cache()
617 * insensitive. So we update dentry's name as received from ncp_fill_cache()
635 spin_lock(&dentry->d_lock); ncp_fill_cache()
637 spin_unlock(&dentry->d_lock); ncp_fill_cache()
664 ctl.cache->dentry[ctl.idx] = newdent; ncp_fill_cache()
792 struct dentry* dent; ncp_conn_logged_in()
830 static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) ncp_lookup() argument
842 ncp_vdbg("server lookup for %pd2\n", dentry); ncp_lookup()
846 res = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_lookup()
847 dentry->d_name.len, 1); ncp_lookup()
853 res = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_lookup()
854 dentry->d_name.len, !ncp_preserve_case(dir)); ncp_lookup()
858 ncp_vdbg("looked for %pd2, res=%d\n", dentry, res); ncp_lookup()
860 * If we didn't find an entry, make a negative dentry. ncp_lookup()
875 ncp_new_dentry(dentry); ncp_lookup()
877 d_add(dentry, inode); ncp_lookup()
889 static int ncp_instantiate(struct inode *dir, struct dentry *dentry, ncp_instantiate() argument
899 d_instantiate(dentry,inode); ncp_instantiate()
905 ncp_vdbg("%pd2 failed, closing file\n", dentry); ncp_instantiate()
910 int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode, ncp_create_new() argument
919 ncp_vdbg("creating %pd2, mode=%hx\n", dentry, mode); ncp_create_new()
921 ncp_age_dentry(server, dentry); ncp_create_new()
923 error = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_create_new()
924 dentry->d_name.len, !ncp_preserve_case(dir)); ncp_create_new()
948 ncp_dbg(1, "%pd2 failed\n", dentry); ncp_create_new()
963 error = ncp_instantiate(dir, dentry, &finfo); ncp_create_new()
968 static int ncp_create(struct inode *dir, struct dentry *dentry, umode_t mode, ncp_create() argument
971 return ncp_create_new(dir, dentry, mode, 0, 0); ncp_create()
974 static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ncp_mkdir() argument
981 ncp_dbg(1, "making %pd2\n", dentry); ncp_mkdir()
983 ncp_age_dentry(server, dentry); ncp_mkdir()
985 error = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_mkdir()
986 dentry->d_name.len, !ncp_preserve_case(dir)); ncp_mkdir()
1004 error = ncp_instantiate(dir, dentry, &finfo); ncp_mkdir()
1012 static int ncp_rmdir(struct inode *dir, struct dentry *dentry) ncp_rmdir() argument
1018 ncp_dbg(1, "removing %pd2\n", dentry); ncp_rmdir()
1021 error = ncp_io2vol(server, __name, &len, dentry->d_name.name, ncp_rmdir()
1022 dentry->d_name.len, !ncp_preserve_case(dir)); ncp_rmdir()
1056 static int ncp_unlink(struct inode *dir, struct dentry *dentry) ncp_unlink() argument
1058 struct inode *inode = d_inode(dentry); ncp_unlink()
1063 ncp_dbg(1, "unlinking %pd2\n", dentry); ncp_unlink()
1073 error = ncp_del_file_or_subdir2(server, dentry); ncp_unlink()
1078 error = ncp_force_unlink(dir, dentry); ncp_unlink()
1083 ncp_dbg(1, "removed %pd2\n", dentry); ncp_unlink()
1108 static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, ncp_rename()
1109 struct inode *new_dir, struct dentry *new_dentry) ncp_rename()
1163 static int ncp_mknod(struct inode * dir, struct dentry *dentry, ncp_mknod() argument
1170 return ncp_create_new(dir, dentry, mode, rdev, 0); ncp_mknod()
H A Dncplib_kernel.h81 int ncp_del_file_or_subdir2(struct ncp_server *, struct dentry*);
116 int ncp_create_new(struct inode *dir, struct dentry *dentry,
171 #define NCP_GET_AGE(dentry) (jiffies - (dentry)->d_time)
173 #define NCP_TEST_AGE(server,dentry) (NCP_GET_AGE(dentry) < NCP_MAX_AGE(server))
176 ncp_age_dentry(struct ncp_server* server, struct dentry* dentry) ncp_age_dentry() argument
178 dentry->d_time = jiffies - NCP_MAX_AGE(server); ncp_age_dentry()
182 ncp_new_dentry(struct dentry* dentry) ncp_new_dentry() argument
184 dentry->d_time = jiffies; ncp_new_dentry()
194 #define NCP_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *)))
197 struct dentry *dentry[NCP_DIRCACHE_SIZE]; member in union:ncp_dir_cache
201 sizeof(struct dentry *) - sizeof(struct ncp_cache_head)) / \
202 sizeof(struct dentry *)))
/linux-4.1.27/fs/afs/
H A Ddir.c22 static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
26 static int afs_d_revalidate(struct dentry *dentry, unsigned int flags);
27 static int afs_d_delete(const struct dentry *dentry);
28 static void afs_d_release(struct dentry *dentry);
31 static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
33 static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
34 static int afs_rmdir(struct inode *dir, struct dentry *dentry);
35 static int afs_unlink(struct inode *dir, struct dentry *dentry);
36 static int afs_link(struct dentry *from, struct inode *dir,
37 struct dentry *dentry);
38 static int afs_symlink(struct inode *dir, struct dentry *dentry,
40 static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
41 struct inode *new_dir, struct dentry *new_dentry);
424 * - just returns the FID the dentry name maps to if found
426 static int afs_do_lookup(struct inode *dir, struct dentry *dentry, afs_do_lookup() argument
432 .name = dentry->d_name, afs_do_lookup()
437 _enter("{%lu},%p{%pd},", dir->i_ino, dentry, dentry); afs_do_lookup()
462 int ret, struct dentry *dentry, struct inode *dir, struct key *key, afs_try_auto_mntpt()
465 const char *devname = dentry->d_name.name; afs_try_auto_mntpt()
470 ret, dentry, dentry, vnode->fid.vid, vnode->fid.vnode, key); afs_try_auto_mntpt()
494 static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, afs_lookup() argument
506 vnode->fid.vid, vnode->fid.vnode, dentry, dentry); afs_lookup()
508 ASSERTCMP(d_inode(dentry), ==, NULL); afs_lookup()
510 if (dentry->d_name.len >= AFSNAMEMAX) { afs_lookup()
533 ret = afs_do_lookup(dir, dentry, &fid, key); afs_lookup()
535 inode = afs_try_auto_mntpt(ret, dentry, dir, key, &fid); afs_lookup()
544 d_add(dentry, NULL); afs_lookup()
551 dentry->d_fsdata = (void *)(unsigned long) vnode->status.data_version; afs_lookup()
553 /* instantiate the dentry */ afs_lookup()
562 d_add(dentry, inode); afs_lookup()
566 d_inode(dentry)->i_ino, afs_lookup()
567 d_inode(dentry)->i_generation); afs_lookup()
573 * check that a dentry lookup hit has found a valid entry
577 static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) afs_d_revalidate() argument
581 struct dentry *parent; afs_d_revalidate()
589 vnode = AFS_FS_I(d_inode(dentry)); afs_d_revalidate()
591 if (d_really_is_positive(dentry)) afs_d_revalidate()
593 vnode->fid.vid, vnode->fid.vnode, dentry, afs_d_revalidate()
596 _enter("{neg n=%pd}", dentry); afs_d_revalidate()
598 key = afs_request_key(AFS_FS_S(dentry->d_sb)->volume->cell); afs_d_revalidate()
602 /* lock down the parent dentry so we can peer at it */ afs_d_revalidate()
603 parent = dget_parent(dentry); afs_d_revalidate()
611 _debug("%pd: parent dir deleted", dentry); afs_d_revalidate()
616 if (dentry->d_fsdata == dir_version) afs_d_revalidate()
622 ret = afs_do_lookup(&dir->vfs_inode, dentry, &fid, key); afs_d_revalidate()
626 if (d_really_is_negative(dentry)) afs_d_revalidate()
628 if (is_bad_inode(d_inode(dentry))) { afs_d_revalidate()
630 dentry); afs_d_revalidate()
638 dentry, fid.vnode, afs_d_revalidate()
648 dentry, fid.unique, afs_d_revalidate()
650 d_inode(dentry)->i_generation); afs_d_revalidate()
660 _debug("%pd: dirent not found", dentry); afs_d_revalidate()
661 if (d_really_is_positive(dentry)) afs_d_revalidate()
672 dentry->d_fsdata = dir_version; afs_d_revalidate()
680 spin_lock(&dentry->d_lock); afs_d_revalidate()
681 dentry->d_flags |= DCACHE_NFSFS_RENAMED; afs_d_revalidate()
682 spin_unlock(&dentry->d_lock); afs_d_revalidate()
685 _debug("dropping dentry %pd2", dentry); afs_d_revalidate()
694 * allow the VFS to enquire as to whether a dentry should be unhashed (mustn't
697 * - return 1 to request dentry be unhashed, 0 otherwise
699 static int afs_d_delete(const struct dentry *dentry) afs_d_delete() argument
701 _enter("%pd", dentry); afs_d_delete()
703 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) afs_d_delete()
706 if (d_really_is_positive(dentry) && afs_d_delete()
707 (test_bit(AFS_VNODE_DELETED, &AFS_FS_I(d_inode(dentry))->flags) || afs_d_delete()
708 test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(d_inode(dentry))->flags))) afs_d_delete()
720 * handle dentry release
722 static void afs_d_release(struct dentry *dentry) afs_d_release() argument
724 _enter("%pd", dentry); afs_d_release()
730 static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) afs_mkdir() argument
744 dvnode->fid.vid, dvnode->fid.vnode, dentry, mode); afs_mkdir()
753 ret = afs_vnode_create(dvnode, key, dentry->d_name.name, afs_mkdir()
774 d_instantiate(dentry, inode); afs_mkdir()
775 if (d_unhashed(dentry)) { afs_mkdir()
777 d_rehash(dentry); afs_mkdir()
788 d_drop(dentry); afs_mkdir()
796 static int afs_rmdir(struct inode *dir, struct dentry *dentry) afs_rmdir() argument
805 dvnode->fid.vid, dvnode->fid.vnode, dentry); afs_rmdir()
813 ret = afs_vnode_remove(dvnode, key, dentry->d_name.name, true); afs_rmdir()
817 if (d_really_is_positive(dentry)) { afs_rmdir()
818 vnode = AFS_FS_I(d_inode(dentry)); afs_rmdir()
838 static int afs_unlink(struct inode *dir, struct dentry *dentry) afs_unlink() argument
847 dvnode->fid.vid, dvnode->fid.vnode, dentry); afs_unlink()
850 if (dentry->d_name.len >= AFSNAMEMAX) afs_unlink()
859 if (d_really_is_positive(dentry)) { afs_unlink()
860 vnode = AFS_FS_I(d_inode(dentry)); afs_unlink()
868 ret = afs_vnode_remove(dvnode, key, dentry->d_name.name, false); afs_unlink()
872 if (d_really_is_positive(dentry)) { afs_unlink()
882 vnode = AFS_FS_I(d_inode(dentry)); afs_unlink()
906 static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, afs_create() argument
921 dvnode->fid.vid, dvnode->fid.vnode, dentry, mode); afs_create()
930 ret = afs_vnode_create(dvnode, key, dentry->d_name.name, afs_create()
951 d_instantiate(dentry, inode); afs_create()
952 if (d_unhashed(dentry)) { afs_create()
954 d_rehash(dentry); afs_create()
965 d_drop(dentry); afs_create()
973 static int afs_link(struct dentry *from, struct inode *dir, afs_link() argument
974 struct dentry *dentry) afs_link()
986 dentry); afs_link()
994 ret = afs_vnode_link(dvnode, vnode, key, dentry->d_name.name); afs_link()
999 d_instantiate(dentry, &vnode->vfs_inode); afs_link()
1007 d_drop(dentry); afs_link()
1015 static int afs_symlink(struct inode *dir, struct dentry *dentry, afs_symlink() argument
1029 dvnode->fid.vid, dvnode->fid.vnode, dentry, afs_symlink()
1042 ret = afs_vnode_symlink(dvnode, key, dentry->d_name.name, content, afs_symlink()
1063 d_instantiate(dentry, inode); afs_symlink()
1064 if (d_unhashed(dentry)) { afs_symlink()
1066 d_rehash(dentry); afs_symlink()
1077 d_drop(dentry); afs_symlink()
1085 static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, afs_rename()
1086 struct inode *new_dir, struct dentry *new_dentry) afs_rename()
461 afs_try_auto_mntpt( int ret, struct dentry *dentry, struct inode *dir, struct key *key, struct afs_fid *fid) afs_try_auto_mntpt() argument
/linux-4.1.27/security/integrity/ima/
H A Dima_appraise.c48 static int ima_fix_xattr(struct dentry *dentry, ima_fix_xattr() argument
62 rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_IMA, ima_fix_xattr()
165 int ima_read_xattr(struct dentry *dentry, ima_read_xattr() argument
168 struct inode *inode = d_backing_inode(dentry); ima_read_xattr()
173 return vfs_getxattr_alloc(dentry, XATTR_NAME_IMA, (char **)xattr_value, ima_read_xattr()
192 struct dentry *dentry = file->f_path.dentry; ima_appraise_measurement() local
193 struct inode *inode = d_backing_inode(dentry); ima_appraise_measurement()
213 status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint); ima_appraise_measurement()
275 if (!ima_fix_xattr(dentry, iint)) ima_appraise_measurement()
292 struct dentry *dentry = file->f_path.dentry; ima_update_xattr() local
303 ima_fix_xattr(dentry, iint); ima_update_xattr()
308 * @dentry: pointer to the affected dentry
310 * Changes to a dentry's metadata might result in needing to appraise.
315 void ima_inode_post_setattr(struct dentry *dentry) ima_inode_post_setattr() argument
317 struct inode *inode = d_backing_inode(dentry); ima_inode_post_setattr()
335 rc = inode->i_op->removexattr(dentry, XATTR_NAME_IMA); ima_inode_post_setattr()
344 static int ima_protect_xattr(struct dentry *dentry, const char *xattr_name, ima_protect_xattr() argument
372 int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, ima_inode_setxattr() argument
378 result = ima_protect_xattr(dentry, xattr_name, xattr_value, ima_inode_setxattr()
383 ima_reset_appraise_flags(d_backing_inode(dentry), ima_inode_setxattr()
390 int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name) ima_inode_removexattr() argument
394 result = ima_protect_xattr(dentry, xattr_name, NULL, 0); ima_inode_removexattr()
396 ima_reset_appraise_flags(d_backing_inode(dentry), 0); ima_inode_removexattr()
/linux-4.1.27/fs/efivarfs/
H A Dinode.c104 static int efivarfs_create(struct inode *dir, struct dentry *dentry, efivarfs_create() argument
112 if (!efivarfs_valid_name(dentry->d_name.name, dentry->d_name.len)) efivarfs_create()
120 namelen = dentry->d_name.len - EFI_VARIABLE_GUID_LEN - 1; efivarfs_create()
122 efivarfs_hex_to_guid(dentry->d_name.name + namelen + 1, efivarfs_create()
126 dentry->d_name.name, namelen)) efivarfs_create()
136 var->var.VariableName[i] = dentry->d_name.name[i]; efivarfs_create()
143 d_instantiate(dentry, inode); efivarfs_create()
144 dget(dentry); efivarfs_create()
154 static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) efivarfs_unlink() argument
156 struct efivar_entry *var = d_inode(dentry)->i_private; efivarfs_unlink()
161 drop_nlink(d_inode(dentry)); efivarfs_unlink()
162 dput(dentry); efivarfs_unlink()
H A Dsuper.c48 static int efivarfs_d_compare(const struct dentry *parent, efivarfs_d_compare() argument
49 const struct dentry *dentry, efivarfs_d_compare()
66 static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) efivarfs_d_hash() argument
92 static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) efivarfs_alloc_dentry()
94 struct dentry *d; efivarfs_alloc_dentry()
118 struct dentry *dentry, *root = sb->s_root; efivarfs_callback() local
155 dentry = efivarfs_alloc_dentry(root, name); efivarfs_callback()
156 if (IS_ERR(dentry)) { efivarfs_callback()
157 err = PTR_ERR(dentry); efivarfs_callback()
161 /* copied by the above to local storage in the dentry. */ efivarfs_callback()
171 d_add(dentry, inode); efivarfs_callback()
194 struct dentry *root; efivarfs_fill_super()
227 static struct dentry *efivarfs_mount(struct file_system_type *fs_type, efivarfs_mount()
/linux-4.1.27/drivers/staging/lustre/lustre/llite/
H A Ddcache.c59 static void ll_release(struct dentry *de) ll_release()
77 /* Compare if two dentries are the same. Don't match if the existing dentry
80 * This avoids a race where ll_lookup_it() instantiates a dentry, but we get
81 * an AST before calling d_revalidate_it(). The dentry still exists (marked
84 static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, ll_dcompare() argument
95 name->len, name->name, dentry, dentry->d_flags, ll_dcompare()
96 d_count(dentry)); ll_dcompare()
99 if (d_mountpoint((struct dentry *)dentry)) ll_dcompare()
102 if (d_lustre_invalid(dentry)) ll_dcompare()
144 * Called when last reference to a dentry is dropped and dcache wants to know
146 * - return 1 to delete the dentry immediately
147 * - return 0 to cache the dentry
150 static int ll_ddelete(const struct dentry *de) ll_ddelete()
154 CDEBUG(D_DENTRY, "%s dentry %pd (%p, parent %p, inode %p) %s%s\n", ll_ddelete()
155 d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping", ll_ddelete()
174 if (d_lustre_invalid((struct dentry *)de)) ll_ddelete()
179 int ll_d_init(struct dentry *de) ll_d_init()
183 CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n", ll_d_init()
252 struct dentry *dentry; ll_invalidate_aliases() local
261 ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) { ll_invalidate_aliases()
262 CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p flags %d\n", ll_invalidate_aliases()
263 dentry, dentry, dentry->d_parent, ll_invalidate_aliases()
264 d_inode(dentry), dentry->d_flags); ll_invalidate_aliases()
266 d_lustre_invalidate(dentry, 0); ll_invalidate_aliases()
309 static int ll_revalidate_dentry(struct dentry *dentry, ll_revalidate_dentry() argument
312 struct inode *dir = d_inode(dentry->d_parent); ll_revalidate_dentry()
326 if (d_need_statahead(dir, dentry) <= 0) ll_revalidate_dentry()
332 do_statahead_enter(dir, &dentry, d_inode(dentry) == NULL); ll_revalidate_dentry()
333 ll_statahead_mark(dir, dentry); ll_revalidate_dentry()
340 static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) ll_revalidate_nd() argument
343 dentry, flags); ll_revalidate_nd()
345 return ll_revalidate_dentry(dentry, flags); ll_revalidate_nd()
349 static void ll_d_iput(struct dentry *de, struct inode *inode) ll_d_iput()
H A Dnamei.c54 static int ll_create_it(struct inode *, struct dentry *,
146 struct dentry *dentry, *tmp_subdir; ll_invalidate_negative_children() local
150 ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) { ll_invalidate_negative_children()
151 spin_lock(&dentry->d_lock); ll_invalidate_negative_children()
152 if (!list_empty(&dentry->d_subdirs)) { ll_invalidate_negative_children()
153 struct dentry *child; ll_invalidate_negative_children()
156 &dentry->d_subdirs, ll_invalidate_negative_children()
162 spin_unlock(&dentry->d_lock); ll_invalidate_negative_children()
327 * try to reuse three types of dentry:
334 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) ll_find_alias() argument
336 struct dentry *alias, *discon_alias, *invalid_alias; ll_find_alias()
346 LASSERT(alias != dentry); ll_find_alias()
352 else if (alias->d_parent == dentry->d_parent && ll_find_alias()
353 alias->d_name.hash == dentry->d_name.hash && ll_find_alias()
354 alias->d_name.len == dentry->d_name.len && ll_find_alias()
355 memcmp(alias->d_name.name, dentry->d_name.name, ll_find_alias()
356 dentry->d_name.len) == 0) ll_find_alias()
378 struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) ll_splice_alias()
380 struct dentry *new; ll_splice_alias()
394 "Reuse dentry %p inode %p refc %d flags %#x\n", ll_splice_alias()
403 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n", ll_splice_alias()
410 struct inode *parent, struct dentry **de) ll_lookup_it_finish()
437 /* Only hash *de if it is unhashed (new dentry). ll_lookup_it_finish()
441 struct dentry *alias; ll_lookup_it_finish()
449 /* With DISP_OPEN_CREATE dentry will ll_lookup_it_finish()
456 /* we have lookup look - unhide dentry */ ll_lookup_it_finish()
479 static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, ll_lookup_it() argument
483 struct dentry *save = dentry, *retval; ll_lookup_it()
490 if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) ll_lookup_it()
494 dentry, parent->i_ino, ll_lookup_it()
497 if (d_mountpoint(dentry)) ll_lookup_it()
504 rc = ll_statahead_enter(parent, &dentry, 0); ll_lookup_it()
506 if (dentry == save) ll_lookup_it()
509 retval = dentry; ll_lookup_it()
519 op_data = ll_prep_md_op_data(NULL, parent, NULL, dentry->d_name.name, ll_lookup_it()
520 dentry->d_name.len, lookup_flags, opc, ll_lookup_it()
537 rc = ll_lookup_it_finish(req, it, parent, &dentry); ll_lookup_it()
544 inode = d_inode(dentry); ll_lookup_it()
552 if (dentry == save) ll_lookup_it()
555 retval = dentry; ll_lookup_it()
560 if (it->it_op == IT_GETATTR && (retval == NULL || retval == dentry)) ll_lookup_it()
561 ll_statahead_mark(parent, dentry); ll_lookup_it()
565 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, ll_lookup_nd() argument
569 struct dentry *de; ll_lookup_nd()
572 dentry, parent->i_ino, ll_lookup_nd()
583 de = ll_lookup_it(parent, dentry, itp, 0); ll_lookup_nd()
592 * For cached negative dentry and new dentry, handle lookup/create/open
595 static int ll_atomic_open(struct inode *dir, struct dentry *dentry, ll_atomic_open() argument
600 struct dentry *de; ll_atomic_open()
606 dentry, dir->i_ino, ll_atomic_open()
622 de = ll_lookup_it(dir, dentry, it, lookup_flags); ll_atomic_open()
626 dentry = de; ll_atomic_open()
631 rc = ll_create_it(dir, dentry, mode, it); ll_atomic_open()
641 if (d_really_is_positive(dentry) && it_disposition(it, DISP_OPEN_OPEN)) { ll_atomic_open()
642 /* Open dentry. */ ll_atomic_open()
643 if (S_ISFIFO(d_inode(dentry)->i_mode)) { ll_atomic_open()
654 rc = finish_open(file, dentry, NULL, opened); ll_atomic_open()
720 static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode, ll_create_it() argument
727 dentry, dir->i_ino, ll_create_it()
738 d_instantiate(dentry, inode); ll_create_it()
760 static int ll_new_node(struct inode *dir, struct dentry *dentry, ll_new_node() argument
775 dentry->d_name.name, ll_new_node()
776 dentry->d_name.len, ll_new_node()
797 d_instantiate(dentry, inode); ll_new_node()
804 static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_mknod()
844 static int ll_create_nd(struct inode *dir, struct dentry *dentry, ll_create_nd() argument
850 dentry, dir->i_ino, ll_create_nd()
853 rc = ll_mknod(dir, dentry, mode, 0); ll_create_nd()
858 dentry, d_unhashed(dentry)); ll_create_nd()
863 static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) ll_get_child_fid()
979 static int ll_unlink(struct inode *dir, struct dentry *dentry) ll_unlink() argument
986 dentry, dir->i_ino, dir->i_generation, dir); ll_unlink()
989 dentry->d_name.name, ll_unlink()
990 dentry->d_name.len, ll_unlink()
995 ll_get_child_fid(dentry, &op_data->op_fid3); ll_unlink()
1011 static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) ll_mkdir() argument
1016 dentry, dir->i_ino, dir->i_generation, dir); ll_mkdir()
1021 err = ll_new_node(dir, dentry, NULL, mode, 0, LUSTRE_OPC_MKDIR); ll_mkdir()
1029 static int ll_rmdir(struct inode *dir, struct dentry *dentry) ll_rmdir() argument
1036 dentry, dir->i_ino, dir->i_generation, dir); ll_rmdir()
1039 dentry->d_name.name, ll_rmdir()
1040 dentry->d_name.len, ll_rmdir()
1045 ll_get_child_fid(dentry, &op_data->op_fid3); ll_rmdir()
1058 static int ll_symlink(struct inode *dir, struct dentry *dentry, ll_symlink() argument
1064 dentry, dir->i_ino, dir->i_generation, ll_symlink()
1067 err = ll_new_node(dir, dentry, oldname, S_IFLNK | S_IRWXUGO, ll_symlink()
1076 static int ll_link(struct dentry *old_dentry, struct inode *dir, ll_link()
1077 struct dentry *new_dentry) ll_link()
1108 static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, ll_rename()
1109 struct inode *new_dir, struct dentry *new_dentry) ll_rename()
/linux-4.1.27/fs/efs/
H A Dnamei.c64 struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) efs_lookup() argument
69 inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len); efs_lookup()
73 return d_splice_alias(inode, dentry); efs_lookup()
95 struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid, efs_fh_to_dentry()
102 struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid, efs_fh_to_parent()
109 struct dentry *efs_get_parent(struct dentry *child) efs_get_parent()
111 struct dentry *parent = ERR_PTR(-ENOENT); efs_get_parent()
/linux-4.1.27/drivers/oprofile/
H A Doprofile_stats.h28 struct dentry;
31 void oprofile_create_stats_files(struct dentry *root);
H A Doprofilefs.c135 static int __oprofilefs_create_file(struct dentry *root, char const *name, __oprofilefs_create_file()
138 struct dentry *dentry; __oprofilefs_create_file() local
142 dentry = d_alloc_name(root, name); __oprofilefs_create_file()
143 if (!dentry) { __oprofilefs_create_file()
149 dput(dentry); __oprofilefs_create_file()
155 d_add(dentry, inode); __oprofilefs_create_file()
161 int oprofilefs_create_ulong(struct dentry *root, oprofilefs_create_ulong()
169 int oprofilefs_create_ro_ulong(struct dentry *root, oprofilefs_create_ro_ulong()
191 int oprofilefs_create_ro_atomic(struct dentry *root, oprofilefs_create_ro_atomic()
199 int oprofilefs_create_file(struct dentry *root, oprofilefs_create_file()
206 int oprofilefs_create_file_perm(struct dentry *root, oprofilefs_create_file_perm()
213 struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name) oprofilefs_mkdir()
215 struct dentry *dentry; oprofilefs_mkdir() local
219 dentry = d_alloc_name(parent, name); oprofilefs_mkdir()
220 if (!dentry) { oprofilefs_mkdir()
226 dput(dentry); oprofilefs_mkdir()
232 d_add(dentry, inode); oprofilefs_mkdir()
234 return dentry; oprofilefs_mkdir()
264 static struct dentry *oprofilefs_mount(struct file_system_type *fs_type, oprofilefs_mount()
/linux-4.1.27/security/tomoyo/
H A Drealpath.c82 * tomoyo_get_absolute_path - Get the path of a dentry but ignores chroot'ed root.
90 * If dentry is a directory, trailing '/' is appended.
100 struct inode *inode = d_backing_inode(path->dentry); tomoyo_get_absolute_path()
111 * tomoyo_get_dentry_path - Get the path of a dentry.
113 * @dentry: Pointer to "struct dentry".
119 * If dentry is a directory, trailing '/' is appended.
121 static char *tomoyo_get_dentry_path(struct dentry *dentry, char * const buffer, tomoyo_get_dentry_path() argument
126 pos = dentry_path_raw(dentry, buffer, buflen - 1); tomoyo_get_dentry_path()
128 struct inode *inode = d_backing_inode(dentry); tomoyo_get_dentry_path()
139 * tomoyo_get_local_path - Get the path of a dentry.
141 * @dentry: Pointer to "struct dentry".
147 static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, tomoyo_get_local_path() argument
150 struct super_block *sb = dentry->d_sb; tomoyo_get_local_path()
151 char *pos = tomoyo_get_dentry_path(dentry, buffer, buflen); tomoyo_get_local_path()
222 struct inode *inode = d_backing_inode(path->dentry); tomoyo_get_socket_name()
242 * If dentry is a directory, trailing '/' is appended.
255 struct dentry *dentry = path->dentry; tomoyo_realpath_from_path() local
257 if (!dentry) tomoyo_realpath_from_path()
259 sb = dentry->d_sb; tomoyo_realpath_from_path()
276 if (dentry->d_op && dentry->d_op->d_dname) { tomoyo_realpath_from_path()
277 pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1); tomoyo_realpath_from_path()
283 * or dentry without vfsmount. tomoyo_realpath_from_path()
287 pos = tomoyo_get_local_path(path->dentry, buf, tomoyo_realpath_from_path()
297 pos = tomoyo_get_local_path(path->dentry, buf, tomoyo_realpath_from_path()
H A Dtomoyo.c143 * @dentry: Pointer to "struct dentry".
168 * @dentry: Pointer to "struct dentry".
172 static int tomoyo_path_unlink(struct path *parent, struct dentry *dentry) tomoyo_path_unlink() argument
174 struct path path = { parent->mnt, dentry }; tomoyo_path_unlink()
182 * @dentry: Pointer to "struct dentry".
187 static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry, tomoyo_path_mkdir() argument
190 struct path path = { parent->mnt, dentry }; tomoyo_path_mkdir()
199 * @dentry: Pointer to "struct dentry".
203 static int tomoyo_path_rmdir(struct path *parent, struct dentry *dentry) tomoyo_path_rmdir() argument
205 struct path path = { parent->mnt, dentry }; tomoyo_path_rmdir()
213 * @dentry: Pointer to "struct dentry".
218 static int tomoyo_path_symlink(struct path *parent, struct dentry *dentry, tomoyo_path_symlink() argument
221 struct path path = { parent->mnt, dentry }; tomoyo_path_symlink()
229 * @dentry: Pointer to "struct dentry".
235 static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry, tomoyo_path_mknod() argument
238 struct path path = { parent->mnt, dentry }; tomoyo_path_mknod()
268 * @old_dentry: Pointer to "struct dentry".
270 * @new_dentry: Pointer to "struct dentry".
274 static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir, tomoyo_path_link()
275 struct dentry *new_dentry) tomoyo_path_link()
286 * @old_dentry: Pointer to "struct dentry".
288 * @new_dentry: Pointer to "struct dentry".
293 struct dentry *old_dentry, tomoyo_path_rename()
295 struct dentry *new_dentry) tomoyo_path_rename()
/linux-4.1.27/fs/nfsd/
H A Dnfsfh.c26 static int nfsd_acceptable(void *expv, struct dentry *dentry) nfsd_acceptable() argument
30 struct dentry *tdentry; nfsd_acceptable()
31 struct dentry *parent; nfsd_acceptable()
36 tdentry = dget(dentry); nfsd_acceptable()
37 while (tdentry != exp->ex_path.dentry && !IS_ROOT(tdentry)) { nfsd_acceptable()
49 if (tdentry != exp->ex_path.dentry) nfsd_acceptable()
51 rv = (tdentry == exp->ex_path.dentry); nfsd_acceptable()
101 struct dentry *dentry, struct svc_export *exp) check_pseudo_root()
117 if (unlikely(!d_is_dir(dentry) && check_pseudo_root()
118 !d_is_symlink(dentry))) check_pseudo_root()
125 if (unlikely(dentry != exp->ex_path.dentry)) check_pseudo_root()
132 * dentry. On success, the results are used to set fh_export and
140 struct dentry *dentry; nfsd_set_fh_dentry() local
205 * to reconnect a directory into the dentry cache. nfsd_set_fh_dentry()
228 * Look up the dentry using the NFS file handle. nfsd_set_fh_dentry()
248 dentry = dget(exp->ex_path.dentry); nfsd_set_fh_dentry()
250 dentry = exportfs_decode_fh(exp->ex_path.mnt, fid, nfsd_set_fh_dentry()
254 if (dentry == NULL) nfsd_set_fh_dentry()
256 if (IS_ERR(dentry)) { nfsd_set_fh_dentry()
257 if (PTR_ERR(dentry) != -EINVAL) nfsd_set_fh_dentry()
258 error = nfserrno(PTR_ERR(dentry)); nfsd_set_fh_dentry()
262 if (d_is_dir(dentry) && nfsd_set_fh_dentry()
263 (dentry->d_flags & DCACHE_DISCONNECTED)) { nfsd_set_fh_dentry()
265 dentry); nfsd_set_fh_dentry()
268 fhp->fh_dentry = dentry; nfsd_set_fh_dentry()
283 * Look up a dentry from the on-the-wire filehandle, check the client's
291 * up a dentry using the on-the-wire filehandle. Subsequent calls will
307 struct dentry *dentry; fh_verify() local
317 dentry = fhp->fh_dentry; fh_verify()
327 * in by fh_compose, and given a dentry, but further fh_verify()
335 error = check_pseudo_root(rqstp, dentry, exp); fh_verify()
343 error = nfsd_mode_check(rqstp, d_inode(dentry)->i_mode, type); fh_verify()
360 && exp->ex_path.dentry == dentry) fh_verify()
369 error = nfsd_permission(rqstp, exp, dentry, access); fh_verify()
374 dentry, fh_verify()
387 * Note that when first composed, the dentry may not yet have
392 struct dentry *dentry) _fh_update()
394 if (dentry != exp->ex_path.dentry) { _fh_update()
401 exportfs_encode_fh(dentry, fid, &maxsize, subtreecheck); _fh_update()
411 static inline void _fh_update_old(struct dentry *dentry, _fh_update_old() argument
415 fh->ofh_ino = ino_t_to_u32(d_inode(dentry)->i_ino); _fh_update_old()
416 fh->ofh_generation = d_inode(dentry)->i_generation; _fh_update_old()
417 if (d_is_dir(dentry) || _fh_update_old()
424 return exp->ex_path.dentry == exp->ex_path.dentry->d_sb->s_root; is_root_export()
429 return d_inode(exp->ex_path.dentry)->i_sb; exp_sb()
512 fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, fh_compose() argument
523 struct inode * inode = d_inode(dentry); fh_compose()
528 (long) d_inode(exp->ex_path.dentry)->i_ino, fh_compose()
529 dentry, fh_compose()
543 dentry); fh_compose()
548 dentry); fh_compose()
550 fhp->fh_dentry = dget(dentry); /* our internal copy */ fh_compose()
561 ino_t_to_u32(d_inode(exp->ex_path.dentry)->i_ino); fh_compose()
562 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); fh_compose()
564 _fh_update_old(dentry, exp, &fhp->fh_handle); fh_compose()
573 d_inode(exp->ex_path.dentry)->i_ino, fh_compose()
577 _fh_update(fhp, exp, dentry); fh_compose()
588 * Update file handle information after changing a dentry.
594 struct dentry *dentry; fh_update() local
599 dentry = fhp->fh_dentry; fh_update()
600 if (d_really_is_negative(dentry)) fh_update()
603 _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); fh_update()
608 _fh_update(fhp, fhp->fh_export, dentry); fh_update()
618 dentry); fh_update()
628 struct dentry * dentry = fhp->fh_dentry; fh_put() local
630 if (dentry) { fh_put()
633 dput(dentry); fh_put()
100 check_pseudo_root(struct svc_rqst *rqstp, struct dentry *dentry, struct svc_export *exp) check_pseudo_root() argument
391 _fh_update(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry) _fh_update() argument
H A Dnfs4recover.c171 struct dentry *dir, *dentry; nfsd4_create_clid_dir() local
193 dir = nn->rec_file->f_path.dentry; nfsd4_create_clid_dir()
197 dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); nfsd4_create_clid_dir()
198 if (IS_ERR(dentry)) { nfsd4_create_clid_dir()
199 status = PTR_ERR(dentry); nfsd4_create_clid_dir()
202 if (d_really_is_positive(dentry)) nfsd4_create_clid_dir()
212 status = vfs_mkdir(d_inode(dir), dentry, S_IRWXU); nfsd4_create_clid_dir()
214 dput(dentry); nfsd4_create_clid_dir()
235 typedef int (recdir_func)(struct dentry *, struct dentry *, struct nfsd_net *);
270 struct dentry *dir = nn->rec_file->f_path.dentry; nfsd4_list_rec_dir()
293 struct dentry *dentry; nfsd4_list_rec_dir() local
294 dentry = lookup_one_len(entry->name, dir, HEXDIR_LEN-1); nfsd4_list_rec_dir()
295 if (IS_ERR(dentry)) { nfsd4_list_rec_dir()
296 status = PTR_ERR(dentry); nfsd4_list_rec_dir()
299 status = f(dir, dentry, nn); nfsd4_list_rec_dir()
300 dput(dentry); nfsd4_list_rec_dir()
313 struct dentry *dir, *dentry; nfsd4_unlink_clid_dir() local
318 dir = nn->rec_file->f_path.dentry; nfsd4_unlink_clid_dir()
320 dentry = lookup_one_len(name, dir, namlen); nfsd4_unlink_clid_dir()
321 if (IS_ERR(dentry)) { nfsd4_unlink_clid_dir()
322 status = PTR_ERR(dentry); nfsd4_unlink_clid_dir()
326 if (d_really_is_negative(dentry)) nfsd4_unlink_clid_dir()
328 status = vfs_rmdir(d_inode(dir), dentry); nfsd4_unlink_clid_dir()
330 dput(dentry); nfsd4_unlink_clid_dir()
381 purge_old(struct dentry *parent, struct dentry *child, struct nfsd_net *nn) purge_old()
419 load_recdir(struct dentry *parent, struct dentry *child, struct nfsd_net *nn) load_recdir()
586 if (d_is_dir(path.dentry)) { nfs4_reset_recoverydir()
769 static struct dentry * nfsd4_cld_register_sb()
772 struct dentry *dir, *dentry; nfsd4_cld_register_sb() local
777 dentry = rpc_mkpipe_dentry(dir, NFSD_CLD_PIPE, NULL, pipe); nfsd4_cld_register_sb()
779 return dentry; nfsd4_cld_register_sb()
785 if (pipe->dentry) nfsd4_cld_unregister_sb()
786 rpc_unlink(pipe->dentry); nfsd4_cld_unregister_sb()
789 static struct dentry * nfsd4_cld_register_net()
793 struct dentry *dentry; nfsd4_cld_register_net() local
798 dentry = nfsd4_cld_register_sb(sb, pipe); nfsd4_cld_register_net()
800 return dentry; nfsd4_cld_register_net()
820 struct dentry *dentry; nfsd4_init_cld_pipe() local
841 dentry = nfsd4_cld_register_net(net, cn->cn_pipe); nfsd4_init_cld_pipe()
842 if (IS_ERR(dentry)) { nfsd4_init_cld_pipe()
843 ret = PTR_ERR(dentry); nfsd4_init_cld_pipe()
847 cn->cn_pipe->dentry = dentry; nfsd4_init_cld_pipe()
1429 status = d_is_dir(path.dentry); nfsd4_client_tracking_init()
1505 struct dentry *dentry; rpc_pipefs_event() local
1518 dentry = nfsd4_cld_register_sb(sb, cn->cn_pipe); rpc_pipefs_event()
1519 if (IS_ERR(dentry)) { rpc_pipefs_event()
1520 ret = PTR_ERR(dentry); rpc_pipefs_event()
1523 cn->cn_pipe->dentry = dentry; rpc_pipefs_event()
1526 if (cn->cn_pipe->dentry) rpc_pipefs_event()
H A Dvfs.c6 * Note that several functions dget() the dentry upon which they want
8 * dentry's are dput()'d if necessary in the release callback.
10 * dentry, don't worry--they have been taken care of.
83 nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, nfsd_cross_mnt()
87 struct dentry *dentry = *dpp; nfsd_cross_mnt() local
89 .dentry = dget(dentry)}; nfsd_cross_mnt()
115 * This is subtle: path.dentry is *not* on path.mnt nfsd_cross_mnt()
120 *dpp = path.dentry; nfsd_cross_mnt()
121 path.dentry = dentry; nfsd_cross_mnt()
133 struct dentry *dp; follow_to_parent()
135 while (path->dentry == path->mnt->mnt_root && follow_up(path)) follow_to_parent()
137 dp = dget_parent(path->dentry); follow_to_parent()
138 dput(path->dentry); follow_to_parent()
139 path->dentry = dp; follow_to_parent()
142 static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, struct svc_export **exp, struct dentry **dentryp) nfsd_lookup_parent()
146 .dentry = dget(dparent)}; nfsd_lookup_parent()
157 *dentryp = dget(path.dentry); nfsd_lookup_parent()
169 int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) nfsd_mountpoint() argument
171 if (d_mountpoint(dentry)) nfsd_mountpoint()
173 if (nfsd4_is_junction(dentry)) nfsd_mountpoint()
177 return d_inode(dentry) != NULL; nfsd_mountpoint()
183 struct svc_export **exp_ret, struct dentry **dentry_ret) nfsd_lookup_dentry()
186 struct dentry *dparent; nfsd_lookup_dentry()
187 struct dentry *dentry; nfsd_lookup_dentry() local
198 dentry = dget(dparent); nfsd_lookup_dentry()
199 else if (dparent != exp->ex_path.dentry) nfsd_lookup_dentry()
200 dentry = dget_parent(dparent); nfsd_lookup_dentry()
202 dentry = dget(dparent); /* .. == . just like at / */ nfsd_lookup_dentry()
205 host_err = nfsd_lookup_parent(rqstp, dparent, &exp, &dentry); nfsd_lookup_dentry()
216 dentry = lookup_one_len(name, dparent, len); nfsd_lookup_dentry()
217 host_err = PTR_ERR(dentry); nfsd_lookup_dentry()
218 if (IS_ERR(dentry)) nfsd_lookup_dentry()
223 if (nfsd_mountpoint(dentry, exp)) { nfsd_lookup_dentry()
224 if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { nfsd_lookup_dentry()
225 dput(dentry); nfsd_lookup_dentry()
230 *dentry_ret = dentry; nfsd_lookup_dentry()
256 struct dentry *dentry; nfsd_lookup() local
262 err = nfsd_lookup_dentry(rqstp, fhp, name, len, &exp, &dentry); nfsd_lookup()
270 * dentry may be negative, it may need to be updated. nfsd_lookup()
272 err = fh_compose(resfh, exp, dentry, fhp); nfsd_lookup()
273 if (!err && d_really_is_negative(dentry)) nfsd_lookup()
276 dput(dentry); nfsd_lookup()
401 struct dentry *dentry; nfsd_setattr() local
428 dentry = fhp->fh_dentry; nfsd_setattr()
429 inode = d_inode(dentry); nfsd_setattr()
469 host_err = notify_change(dentry, iap, NULL); nfsd_setattr()
491 * @dentry: object to test
493 * Returns 1 if "dentry" appears to contain NFS junction information.
496 int nfsd4_is_junction(struct dentry *dentry) nfsd4_is_junction() argument
498 struct inode *inode = d_inode(dentry); nfsd4_is_junction()
506 if (vfs_getxattr(dentry, NFSD_JUNCTION_XATTR_NAME, NULL, 0) <= 0) nfsd4_is_junction()
516 struct dentry *dentry; nfsd4_set_nfs4_label() local
522 dentry = fhp->fh_dentry; nfsd4_set_nfs4_label()
524 mutex_lock(&d_inode(dentry)->i_mutex); nfsd4_set_nfs4_label()
525 host_error = security_inode_setsecctx(dentry, label->data, label->len); nfsd4_set_nfs4_label()
526 mutex_unlock(&d_inode(dentry)->i_mutex); nfsd4_set_nfs4_label()
607 struct dentry *dentry; nfsd_access() local
616 dentry = fhp->fh_dentry; nfsd_access()
618 if (d_is_reg(dentry)) nfsd_access()
620 else if (d_is_dir(dentry)) nfsd_access()
633 err2 = nfsd_permission(rqstp, export, dentry, map->how); nfsd_access()
708 path.dentry = fhp->fh_dentry; nfsd_open()
709 inode = d_inode(path.dentry); nfsd_open()
1196 struct dentry *dentry, *dchild = NULL; nfsd_create() local
1213 dentry = fhp->fh_dentry; nfsd_create()
1214 dirp = d_inode(dentry); nfsd_create()
1230 dchild = lookup_one_len(fname, dentry, flen); nfsd_create()
1244 dentry); nfsd_create()
1250 * Make sure the child dentry is still negative ... nfsd_create()
1254 dprintk("nfsd_create: dentry %pd/%pd not negative!\n", nfsd_create()
1255 dentry, dchild); nfsd_create()
1337 struct dentry *dentry, *dchild = NULL; do_nfsd_create() local
1355 dentry = fhp->fh_dentry; do_nfsd_create()
1356 dirp = d_inode(dentry); do_nfsd_create()
1373 dchild = lookup_one_len(fname, dentry, flen); do_nfsd_create()
1515 path.dentry = fhp->fh_dentry; nfsd_readlink()
1516 inode = d_inode(path.dentry); nfsd_readlink()
1528 host_err = inode->i_op->readlink(path.dentry, (char __user *)buf, *lenp); nfsd_readlink()
1553 struct dentry *dentry, *dnew; nfsd_symlink() local
1573 dentry = fhp->fh_dentry; nfsd_symlink()
1574 dnew = lookup_one_len(fname, dentry, flen); nfsd_symlink()
1579 host_err = vfs_symlink(d_inode(dentry), dnew, path); nfsd_symlink()
1606 struct dentry *ddir, *dnew, *dold; nfsd_link()
1679 struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap; nfsd_rename()
1737 if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) nfsd_rename()
1775 struct dentry *dentry, *rdentry; nfsd_unlink() local
1792 dentry = fhp->fh_dentry; nfsd_unlink()
1793 dirp = d_inode(dentry); nfsd_unlink()
1795 rdentry = lookup_one_len(fname, dentry, flen); nfsd_unlink()
1998 .dentry = fhp->fh_dentry, nfsd_statfs()
2016 struct dentry *dentry, int acc) nfsd_permission()
2018 struct inode *inode = d_inode(dentry); nfsd_permission()
2015 nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, struct dentry *dentry, int acc) nfsd_permission() argument
/linux-4.1.27/fs/logfs/
H A Ddir.c21 * 2. allocate dentry (clear journal)
30 * 1. remove dentry (remember inode in journal)
38 * A "target rename" where the target dentry already existed, a "local
42 * Local rename is atomic, as the old dentry is simply rewritten with a new
47 * 1. Write new dentry (remember old dentry in journal)
48 * 2. Remove old dentry (clear journal)
50 * Here we remember a dentry instead of an inode. On next mount, if we were
51 * interrupted, we delete the dentry. From a users point of view, the
55 * 1. Attach old inode to new dentry (remember old dentry and new inode)
56 * 2. Remove old dentry (still remember the new inode)
59 * Here we remember both an inode an a dentry. If we get interrupted
60 * between steps 1 and 2, we delete both the dentry and the inode. If
157 static struct page *logfs_get_dd_page(struct inode *dir, struct dentry *dentry) logfs_get_dd_page() argument
159 struct qstr *name = &dentry->d_name; logfs_get_dd_page()
213 static int logfs_unlink(struct inode *dir, struct dentry *dentry) logfs_unlink() argument
216 struct inode *inode = d_inode(dentry); logfs_unlink()
231 page = logfs_get_dd_page(dir, dentry); logfs_unlink()
272 static int logfs_rmdir(struct inode *dir, struct dentry *dentry) logfs_rmdir() argument
274 struct inode *inode = d_inode(dentry); logfs_rmdir()
279 return logfs_unlink(dir, dentry); logfs_rmdir()
304 /* deleted dentry */ logfs_readdir()
332 static struct dentry *logfs_lookup(struct inode *dir, struct dentry *dentry, logfs_lookup() argument
341 page = logfs_get_dd_page(dir, dentry); logfs_lookup()
345 d_add(dentry, NULL); logfs_lookup()
356 printk(KERN_ERR"LogFS: Cannot read inode #%llx for dentry (%lx, %lx)n", logfs_lookup()
358 return d_splice_alias(inode, dentry); logfs_lookup()
368 static int logfs_write_dir(struct inode *dir, struct dentry *dentry, logfs_write_dir() argument
373 u32 hash = hash_32(dentry->d_name.name, dentry->d_name.len, 0); logfs_write_dir()
390 logfs_set_name(dd, &dentry->d_name); logfs_write_dir()
407 static int __logfs_create(struct inode *dir, struct dentry *dentry, __logfs_create() argument
447 ret = logfs_write_dir(dir, dentry, inode); __logfs_create()
460 d_instantiate(dentry, inode); __logfs_create()
466 static int logfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) logfs_mkdir() argument
482 return __logfs_create(dir, dentry, inode, NULL, 0); logfs_mkdir()
485 static int logfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, logfs_create() argument
498 return __logfs_create(dir, dentry, inode, NULL, 0); logfs_create()
501 static int logfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, logfs_mknod() argument
506 if (dentry->d_name.len > LOGFS_MAX_NAMELEN) logfs_mknod()
515 return __logfs_create(dir, dentry, inode, NULL, 0); logfs_mknod()
518 static int logfs_symlink(struct inode *dir, struct dentry *dentry, logfs_symlink() argument
534 return __logfs_create(dir, dentry, inode, target, destlen); logfs_symlink()
537 static int logfs_link(struct dentry *old_dentry, struct inode *dir, logfs_link() argument
538 struct dentry *dentry) logfs_link()
547 return __logfs_create(dir, dentry, inode, NULL, 0); logfs_link()
550 static int logfs_get_dd(struct inode *dir, struct dentry *dentry, logfs_get_dd() argument
556 page = logfs_get_dd_page(dir, dentry); logfs_get_dd()
576 log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos); logfs_delete_dd()
582 * Create a new dentry in the target dir, then remove the old dentry,
585 static int logfs_rename_cross(struct inode *old_dir, struct dentry *old_dentry, logfs_rename_cross()
586 struct inode *new_dir, struct dentry *new_dentry) logfs_rename_cross()
633 static int logfs_replace_inode(struct inode *dir, struct dentry *dentry, logfs_replace_inode() argument
639 err = logfs_get_dd(dir, dentry, dd, &pos); logfs_replace_inode()
648 log_dir("Replace dentry (%lx, %llx) %s -> %llx\n", dir->i_ino, pos, logfs_replace_inode()
653 /* Target dentry exists - the worst case. We need to attach the source
654 * inode to the target dentry, then remove the orphaned target inode and
655 * source dentry.
657 static int logfs_rename_target(struct inode *old_dir, struct dentry *old_dentry, logfs_rename_target()
658 struct inode *new_dir, struct dentry *new_dentry) logfs_rename_target()
719 static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, logfs_rename()
720 struct inode *new_dir, struct dentry *new_dentry) logfs_rename()
757 printk(KERN_INFO"LogFS: delete unbacked dentry (%llx, %llx)\n", logfs_replay_journal()
/linux-4.1.27/drivers/block/drbd/
H A Ddrbd_debugfs.c19 static struct dentry *drbd_debugfs_root;
20 static struct dentry *drbd_debugfs_version;
21 static struct dentry *drbd_debugfs_resources;
22 static struct dentry *drbd_debugfs_minors;
422 /* simple_positive(file->f_path.dentry) respectively debugfs_positive(),
425 static inline int debugfs_positive(struct dentry *dentry) debugfs_positive() argument
427 return d_really_is_positive(dentry) && !d_unhashed(dentry); debugfs_positive()
435 struct dentry *parent; drbd_single_open()
440 parent = file->f_path.dentry->d_parent; drbd_single_open()
447 if (debugfs_positive(file->f_path.dentry) drbd_single_open()
484 struct dentry *dentry; drbd_debugfs_resource_add() local
488 dentry = debugfs_create_dir(resource->name, drbd_debugfs_resources); drbd_debugfs_resource_add()
489 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_resource_add()
491 resource->debugfs_res = dentry; drbd_debugfs_resource_add()
493 dentry = debugfs_create_dir("volumes", resource->debugfs_res); drbd_debugfs_resource_add()
494 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_resource_add()
496 resource->debugfs_res_volumes = dentry; drbd_debugfs_resource_add()
498 dentry = debugfs_create_dir("connections", resource->debugfs_res); drbd_debugfs_resource_add()
499 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_resource_add()
501 resource->debugfs_res_connections = dentry; drbd_debugfs_resource_add()
503 dentry = debugfs_create_file("in_flight_summary", S_IRUSR|S_IRGRP, drbd_debugfs_resource_add()
506 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_resource_add()
508 resource->debugfs_res_in_flight_summary = dentry; drbd_debugfs_resource_add()
513 drbd_err(resource, "failed to create debugfs dentry\n"); drbd_debugfs_resource_add()
516 static void drbd_debugfs_remove(struct dentry **dp) drbd_debugfs_remove()
654 struct dentry *conns_dir = connection->resource->debugfs_res_connections; drbd_debugfs_connection_add()
655 struct dentry *dentry; drbd_debugfs_connection_add() local
662 dentry = debugfs_create_dir("peer", conns_dir); drbd_debugfs_connection_add()
663 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_connection_add()
665 connection->debugfs_conn = dentry; drbd_debugfs_connection_add()
667 dentry = debugfs_create_file("callback_history", S_IRUSR|S_IRGRP, drbd_debugfs_connection_add()
670 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_connection_add()
672 connection->debugfs_conn_callback_history = dentry; drbd_debugfs_connection_add()
674 dentry = debugfs_create_file("oldest_requests", S_IRUSR|S_IRGRP, drbd_debugfs_connection_add()
677 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_connection_add()
679 connection->debugfs_conn_oldest_requests = dentry; drbd_debugfs_connection_add()
684 drbd_err(connection, "failed to create debugfs dentry\n"); drbd_debugfs_connection_add()
810 struct dentry *vols_dir = device->resource->debugfs_res_volumes; drbd_debugfs_device_attr()
815 struct dentry *dentry; drbd_debugfs_device_attr() local
820 dentry = debugfs_create_dir(vnr_buf, vols_dir); drbd_debugfs_device_attr()
821 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_device_attr()
823 device->debugfs_vol = dentry; drbd_debugfs_device_attr()
830 dentry = debugfs_create_symlink(minor_buf, drbd_debugfs_minors, slink_name); drbd_debugfs_device_attr()
833 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_device_attr()
835 device->debugfs_minor = dentry; drbd_debugfs_device_attr()
838 dentry = debugfs_create_file(#name, S_IRUSR|S_IRGRP, \ drbd_debugfs_device_attr()
841 if (IS_ERR_OR_NULL(dentry)) \ drbd_debugfs_device_attr()
843 device->debugfs_vol_ ## name = dentry; \ drbd_debugfs_device_attr()
870 struct dentry *conn_dir = peer_device->connection->debugfs_conn; drbd_debugfs_peer_device_add()
871 struct dentry *dentry; drbd_debugfs_peer_device_add() local
878 dentry = debugfs_create_dir(vnr_buf, conn_dir); drbd_debugfs_peer_device_add()
879 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_peer_device_add()
881 peer_device->debugfs_peer_dev = dentry; drbd_debugfs_peer_device_add()
929 struct dentry *dentry; drbd_debugfs_init() local
931 dentry = debugfs_create_dir("drbd", NULL); drbd_debugfs_init()
932 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_init()
934 drbd_debugfs_root = dentry; drbd_debugfs_init()
936 dentry = debugfs_create_file("version", 0444, drbd_debugfs_root, NULL, &drbd_version_fops); drbd_debugfs_init()
937 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_init()
939 drbd_debugfs_version = dentry; drbd_debugfs_init()
941 dentry = debugfs_create_dir("resources", drbd_debugfs_root); drbd_debugfs_init()
942 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_init()
944 drbd_debugfs_resources = dentry; drbd_debugfs_init()
946 dentry = debugfs_create_dir("minors", drbd_debugfs_root); drbd_debugfs_init()
947 if (IS_ERR_OR_NULL(dentry)) drbd_debugfs_init()
949 drbd_debugfs_minors = dentry; drbd_debugfs_init()
954 if (dentry) drbd_debugfs_init()
955 return PTR_ERR(dentry); drbd_debugfs_init()
/linux-4.1.27/fs/hfs/
H A Dattr.c16 int hfs_setxattr(struct dentry *dentry, const char *name, hfs_setxattr() argument
19 struct inode *inode = d_inode(dentry); hfs_setxattr()
59 ssize_t hfs_getxattr(struct dentry *dentry, const char *name, hfs_getxattr() argument
62 struct inode *inode = d_inode(dentry); hfs_getxattr()
106 ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size) hfs_listxattr() argument
108 struct inode *inode = d_inode(dentry); hfs_listxattr()
H A Dsysdep.c14 /* dentry case-handling: just lowercase everything */
16 static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags) hfs_revalidate_dentry() argument
24 inode = d_inode(dentry); hfs_revalidate_dentry()
H A Ddir.c20 static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry, hfs_lookup() argument
31 hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); hfs_lookup()
47 d_add(dentry, inode); hfs_lookup()
192 static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, hfs_create() argument
198 inode = hfs_new_inode(dir, &dentry->d_name, mode); hfs_create()
202 res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); hfs_create()
209 d_instantiate(dentry, inode); hfs_create()
222 static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) hfs_mkdir() argument
227 inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode); hfs_mkdir()
231 res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); hfs_mkdir()
238 d_instantiate(dentry, inode); hfs_mkdir()
254 static int hfs_remove(struct inode *dir, struct dentry *dentry) hfs_remove() argument
256 struct inode *inode = d_inode(dentry); hfs_remove()
261 res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name); hfs_remove()
282 static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, hfs_rename()
283 struct inode *new_dir, struct dentry *new_dentry) hfs_rename()
/linux-4.1.27/fs/kernfs/
H A Dkernfs-internal.h82 int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr);
83 int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
85 int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value,
87 int kernfs_iop_removexattr(struct dentry *dentry, const char *name);
88 ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf,
90 ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size);
H A Dinode.c112 int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) kernfs_iop_setattr() argument
114 struct inode *inode = d_inode(dentry); kernfs_iop_setattr()
115 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_setattr()
160 int kernfs_iop_setxattr(struct dentry *dentry, const char *name, kernfs_iop_setxattr() argument
163 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_setxattr()
175 error = security_inode_setsecurity(d_inode(dentry), suffix, kernfs_iop_setxattr()
179 error = security_inode_getsecctx(d_inode(dentry), kernfs_iop_setxattr()
199 int kernfs_iop_removexattr(struct dentry *dentry, const char *name) kernfs_iop_removexattr() argument
201 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_removexattr()
211 ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf, kernfs_iop_getxattr() argument
214 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_getxattr()
224 ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size) kernfs_iop_listxattr() argument
226 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_listxattr()
270 int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry, kernfs_iop_getattr() argument
273 struct kernfs_node *kn = dentry->d_fsdata; kernfs_iop_getattr()
274 struct inode *inode = d_inode(dentry); kernfs_iop_getattr()
H A Dsymlink.c101 static int kernfs_getlink(struct dentry *dentry, char *path) kernfs_getlink() argument
103 struct kernfs_node *kn = dentry->d_fsdata; kernfs_getlink()
115 static void *kernfs_iop_follow_link(struct dentry *dentry, struct nameidata *nd) kernfs_iop_follow_link() argument
120 error = kernfs_getlink(dentry, (char *) page); kernfs_iop_follow_link()
128 static void kernfs_iop_put_link(struct dentry *dentry, struct nameidata *nd, kernfs_iop_put_link() argument
/linux-4.1.27/fs/nfs/blocklayout/
H A Drpc_pipefs.c145 static struct dentry *nfs4blocklayout_register_sb(struct super_block *sb, nfs4blocklayout_register_sb()
148 struct dentry *dir, *dentry; nfs4blocklayout_register_sb() local
153 dentry = rpc_mkpipe_dentry(dir, "blocklayout", NULL, pipe); nfs4blocklayout_register_sb()
155 return dentry; nfs4blocklayout_register_sb()
161 if (pipe->dentry) nfs4blocklayout_unregister_sb()
162 rpc_unlink(pipe->dentry); nfs4blocklayout_unregister_sb()
171 struct dentry *dentry; rpc_pipefs_event() local
184 dentry = nfs4blocklayout_register_sb(sb, nn->bl_device_pipe); rpc_pipefs_event()
185 if (IS_ERR(dentry)) { rpc_pipefs_event()
186 ret = PTR_ERR(dentry); rpc_pipefs_event()
189 nn->bl_device_pipe->dentry = dentry; rpc_pipefs_event()
192 if (nn->bl_device_pipe->dentry) rpc_pipefs_event()
207 static struct dentry *nfs4blocklayout_register_net(struct net *net, nfs4blocklayout_register_net()
211 struct dentry *dentry; nfs4blocklayout_register_net() local
216 dentry = nfs4blocklayout_register_sb(pipefs_sb, pipe); nfs4blocklayout_register_net()
218 return dentry; nfs4blocklayout_register_net()
236 struct dentry *dentry; nfs4blocklayout_net_init() local
243 dentry = nfs4blocklayout_register_net(net, nn->bl_device_pipe); nfs4blocklayout_net_init()
244 if (IS_ERR(dentry)) { nfs4blocklayout_net_init()
246 return PTR_ERR(dentry); nfs4blocklayout_net_init()
248 nn->bl_device_pipe->dentry = dentry; nfs4blocklayout_net_init()
/linux-4.1.27/fs/nilfs2/
H A Dnamei.c49 static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) nilfs_add_nondir() argument
51 int err = nilfs_add_link(dentry, inode); nilfs_add_nondir()
53 d_instantiate(dentry, inode); nilfs_add_nondir()
67 static struct dentry * nilfs_lookup()
68 nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) nilfs_lookup() argument
73 if (dentry->d_name.len > NILFS_NAME_LEN) nilfs_lookup()
76 ino = nilfs_inode_by_name(dir, &dentry->d_name); nilfs_lookup()
78 return d_splice_alias(inode, dentry); nilfs_lookup()
89 static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, nilfs_create() argument
106 err = nilfs_add_nondir(dentry, inode); nilfs_create()
117 nilfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) nilfs_mknod() argument
134 err = nilfs_add_nondir(dentry, inode); nilfs_mknod()
144 static int nilfs_symlink(struct inode *dir, struct dentry *dentry, nilfs_symlink() argument
175 err = nilfs_add_nondir(dentry, inode); nilfs_symlink()
192 static int nilfs_link(struct dentry *old_dentry, struct inode *dir, nilfs_link() argument
193 struct dentry *dentry) nilfs_link()
207 err = nilfs_add_link(dentry, inode); nilfs_link()
209 d_instantiate(dentry, inode); nilfs_link()
220 static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) nilfs_mkdir() argument
247 err = nilfs_add_link(dentry, inode); nilfs_mkdir()
252 d_instantiate(dentry, inode); nilfs_mkdir()
274 static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) nilfs_do_unlink() argument
282 de = nilfs_find_entry(dir, &dentry->d_name, &page); nilfs_do_unlink()
286 inode = d_inode(dentry); nilfs_do_unlink()
308 static int nilfs_unlink(struct inode *dir, struct dentry *dentry) nilfs_unlink() argument
317 err = nilfs_do_unlink(dir, dentry); nilfs_unlink()
321 nilfs_mark_inode_dirty(d_inode(dentry)); nilfs_unlink()
329 static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) nilfs_rmdir() argument
331 struct inode *inode = d_inode(dentry); nilfs_rmdir()
341 err = nilfs_do_unlink(dir, dentry); nilfs_rmdir()
358 static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, nilfs_rename()
359 struct inode *new_dir, struct dentry *new_dentry) nilfs_rename()
449 static struct dentry *nilfs_get_parent(struct dentry *child) nilfs_get_parent()
469 static struct dentry *nilfs_get_dentry(struct super_block *sb, u64 cno, nilfs_get_dentry()
494 static struct dentry *nilfs_fh_to_dentry(struct super_block *sb, struct fid *fh, nilfs_fh_to_dentry()
508 static struct dentry *nilfs_fh_to_parent(struct super_block *sb, struct fid *fh, nilfs_fh_to_parent()
/linux-4.1.27/fs/omfs/
H A Ddir.c111 static int omfs_add_link(struct dentry *dentry, struct inode *inode) omfs_add_link() argument
113 struct inode *dir = d_inode(dentry->d_parent); omfs_add_link()
114 const char *name = dentry->d_name.name; omfs_add_link()
115 int namelen = dentry->d_name.len; omfs_add_link()
156 static int omfs_delete_entry(struct dentry *dentry) omfs_delete_entry() argument
158 struct inode *dir = d_inode(dentry->d_parent); omfs_delete_entry()
160 const char *name = dentry->d_name.name; omfs_delete_entry()
161 int namelen = dentry->d_name.len; omfs_delete_entry()
238 static int omfs_remove(struct inode *dir, struct dentry *dentry) omfs_remove() argument
240 struct inode *inode = d_inode(dentry); omfs_remove()
248 ret = omfs_delete_entry(dentry); omfs_remove()
258 static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode) omfs_add_node() argument
270 err = omfs_add_link(dentry, inode); omfs_add_node()
274 d_instantiate(dentry, inode); omfs_add_node()
282 static int omfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) omfs_mkdir() argument
284 return omfs_add_node(dir, dentry, mode | S_IFDIR); omfs_mkdir()
287 static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, omfs_create() argument
290 return omfs_add_node(dir, dentry, mode | S_IFREG); omfs_create()
293 static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry, omfs_lookup() argument
299 if (dentry->d_name.len > OMFS_NAMELEN) omfs_lookup()
302 bh = omfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len); omfs_lookup()
311 d_add(dentry, inode); omfs_lookup()
373 static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, omfs_rename()
374 struct inode *new_dir, struct dentry *new_dentry) omfs_rename()
/linux-4.1.27/arch/sh/kernel/
H A Dkdebugfs.c5 struct dentry *arch_debugfs_dir;
/linux-4.1.27/drivers/char/tpm/
H A Dtpm_eventlog.h74 extern struct dentry **tpm_bios_log_setup(char *);
75 extern void tpm_bios_log_teardown(struct dentry **);
77 static inline struct dentry **tpm_bios_log_setup(char *name) tpm_bios_log_setup()
81 static inline void tpm_bios_log_teardown(struct dentry **dir) tpm_bios_log_teardown()
/linux-4.1.27/drivers/acpi/
H A Ddebugfs.c13 struct dentry *acpi_debugfs_dir;
/linux-4.1.27/fs/isofs/
H A Dnamei.c18 isofs_cmp(struct dentry *dentry, const char *compare, int dlen) isofs_cmp() argument
23 if (likely(!dentry->d_op)) isofs_cmp()
24 return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen); isofs_cmp()
25 return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); isofs_cmp()
35 isofs_find_entry(struct inode *dir, struct dentry *dentry, isofs_find_entry() argument
135 match = (isofs_cmp(dentry, dpnt, dlen) == 0); isofs_find_entry()
151 struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) isofs_lookup() argument
163 found = isofs_find_entry(dir, dentry, isofs_lookup()
171 return d_splice_alias(inode, dentry); isofs_lookup()
/linux-4.1.27/arch/powerpc/platforms/cell/spufs/
H A Dinode.c112 spufs_setattr(struct dentry *dentry, struct iattr *attr) spufs_setattr() argument
114 struct inode *inode = d_inode(dentry); spufs_setattr()
126 spufs_new_file(struct super_block *sb, struct dentry *dentry, spufs_new_file() argument
146 d_add(dentry, inode); spufs_new_file()
162 static void spufs_prune_dir(struct dentry *dir) spufs_prune_dir()
164 struct dentry *dentry, *tmp; spufs_prune_dir() local
167 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { spufs_prune_dir()
168 spin_lock(&dentry->d_lock); spufs_prune_dir()
169 if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) { spufs_prune_dir()
170 dget_dlock(dentry); spufs_prune_dir()
171 __d_drop(dentry); spufs_prune_dir()
172 spin_unlock(&dentry->d_lock); spufs_prune_dir()
173 simple_unlink(d_inode(dir), dentry); spufs_prune_dir() local
177 dput(dentry); spufs_prune_dir()
179 spin_unlock(&dentry->d_lock); spufs_prune_dir()
187 static int spufs_rmdir(struct inode *parent, struct dentry *dir) spufs_rmdir()
199 static int spufs_fill_dir(struct dentry *dir, spufs_fill_dir()
205 struct dentry *dentry = d_alloc_name(dir, files->name); spufs_fill_dir() local
206 if (!dentry) spufs_fill_dir()
208 ret = spufs_new_file(dir->d_sb, dentry, files->ops, spufs_fill_dir()
221 struct dentry *dir; spufs_dir_close()
224 dir = file->f_path.dentry; spufs_dir_close()
247 spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, spufs_mkdir() argument
275 dget(dentry); spufs_mkdir()
279 d_instantiate(dentry, inode); spufs_mkdir()
282 ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, spufs_mkdir()
285 ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); spufs_mkdir()
288 ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, spufs_mkdir()
292 spufs_rmdir(dir, dentry); spufs_mkdir()
422 spufs_create_context(struct inode *inode, struct dentry *dentry, spufs_create_context() argument
430 struct path path = {.mnt = mnt, .dentry = dentry}; spufs_create_context()
458 ret = spufs_mkdir(inode, dentry, flags, mode & S_IRWXUGO); spufs_create_context()
463 spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx, spufs_create_context()
471 WARN_ON(spufs_rmdir(inode, dentry)); spufs_create_context()
480 spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode) spufs_mkgang() argument
505 d_instantiate(dentry, inode); spufs_mkgang()
507 inc_nlink(d_inode(dentry)); spufs_mkgang()
541 struct dentry *dentry, spufs_create_gang()
544 struct path path = {.mnt = mnt, .dentry = dentry}; spufs_create_gang()
547 ret = spufs_mkgang(inode, dentry, mode & S_IRWXUGO); spufs_create_gang()
551 int err = simple_rmdir(inode, dentry); spufs_create_gang()
561 long spufs_create(struct path *path, struct dentry *dentry, spufs_create() argument
564 struct inode *dir = d_inode(path->dentry); spufs_create()
568 if (path->dentry->d_sb->s_type != &spufs_type) spufs_create()
576 if (path->dentry != path->dentry->d_sb->s_root) spufs_create()
583 ret = spufs_create_gang(dir, dentry, path->mnt, mode); spufs_create()
585 ret = spufs_create_context(dir, dentry, path->mnt, flags, mode, spufs_create()
588 fsnotify_mkdir(dir, dentry); spufs_create()
744 static struct dentry * spufs_mount()
540 spufs_create_gang(struct inode *inode, struct dentry *dentry, struct vfsmount *mnt, umode_t mode) spufs_create_gang() argument
H A Dsyscalls.c66 struct dentry *dentry; do_spu_create() local
69 dentry = user_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY); do_spu_create()
70 ret = PTR_ERR(dentry); do_spu_create()
71 if (!IS_ERR(dentry)) { do_spu_create()
72 ret = spufs_create(&path, dentry, flags, mode, neighbor); do_spu_create()
73 done_path_create(&path, dentry); do_spu_create()
/linux-4.1.27/security/apparmor/
H A Dlsm.c176 * common_perm_dir_dentry - common permission wrapper when path is dir, dentry
178 * @dir: directory of the dentry (NOT NULL)
179 * @dentry: dentry to check (NOT NULL)
186 struct dentry *dentry, u32 mask, common_perm_dir_dentry()
189 struct path path = { dir->mnt, dentry }; common_perm_dir_dentry()
195 * common_perm_mnt_dentry - common permission wrapper when mnt, dentry
197 * @mnt: mount point of dentry (NOT NULL)
198 * @dentry: dentry to check (NOT NULL)
204 struct dentry *dentry, u32 mask) common_perm_mnt_dentry()
206 struct path path = { mnt, dentry }; common_perm_mnt_dentry()
207 struct path_cond cond = { d_backing_inode(dentry)->i_uid, common_perm_mnt_dentry()
208 d_backing_inode(dentry)->i_mode common_perm_mnt_dentry()
217 * @dir: directory that the dentry is in (NOT NULL)
218 * @dentry: dentry being rm'd (NOT NULL)
224 struct dentry *dentry, u32 mask) common_perm_rm()
226 struct inode *inode = d_backing_inode(dentry); common_perm_rm()
229 if (!inode || !dir->mnt || !mediated_filesystem(dentry)) common_perm_rm()
235 return common_perm_dir_dentry(op, dir, dentry, mask, &cond); common_perm_rm()
241 * @dir: directory that dentry will be created in (NOT NULL)
242 * @dentry: dentry to create (NOT NULL)
248 static int common_perm_create(int op, struct path *dir, struct dentry *dentry, common_perm_create() argument
253 if (!dir->mnt || !mediated_filesystem(dir->dentry)) common_perm_create()
256 return common_perm_dir_dentry(op, dir, dentry, mask, &cond); common_perm_create()
259 static int apparmor_path_unlink(struct path *dir, struct dentry *dentry) apparmor_path_unlink() argument
261 return common_perm_rm(OP_UNLINK, dir, dentry, AA_MAY_DELETE); apparmor_path_unlink()
264 static int apparmor_path_mkdir(struct path *dir, struct dentry *dentry, apparmor_path_mkdir() argument
267 return common_perm_create(OP_MKDIR, dir, dentry, AA_MAY_CREATE, apparmor_path_mkdir()
271 static int apparmor_path_rmdir(struct path *dir, struct dentry *dentry) apparmor_path_rmdir() argument
273 return common_perm_rm(OP_RMDIR, dir, dentry, AA_MAY_DELETE); apparmor_path_rmdir()
276 static int apparmor_path_mknod(struct path *dir, struct dentry *dentry, apparmor_path_mknod() argument
279 return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode); apparmor_path_mknod()
284 struct path_cond cond = { d_backing_inode(path->dentry)->i_uid, apparmor_path_truncate()
285 d_backing_inode(path->dentry)->i_mode apparmor_path_truncate()
288 if (!path->mnt || !mediated_filesystem(path->dentry)) apparmor_path_truncate()
295 static int apparmor_path_symlink(struct path *dir, struct dentry *dentry, apparmor_path_symlink() argument
298 return common_perm_create(OP_SYMLINK, dir, dentry, AA_MAY_CREATE, apparmor_path_symlink()
302 static int apparmor_path_link(struct dentry *old_dentry, struct path *new_dir, apparmor_path_link()
303 struct dentry *new_dentry) apparmor_path_link()
317 static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry, apparmor_path_rename()
318 struct path *new_dir, struct dentry *new_dentry) apparmor_path_rename()
349 if (!mediated_filesystem(path->dentry)) apparmor_path_chmod()
352 return common_perm_mnt_dentry(OP_CHMOD, path->mnt, path->dentry, AA_MAY_CHMOD); apparmor_path_chmod()
357 struct path_cond cond = { d_backing_inode(path->dentry)->i_uid, apparmor_path_chown()
358 d_backing_inode(path->dentry)->i_mode apparmor_path_chown()
361 if (!mediated_filesystem(path->dentry)) apparmor_path_chown()
369 if (!mediated_filesystem(path->dentry)) apparmor_inode_getattr()
372 return common_perm_mnt_dentry(OP_GETATTR, path->mnt, path->dentry, apparmor_inode_getattr()
382 if (!mediated_filesystem(file->f_path.dentry)) apparmor_file_open()
435 !mediated_filesystem(file->f_path.dentry)) common_file_perm()
185 common_perm_dir_dentry(int op, struct path *dir, struct dentry *dentry, u32 mask, struct path_cond *cond) common_perm_dir_dentry() argument
203 common_perm_mnt_dentry(int op, struct vfsmount *mnt, struct dentry *dentry, u32 mask) common_perm_mnt_dentry() argument
223 common_perm_rm(int op, struct path *dir, struct dentry *dentry, u32 mask) common_perm_rm() argument
/linux-4.1.27/fs/btrfs/
H A Dxattr.h31 extern ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
33 extern int btrfs_setxattr(struct dentry *dentry, const char *name,
35 extern int btrfs_removexattr(struct dentry *dentry, const char *name);
/linux-4.1.27/fs/cifs/
H A Dcifsfs.h55 extern int cifs_create(struct inode *, struct dentry *, umode_t,
57 extern int cifs_atomic_open(struct inode *, struct dentry *,
60 extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
62 extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
63 extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
64 extern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
65 extern int cifs_mkdir(struct inode *, struct dentry *, umode_t);
66 extern int cifs_rmdir(struct inode *, struct dentry *);
67 extern int cifs_rename2(struct inode *, struct dentry *, struct inode *,
68 struct dentry *, unsigned int);
70 extern int cifs_revalidate_dentry_attr(struct dentry *);
72 extern int cifs_revalidate_dentry(struct dentry *);
76 extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
77 extern int cifs_setattr(struct dentry *, struct iattr *);
119 extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
120 extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
122 extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
124 extern int cifs_removexattr(struct dentry *, const char *);
125 extern int cifs_setxattr(struct dentry *, const char *, const void *,
127 extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
128 extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
/linux-4.1.27/drivers/net/wimax/i2400m/
H A Ddebugfs.c49 struct dentry *debugfs_create_netdev_queue_stopped( debugfs_create_netdev_queue_stopped()
50 const char *name, struct dentry *parent, struct i2400m *i2400m) debugfs_create_netdev_queue_stopped()
185 struct dentry *debugfs_create_i2400m_suspend( debugfs_create_i2400m_suspend()
186 const char *name, struct dentry *parent, struct i2400m *i2400m) debugfs_create_i2400m_suspend()
223 struct dentry *debugfs_create_i2400m_reset( debugfs_create_i2400m_reset()
224 const char *name, struct dentry *parent, struct i2400m *i2400m) debugfs_create_i2400m_reset()
243 struct dentry *dentry = i2400m->wimax_dev.debugfs_dentry; i2400m_debugfs_add() local
244 struct dentry *fd; i2400m_debugfs_add()
246 dentry = debugfs_create_dir("i2400m", dentry); i2400m_debugfs_add()
247 result = PTR_ERR(dentry); i2400m_debugfs_add()
248 if (IS_ERR(dentry)) { i2400m_debugfs_add()
253 i2400m->debugfs_dentry = dentry; i2400m_debugfs_add()
254 __debugfs_register("dl_", control, dentry); i2400m_debugfs_add()
255 __debugfs_register("dl_", driver, dentry); i2400m_debugfs_add()
256 __debugfs_register("dl_", debugfs, dentry); i2400m_debugfs_add()
257 __debugfs_register("dl_", fw, dentry); i2400m_debugfs_add()
258 __debugfs_register("dl_", netdev, dentry); i2400m_debugfs_add()
259 __debugfs_register("dl_", rfkill, dentry); i2400m_debugfs_add()
260 __debugfs_register("dl_", rx, dentry); i2400m_debugfs_add()
261 __debugfs_register("dl_", tx, dentry); i2400m_debugfs_add()
263 fd = debugfs_create_size_t("tx_in", 0400, dentry, i2400m_debugfs_add()
272 fd = debugfs_create_size_t("tx_out", 0400, dentry, i2400m_debugfs_add()
281 fd = debugfs_create_u32("state", 0600, dentry, i2400m_debugfs_add()
312 fd = debugfs_create_u8("trace_msg_from_user", 0600, dentry, i2400m_debugfs_add()
322 dentry, i2400m); i2400m_debugfs_add()
330 fd = debugfs_create_file("rx_stats", 0600, dentry, i2400m, i2400m_debugfs_add()
339 fd = debugfs_create_file("tx_stats", 0600, dentry, i2400m, i2400m_debugfs_add()
348 fd = debugfs_create_i2400m_suspend("suspend", dentry, i2400m); i2400m_debugfs_add()
356 fd = debugfs_create_i2400m_reset("reset", dentry, i2400m); i2400m_debugfs_add()
/linux-4.1.27/fs/hostfs/
H A Dhostfs_kern.c84 static char *__dentry_name(struct dentry *dentry, char *name) __dentry_name() argument
86 char *p = dentry_path_raw(dentry, name, PATH_MAX); __dentry_name()
90 root = dentry->d_sb->s_fs_info; __dentry_name()
115 static char *dentry_name(struct dentry *dentry) dentry_name() argument
121 return __dentry_name(dentry, name); dentry_name()
126 struct dentry *dentry; inode_name() local
129 dentry = d_find_alias(ino); inode_name()
130 if (!dentry) inode_name()
133 name = dentry_name(dentry); inode_name()
135 dput(dentry); inode_name()
193 static int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf) hostfs_statfs() argument
207 err = do_statfs(dentry->d_sb->s_fs_info, hostfs_statfs()
257 static int hostfs_show_options(struct seq_file *seq, struct dentry *root) hostfs_show_options()
287 name = dentry_name(file->f_path.dentry); hostfs_readdir()
326 name = dentry_name(file->f_path.dentry); hostfs_open()
566 static int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, hostfs_create() argument
580 name = dentry_name(dentry); hostfs_create()
596 d_instantiate(dentry, inode); hostfs_create()
605 static struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry, hostfs_lookup() argument
619 name = dentry_name(dentry); hostfs_lookup()
633 d_add(dentry, inode); hostfs_lookup()
642 static int hostfs_link(struct dentry *to, struct inode *ino, hostfs_link()
643 struct dentry *from) hostfs_link()
661 static int hostfs_unlink(struct inode *ino, struct dentry *dentry) hostfs_unlink() argument
669 if ((file = dentry_name(dentry)) == NULL) hostfs_unlink()
677 static int hostfs_symlink(struct inode *ino, struct dentry *dentry, hostfs_symlink() argument
683 if ((file = dentry_name(dentry)) == NULL) hostfs_symlink()
690 static int hostfs_mkdir(struct inode *ino, struct dentry *dentry, umode_t mode) hostfs_mkdir() argument
695 if ((file = dentry_name(dentry)) == NULL) hostfs_mkdir()
702 static int hostfs_rmdir(struct inode *ino, struct dentry *dentry) hostfs_rmdir() argument
707 if ((file = dentry_name(dentry)) == NULL) hostfs_rmdir()
714 static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) hostfs_mknod() argument
727 name = dentry_name(dentry); hostfs_mknod()
741 d_instantiate(dentry, inode); hostfs_mknod()
752 static int hostfs_rename2(struct inode *old_dir, struct dentry *old_dentry, hostfs_rename2()
753 struct inode *new_dir, struct dentry *new_dentry, hostfs_rename2()
806 static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) hostfs_setattr() argument
808 struct inode *inode = d_inode(dentry); hostfs_setattr()
857 name = dentry_name(dentry); hostfs_setattr()
893 static void *hostfs_follow_link(struct dentry *dentry, struct nameidata *nd) hostfs_follow_link() argument
897 char *path = dentry_name(dentry); hostfs_follow_link()
917 static void hostfs_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) hostfs_put_link() argument
987 static struct dentry *hostfs_read_sb(struct file_system_type *type, hostfs_read_sb()
/linux-4.1.27/fs/f2fs/
H A Dnamei.c109 static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, f2fs_create() argument
124 set_cold_files(sbi, inode, dentry->d_name.name); f2fs_create()
132 err = f2fs_add_link(dentry, inode); f2fs_create()
140 d_instantiate(dentry, inode); f2fs_create()
151 static int f2fs_link(struct dentry *old_dentry, struct inode *dir, f2fs_link() argument
152 struct dentry *dentry) f2fs_link()
165 err = f2fs_add_link(dentry, inode); f2fs_link()
170 d_instantiate(dentry, inode); f2fs_link()
182 struct dentry *f2fs_get_parent(struct dentry *child) f2fs_get_parent()
229 static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, f2fs_lookup() argument
236 if (dentry->d_name.len > F2FS_NAME_LEN) f2fs_lookup()
239 de = f2fs_find_entry(dir, &dentry->d_name, &page); f2fs_lookup()
260 return d_splice_alias(inode, dentry); f2fs_lookup()
263 static int f2fs_unlink(struct inode *dir, struct dentry *dentry) f2fs_unlink() argument
266 struct inode *inode = d_inode(dentry); f2fs_unlink()
271 trace_f2fs_unlink_enter(dir, dentry); f2fs_unlink()
274 de = f2fs_find_entry(dir, &dentry->d_name, &page); f2fs_unlink()
299 static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd) f2fs_follow_link() argument
301 struct page *page = page_follow_link_light(dentry, nd); f2fs_follow_link()
308 page_put_link(dentry, nd, page); f2fs_follow_link()
314 static int f2fs_symlink(struct inode *dir, struct dentry *dentry, f2fs_symlink() argument
332 err = f2fs_add_link(dentry, inode); f2fs_symlink()
340 d_instantiate(dentry, inode); f2fs_symlink()
362 static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) f2fs_mkdir() argument
381 err = f2fs_add_link(dentry, inode); f2fs_mkdir()
389 d_instantiate(dentry, inode); f2fs_mkdir()
402 static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) f2fs_rmdir() argument
404 struct inode *inode = d_inode(dentry); f2fs_rmdir()
406 return f2fs_unlink(dir, dentry); f2fs_rmdir()
410 static int f2fs_mknod(struct inode *dir, struct dentry *dentry, f2fs_mknod() argument
430 err = f2fs_add_link(dentry, inode); f2fs_mknod()
437 d_instantiate(dentry, inode); f2fs_mknod()
448 static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, f2fs_rename()
449 struct inode *new_dir, struct dentry *new_dentry) f2fs_rename()
575 static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, f2fs_cross_rename()
576 struct inode *new_dir, struct dentry *new_dentry) f2fs_cross_rename()
642 /* update ".." directory entry info of old dentry */ f2fs_cross_rename()
646 /* update ".." directory entry info of new dentry */ f2fs_cross_rename()
722 static int f2fs_rename2(struct inode *old_dir, struct dentry *old_dentry, f2fs_rename2()
723 struct inode *new_dir, struct dentry *new_dentry, f2fs_rename2()
734 * VFS has already handled the new dentry existence case, f2fs_rename2()
740 static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) f2fs_tmpfile() argument
773 d_tmpfile(dentry, inode); f2fs_tmpfile()
/linux-4.1.27/fs/bfs/
H A Ddir.c78 static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bfs_create() argument
113 err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, bfs_create()
122 d_instantiate(dentry, inode); bfs_create()
126 static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry, bfs_lookup() argument
134 if (dentry->d_name.len > BFS_NAMELEN) bfs_lookup()
138 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); bfs_lookup()
149 d_add(dentry, inode); bfs_lookup()
153 static int bfs_link(struct dentry *old, struct inode *dir, bfs_link()
154 struct dentry *new) bfs_link()
176 static int bfs_unlink(struct inode *dir, struct dentry *dentry) bfs_unlink() argument
179 struct inode *inode = d_inode(dentry); bfs_unlink()
185 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); bfs_unlink()
209 static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, bfs_rename()
210 struct inode *new_dir, struct dentry *new_dentry) bfs_rename()
/linux-4.1.27/fs/hppfs/
H A Dhppfs.c23 static struct inode *get_inode(struct super_block *, struct dentry *);
38 struct dentry *proc_dentry;
51 static int is_pid(struct dentry *dentry) is_pid() argument
56 sb = dentry->d_sb; is_pid()
57 if (dentry->d_parent != sb->s_root) is_pid()
60 for (i = 0; i < dentry->d_name.len; i++) { is_pid()
61 if (!isdigit(dentry->d_name.name[i])) is_pid()
67 static char *dentry_name(struct dentry *dentry, int extra) dentry_name() argument
69 struct dentry *parent; dentry_name()
75 parent = dentry; dentry_name()
91 parent = dentry; dentry_name()
111 static int file_removed(struct dentry *dentry, const char *file) file_removed() argument
120 host_file = dentry_name(dentry, extra + strlen("/remove")); file_removed()
141 static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, hppfs_lookup() argument
144 struct dentry *proc_dentry, *parent; hppfs_lookup()
145 struct qstr *name = &dentry->d_name; hppfs_lookup()
149 deleted = file_removed(dentry, NULL); hppfs_lookup()
168 d_add(dentry, inode); hppfs_lookup()
433 host_file = dentry_name(file->f_path.dentry, strlen("/rw")); hppfs_open()
438 path.dentry = HPPFS_I(inode)->proc_dentry; hppfs_open()
494 path.dentry = HPPFS_I(inode)->proc_dentry; hppfs_dir_open()
548 struct dentry *dentry; member in struct:hppfs_dirent
557 if (file_removed(dirent->dentry, name)) hppfs_filldir()
571 .dentry = file->f_path.dentry hppfs_readdir()
588 static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) hppfs_statfs() argument
637 static int hppfs_readlink(struct dentry *dentry, char __user *buffer, hppfs_readlink() argument
640 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; hppfs_readlink()
645 static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) hppfs_follow_link() argument
647 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; hppfs_follow_link()
652 static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd, hppfs_put_link() argument
655 struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; hppfs_put_link()
671 static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) get_inode() argument
673 struct inode *proc_ino = d_inode(dentry); get_inode()
677 dput(dentry); get_inode()
681 if (d_is_dir(dentry)) { get_inode()
684 } else if (d_is_symlink(dentry)) { get_inode()
692 HPPFS_I(inode)->proc_dentry = dentry; get_inode()
738 static struct dentry *hppfs_read_super(struct file_system_type *type, hppfs_read_super()
/linux-4.1.27/drivers/net/wireless/b43/
H A Ddebugfs.h22 struct dentry;
34 struct dentry *dentry; member in struct:b43_dfs_file
41 struct dentry *subdir;
73 struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
/linux-4.1.27/drivers/net/wireless/b43legacy/
H A Ddebugfs.h19 struct dentry;
30 struct dentry *dentry; member in struct:b43legacy_dfs_file
37 struct dentry *subdir;
52 struct dentry *dyn_debug_dentries[__B43legacy_NR_DYNDBG];
/linux-4.1.27/fs/devpts/
H A Dinode.c131 struct dentry *ptmx_dentry;
243 struct dentry *dentry; mknod_ptmx() local
245 struct dentry *root = sb->s_root; mknod_ptmx()
264 dentry = d_alloc_name(root, "ptmx"); mknod_ptmx()
265 if (!dentry) { mknod_ptmx()
266 pr_err("Unable to alloc dentry for ptmx node\n"); mknod_ptmx()
276 dput(dentry); mknod_ptmx()
288 d_add(dentry, inode); mknod_ptmx()
290 fsi->ptmx_dentry = dentry; mknod_ptmx()
332 static int devpts_show_options(struct seq_file *seq, struct dentry *root) devpts_show_options()
403 pr_err("get root dentry failed\n"); devpts_fill_super()
444 static struct dentry *devpts_mount(struct file_system_type *fs_type, devpts_mount()
495 static struct dentry *devpts_mount(struct file_system_type *fs_type, int flags, devpts_mount()
604 struct dentry *dentry; devpts_pty_new() local
607 struct dentry *root = sb->s_root; devpts_pty_new()
627 dentry = d_alloc_name(root, s); devpts_pty_new()
628 if (dentry) { devpts_pty_new()
629 d_add(dentry, inode); devpts_pty_new()
630 fsnotify_create(d_inode(root), dentry); devpts_pty_new() local
649 struct dentry *dentry; devpts_get_priv() local
654 /* Ensure dentry has not been deleted by devpts_pty_kill() */ devpts_get_priv()
655 dentry = d_find_alias(pts_inode); devpts_get_priv()
656 if (!dentry) devpts_get_priv()
662 dput(dentry); devpts_get_priv()
676 struct dentry *root = sb->s_root; devpts_pty_kill()
677 struct dentry *dentry; devpts_pty_kill() local
683 dentry = d_find_alias(inode); devpts_pty_kill()
686 d_delete(dentry); devpts_pty_kill()
687 dput(dentry); /* d_alloc_name() in devpts_pty_new() */ devpts_pty_kill()
688 dput(dentry); /* d_find_alias above */ devpts_pty_kill()
/linux-4.1.27/fs/qnx4/
H A Dqnx4.h24 extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags);
/linux-4.1.27/fs/xfs/
H A Dxfs_iops.c101 struct dentry *dentry, xfs_dentry_to_name()
104 namep->name = dentry->d_name.name; xfs_dentry_to_name()
105 namep->len = dentry->d_name.len; xfs_dentry_to_name()
113 struct dentry *dentry) xfs_cleanup_inode()
122 xfs_dentry_to_name(&teardown, dentry, 0); xfs_cleanup_inode()
130 struct dentry *dentry, xfs_generic_create()
158 xfs_dentry_to_name(&name, dentry, mode); xfs_generic_create()
161 error = xfs_create_tmpfile(XFS_I(dir), dentry, mode, &ip); xfs_generic_create()
168 error = xfs_init_security(inode, dir, &dentry->d_name); xfs_generic_create()
186 d_tmpfile(dentry, inode); xfs_generic_create()
188 d_instantiate(dentry, inode); xfs_generic_create()
202 xfs_cleanup_inode(dir, inode, dentry); xfs_generic_create()
210 struct dentry *dentry, xfs_vn_mknod()
214 return xfs_generic_create(dir, dentry, mode, rdev, false); xfs_vn_mknod()
220 struct dentry *dentry, xfs_vn_create()
224 return xfs_vn_mknod(dir, dentry, mode, 0); xfs_vn_create()
230 struct dentry *dentry, xfs_vn_mkdir()
233 return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0); xfs_vn_mkdir()
236 STATIC struct dentry * xfs_vn_lookup()
239 struct dentry *dentry, xfs_vn_lookup()
246 if (dentry->d_name.len >= MAXNAMELEN) xfs_vn_lookup()
249 xfs_dentry_to_name(&name, dentry, 0); xfs_vn_lookup()
254 d_add(dentry, NULL); xfs_vn_lookup()
258 return d_splice_alias(VFS_I(cip), dentry); xfs_vn_lookup()
261 STATIC struct dentry * xfs_vn_ci_lookup()
264 struct dentry *dentry, xfs_vn_ci_lookup()
273 if (dentry->d_name.len >= MAXNAMELEN) xfs_vn_ci_lookup()
276 xfs_dentry_to_name(&xname, dentry, 0); xfs_vn_ci_lookup()
282 * call d_add(dentry, NULL) here when d_drop_negative_children xfs_vn_ci_lookup()
291 return d_splice_alias(VFS_I(ip), dentry); xfs_vn_ci_lookup()
296 dentry = d_add_ci(dentry, VFS_I(ip), &dname); xfs_vn_ci_lookup()
298 return dentry; xfs_vn_ci_lookup()
303 struct dentry *old_dentry, xfs_vn_link()
305 struct dentry *dentry) xfs_vn_link()
311 xfs_dentry_to_name(&name, dentry, inode->i_mode); xfs_vn_link()
318 d_instantiate(dentry, inode); xfs_vn_link()
325 struct dentry *dentry) xfs_vn_unlink()
330 xfs_dentry_to_name(&name, dentry, 0); xfs_vn_unlink()
332 error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry))); xfs_vn_unlink()
337 * With unlink, the VFS makes the dentry "negative": no inode, xfs_vn_unlink()
339 * mode, so invalidate (unhash) the dentry in CI-mode. xfs_vn_unlink()
342 d_invalidate(dentry); xfs_vn_unlink()
349 struct dentry *dentry, xfs_vn_symlink()
360 xfs_dentry_to_name(&name, dentry, mode); xfs_vn_symlink()
368 error = xfs_init_security(inode, dir, &dentry->d_name); xfs_vn_symlink()
372 d_instantiate(dentry, inode); xfs_vn_symlink()
378 xfs_cleanup_inode(dir, inode, dentry); xfs_vn_symlink()
387 struct dentry *odentry, xfs_vn_rename()
389 struct dentry *ndentry, xfs_vn_rename()
419 struct dentry *dentry, xfs_vn_follow_link()
429 error = xfs_readlink(XFS_I(d_inode(dentry)), link); xfs_vn_follow_link()
446 struct dentry *dentry, xfs_vn_getattr()
449 struct inode *inode = d_inode(dentry); xfs_vn_getattr()
946 struct dentry *dentry, xfs_vn_setattr()
949 struct xfs_inode *ip = XFS_I(d_inode(dentry)); xfs_vn_setattr()
956 error = xfs_break_layouts(d_inode(dentry), &iolock, true); xfs_vn_setattr()
1101 struct dentry *dentry, xfs_vn_tmpfile()
1104 return xfs_generic_create(dir, dentry, mode, 0, true); xfs_vn_tmpfile()
99 xfs_dentry_to_name( struct xfs_name *namep, struct dentry *dentry, int mode) xfs_dentry_to_name() argument
110 xfs_cleanup_inode( struct inode *dir, struct inode *inode, struct dentry *dentry) xfs_cleanup_inode() argument
128 xfs_generic_create( struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev, bool tmpfile) xfs_generic_create() argument
208 xfs_vn_mknod( struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) xfs_vn_mknod() argument
218 xfs_vn_create( struct inode *dir, struct dentry *dentry, umode_t mode, bool flags) xfs_vn_create() argument
228 xfs_vn_mkdir( struct inode *dir, struct dentry *dentry, umode_t mode) xfs_vn_mkdir() argument
237 xfs_vn_lookup( struct inode *dir, struct dentry *dentry, unsigned int flags) xfs_vn_lookup() argument
262 xfs_vn_ci_lookup( struct inode *dir, struct dentry *dentry, unsigned int flags) xfs_vn_ci_lookup() argument
302 xfs_vn_link( struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) xfs_vn_link() argument
323 xfs_vn_unlink( struct inode *dir, struct dentry *dentry) xfs_vn_unlink() argument
347 xfs_vn_symlink( struct inode *dir, struct dentry *dentry, const char *symname) xfs_vn_symlink() argument
418 xfs_vn_follow_link( struct dentry *dentry, struct nameidata *nd) xfs_vn_follow_link() argument
444 xfs_vn_getattr( struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) xfs_vn_getattr() argument
945 xfs_vn_setattr( struct dentry *dentry, struct iattr *iattr) xfs_vn_setattr() argument
1099 xfs_vn_tmpfile( struct inode *dir, struct dentry *dentry, umode_t mode) xfs_vn_tmpfile() argument
/linux-4.1.27/fs/jfs/
H A Djfs_inode.h35 extern struct dentry *jfs_get_parent(struct dentry *dentry);
37 extern struct dentry *jfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
39 extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
43 extern int jfs_setattr(struct dentry *, struct iattr *);
H A Dnamei.c62 * NAME: jfs_create(dip, dentry, mode)
65 * with name = <from dentry> and mode = <mode>
68 * dentry - dentry of new file
75 static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, jfs_create() argument
87 jfs_info("jfs_create: dip:0x%p name:%pd", dip, dentry); jfs_create()
95 if ((rc = get_UCSname(&dname, dentry))) jfs_create()
118 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); jfs_create()
180 d_instantiate(dentry, ip); jfs_create()
194 * NAME: jfs_mkdir(dip, dentry, mode)
197 * with name = <from dentry> and mode = <mode>
200 * dentry - dentry of child directory
208 static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) jfs_mkdir() argument
219 jfs_info("jfs_mkdir: dip:0x%p name:%pd", dip, dentry); jfs_mkdir()
227 if ((rc = get_UCSname(&dname, dentry))) jfs_mkdir()
250 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); jfs_mkdir()
313 d_instantiate(dentry, ip); jfs_mkdir()
327 * NAME: jfs_rmdir(dip, dentry)
332 * dentry - child directory dentry
345 static int jfs_rmdir(struct inode *dip, struct dentry *dentry) jfs_rmdir() argument
349 struct inode *ip = d_inode(dentry); jfs_rmdir()
355 jfs_info("jfs_rmdir: dip:0x%p name:%pd", dip, dentry); jfs_rmdir()
367 if ((rc = get_UCSname(&dname, dentry))) { jfs_rmdir()
452 * NAME: jfs_unlink(dip, dentry)
458 * dentry - dentry of object to be removed
471 static int jfs_unlink(struct inode *dip, struct dentry *dentry) jfs_unlink() argument
475 struct inode *ip = d_inode(dentry); jfs_unlink()
483 jfs_info("jfs_unlink: dip:0x%p name:%pd", dip, dentry); jfs_unlink()
489 if ((rc = get_UCSname(&dname, dentry))) jfs_unlink()
789 static int jfs_link(struct dentry *old_dentry, jfs_link() argument
790 struct inode *dir, struct dentry *dentry) jfs_link()
800 jfs_info("jfs_link: %pd %pd", old_dentry, dentry); jfs_link()
812 if ((rc = get_UCSname(&dname, dentry))) jfs_link()
840 d_instantiate(dentry, ip); jfs_link()
856 * NAME: jfs_symlink(dip, dentry, name)
862 * dentry - dentry of symbolic link
873 static int jfs_symlink(struct inode *dip, struct dentry *dentry, jfs_symlink() argument
882 struct inode *ip = d_inode(dentry); jfs_symlink()
904 if ((rc = get_UCSname(&dname, dentry))) jfs_symlink()
922 rc = jfs_init_security(tid, ip, dip, &dentry->d_name); jfs_symlink()
1046 d_instantiate(dentry, ip); jfs_symlink()
1063 static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, jfs_rename()
1064 struct inode *new_dir, struct dentry *new_dentry) jfs_rename()
1340 static int jfs_mknod(struct inode *dir, struct dentry *dentry, jfs_mknod() argument
1356 jfs_info("jfs_mknod: %pd", dentry); jfs_mknod()
1360 if ((rc = get_UCSname(&dname, dentry))) jfs_mknod()
1379 rc = jfs_init_security(tid, ip, dir, &dentry->d_name); jfs_mknod()
1426 d_instantiate(dentry, ip); jfs_mknod()
1437 static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) jfs_lookup() argument
1445 jfs_info("jfs_lookup: name = %pd", dentry); jfs_lookup()
1447 if ((rc = get_UCSname(&key, dentry))) jfs_lookup()
1462 return d_splice_alias(ip, dentry); jfs_lookup()
1484 struct dentry *jfs_fh_to_dentry(struct super_block *sb, struct fid *fid, jfs_fh_to_dentry()
1491 struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid, jfs_fh_to_parent()
1498 struct dentry *jfs_get_parent(struct dentry *dentry) jfs_get_parent() argument
1503 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot); jfs_get_parent()
1505 return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino)); jfs_get_parent()
1540 static int jfs_ci_hash(const struct dentry *dir, struct qstr *this) jfs_ci_hash()
1553 static int jfs_ci_compare(const struct dentry *parent, const struct dentry *dentry, jfs_ci_compare() argument
1569 static int jfs_ci_revalidate(struct dentry *dentry, unsigned int flags) jfs_ci_revalidate() argument
1572 * This is not negative dentry. Always valid. jfs_ci_revalidate()
1577 * We may be able to drop this positive dentry here. But dropping jfs_ci_revalidate()
1578 * positive dentry isn't good idea. So it's unsupported like jfs_ci_revalidate()
1581 if (d_really_is_positive(dentry)) jfs_ci_revalidate()
1592 * Drop the negative dentry, in order to make sure to use the jfs_ci_revalidate()
/linux-4.1.27/fs/fat/
H A Dnamei_vfat.c27 * negative-dentry which matches the created 8.3 alias.
29 * If it happened, the negative dentry isn't actually negative
32 static int vfat_revalidate_shortname(struct dentry *dentry) vfat_revalidate_shortname() argument
35 spin_lock(&dentry->d_lock); vfat_revalidate_shortname()
36 if (dentry->d_time != d_inode(dentry->d_parent)->i_version) vfat_revalidate_shortname()
38 spin_unlock(&dentry->d_lock); vfat_revalidate_shortname()
42 static int vfat_revalidate(struct dentry *dentry, unsigned int flags) vfat_revalidate() argument
47 /* This is not negative dentry. Always valid. */ vfat_revalidate()
48 if (d_really_is_positive(dentry)) vfat_revalidate()
50 return vfat_revalidate_shortname(dentry); vfat_revalidate()
53 static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags) vfat_revalidate_ci() argument
59 * This is not negative dentry. Always valid. vfat_revalidate_ci()
64 * We may be able to drop this positive dentry here. But dropping vfat_revalidate_ci()
65 * positive dentry isn't good idea. So it's unsupported like vfat_revalidate_ci()
68 if (d_really_is_positive(dentry)) vfat_revalidate_ci()
79 * Drop the negative dentry, in order to make sure to use the vfat_revalidate_ci()
86 return vfat_revalidate_shortname(dentry); vfat_revalidate_ci()
103 * Compute the hash for the vfat name corresponding to the dentry.
105 * that the existing dentry can be used. The vfat fs routines will
108 static int vfat_hash(const struct dentry *dentry, struct qstr *qstr) vfat_hash() argument
115 * Compute the hash for the vfat name corresponding to the dentry.
117 * that the existing dentry can be used. The vfat fs routines will
120 static int vfat_hashi(const struct dentry *dentry, struct qstr *qstr) vfat_hashi() argument
122 struct nls_table *t = MSDOS_SB(dentry->d_sb)->nls_io; vfat_hashi()
141 static int vfat_cmpi(const struct dentry *parent, const struct dentry *dentry, vfat_cmpi() argument
160 static int vfat_cmp(const struct dentry *parent, const struct dentry *dentry, vfat_cmp() argument
701 * (nfsd's) anonymous disconnected dentry?
704 static int vfat_d_anon_disconn(struct dentry *dentry) vfat_d_anon_disconn() argument
706 return IS_ROOT(dentry) && (dentry->d_flags & DCACHE_DISCONNECTED); vfat_d_anon_disconn()
709 static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, vfat_lookup() argument
715 struct dentry *alias; vfat_lookup()
720 err = vfat_find(dir, &dentry->d_name, &sinfo); vfat_lookup()
738 * Checking "alias->d_parent == dentry->d_parent" to make sure vfat_lookup()
741 if (alias && alias->d_parent == dentry->d_parent && vfat_lookup()
745 * dentry. This means, the user did ->lookup() by an vfat_lookup()
752 d_move(alias, dentry); vfat_lookup()
762 dentry->d_time = dir->i_version; vfat_lookup()
763 return d_splice_alias(inode, dentry); vfat_lookup()
769 static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, vfat_create() argument
781 err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); vfat_create()
796 d_instantiate(dentry, inode); vfat_create()
802 static int vfat_rmdir(struct inode *dir, struct dentry *dentry) vfat_rmdir() argument
804 struct inode *inode = d_inode(dentry); vfat_rmdir()
814 err = vfat_find(dir, &dentry->d_name, &sinfo); vfat_rmdir()
826 dentry->d_time = dir->i_version; vfat_rmdir()
833 static int vfat_unlink(struct inode *dir, struct dentry *dentry) vfat_unlink() argument
835 struct inode *inode = d_inode(dentry); vfat_unlink()
842 err = vfat_find(dir, &dentry->d_name, &sinfo); vfat_unlink()
852 dentry->d_time = dir->i_version; vfat_unlink()
859 static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) vfat_mkdir() argument
875 err = vfat_add_entry(dir, &dentry->d_name, 1, cluster, &ts, &sinfo); vfat_mkdir()
893 d_instantiate(dentry, inode); vfat_mkdir()
905 static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, vfat_rename()
906 struct inode *new_dir, struct dentry *new_dentry) vfat_rename()
1058 static struct dentry *vfat_mount(struct file_system_type *fs_type, vfat_mount()
H A Dnamei_msdos.c144 * Compute the hash for the msdos name corresponding to the dentry.
146 * that the existing dentry can be used. The msdos fs routines will
149 static int msdos_hash(const struct dentry *dentry, struct qstr *qstr) msdos_hash() argument
151 struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options; msdos_hash()
165 static int msdos_cmp(const struct dentry *parent, const struct dentry *dentry, msdos_cmp() argument
199 static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry, msdos_lookup() argument
208 err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); msdos_lookup()
221 return d_splice_alias(inode, dentry); msdos_lookup()
262 static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode, msdos_create() argument
274 err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, msdos_create()
278 is_hid = (dentry->d_name.name[0] == '.') && (msdos_name[0] != '.'); msdos_create()
299 d_instantiate(dentry, inode); msdos_create()
308 static int msdos_rmdir(struct inode *dir, struct dentry *dentry) msdos_rmdir() argument
311 struct inode *inode = d_inode(dentry); msdos_rmdir()
323 err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); msdos_rmdir()
344 static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) msdos_mkdir() argument
355 err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, msdos_mkdir()
359 is_hid = (dentry->d_name.name[0] == '.') && (msdos_name[0] != '.'); msdos_mkdir()
389 d_instantiate(dentry, inode); msdos_mkdir()
403 static int msdos_unlink(struct inode *dir, struct dentry *dentry) msdos_unlink() argument
405 struct inode *inode = d_inode(dentry); msdos_unlink()
411 err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); msdos_unlink()
430 struct dentry *old_dentry, do_msdos_rename()
432 struct dentry *new_dentry, int is_hid) do_msdos_rename()
598 static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, msdos_rename()
599 struct inode *new_dir, struct dentry *new_dentry) msdos_rename()
653 static struct dentry *msdos_mount(struct file_system_type *fs_type, msdos_mount()
/linux-4.1.27/drivers/ras/
H A Ddebugfs.c3 static struct dentry *ras_debugfs_dir;
39 struct dentry *fentry; ras_add_daemon_trace()
/linux-4.1.27/drivers/net/wireless/brcm80211/brcmfmac/
H A Ddebug.c26 static struct dentry *root_folder;
72 struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) brcmf_debugfs_get_devdir()
100 struct dentry *dentry = drvr->dbgfs_dir; brcmf_debugfs_add_entry() local
103 if (IS_ERR_OR_NULL(dentry)) brcmf_debugfs_add_entry()
113 dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry, brcmf_debugfs_add_entry()
116 return PTR_ERR_OR_ZERO(dentry); brcmf_debugfs_add_entry()
/linux-4.1.27/fs/ocfs2/dlm/
H A Ddlmdebug.h34 struct dentry *debug_state_dentry;
35 struct dentry *debug_lockres_dentry;
36 struct dentry *debug_mle_dentry;
37 struct dentry *debug_purgelist_dentry;
/linux-4.1.27/fs/ramfs/
H A Dinode.c93 ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) ramfs_mknod() argument
99 d_instantiate(dentry, inode); ramfs_mknod()
100 dget(dentry); /* Extra count - pin the dentry in core */ ramfs_mknod()
107 static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ramfs_mkdir() argument
109 int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0); ramfs_mkdir()
115 static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) ramfs_create() argument
117 return ramfs_mknod(dir, dentry, mode | S_IFREG, 0); ramfs_create()
120 static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char * symname) ramfs_symlink() argument
130 d_instantiate(dentry, inode); ramfs_symlink()
131 dget(dentry); ramfs_symlink()
239 struct dentry *ramfs_mount(struct file_system_type *fs_type, ramfs_mount()
/linux-4.1.27/fs/coda/
H A Dcoda_int.h4 struct dentry;
/linux-4.1.27/fs/fuse/
H A Dcontrol.c199 static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, fuse_ctl_add_dentry()
206 struct dentry *dentry; fuse_ctl_add_dentry() local
210 dentry = d_alloc_name(parent, name); fuse_ctl_add_dentry()
211 if (!dentry) fuse_ctl_add_dentry()
214 fc->ctl_dentry[fc->ctl_ndents++] = dentry; fuse_ctl_add_dentry()
230 d_add(dentry, inode); fuse_ctl_add_dentry()
231 return dentry; fuse_ctl_add_dentry()
240 struct dentry *parent; fuse_ctl_add_conn()
285 struct dentry *dentry = fc->ctl_dentry[i]; fuse_ctl_remove_conn() local
286 d_inode(dentry)->i_private = NULL; fuse_ctl_remove_conn()
287 d_drop(dentry); fuse_ctl_remove_conn()
288 dput(dentry); fuse_ctl_remove_conn()
319 static struct dentry *fuse_ctl_mount(struct file_system_type *fs_type, fuse_ctl_mount()
/linux-4.1.27/security/apparmor/include/
H A Dapparmorfs.h30 struct dentry *dentry; member in struct:aa_fs_entry
99 int __aa_fs_profile_mkdir(struct aa_profile *profile, struct dentry *parent);
101 int __aa_fs_namespace_mkdir(struct aa_namespace *ns, struct dentry *parent,
/linux-4.1.27/drivers/crypto/caam/
H A Dintern.h99 struct dentry *dfs_root;
100 struct dentry *ctl; /* controller dir */
101 struct dentry *ctl_rq_dequeued, *ctl_ob_enc_req, *ctl_ib_dec_req;
102 struct dentry *ctl_ob_enc_bytes, *ctl_ob_prot_bytes;
103 struct dentry *ctl_ib_dec_bytes, *ctl_ib_valid_bytes;
104 struct dentry *ctl_faultaddr, *ctl_faultdetail, *ctl_faultstatus;
107 struct dentry *ctl_kek, *ctl_tkek, *ctl_tdsk;
/linux-4.1.27/fs/ubifs/
H A Ddir.c184 static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, ubifs_lookup() argument
193 dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino); ubifs_lookup()
195 if (dentry->d_name.len > UBIFS_MAX_NLEN) ubifs_lookup()
202 dent_key_init(c, &key, dir->i_ino, &dentry->d_name); ubifs_lookup()
204 err = ubifs_tnc_lookup_nm(c, &key, dent, &dentry->d_name); ubifs_lookup()
213 if (dbg_check_name(c, dent, &dentry->d_name)) { ubifs_lookup()
226 dentry, err); ubifs_lookup()
237 d_add(dentry, inode); ubifs_lookup()
245 static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode, ubifs_create() argument
250 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_create()
261 dentry, mode, dir->i_ino); ubifs_create()
273 err = ubifs_init_security(dir, inode, &dentry->d_name); ubifs_create()
281 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); ubifs_create()
288 d_instantiate(dentry, inode); ubifs_create()
498 static int ubifs_link(struct dentry *old_dentry, struct inode *dir, ubifs_link() argument
499 struct dentry *dentry) ubifs_link()
505 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_link()
515 dentry, inode->i_ino, ubifs_link()
535 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); ubifs_link()
541 d_instantiate(dentry, inode); ubifs_link()
554 static int ubifs_unlink(struct inode *dir, struct dentry *dentry) ubifs_unlink() argument
557 struct inode *inode = d_inode(dentry); ubifs_unlink()
559 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_unlink()
572 dentry, inode->i_ino, ubifs_unlink()
593 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 1, 0); ubifs_unlink()
646 static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) ubifs_rmdir() argument
649 struct inode *inode = d_inode(dentry); ubifs_rmdir()
650 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_rmdir()
661 dbg_gen("directory '%pd', ino %lu in dir ino %lu", dentry, ubifs_rmdir()
665 err = check_dir_empty(c, d_inode(dentry)); ubifs_rmdir()
683 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 1, 0); ubifs_rmdir()
708 static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ubifs_mkdir() argument
713 int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_mkdir()
722 dentry, mode, dir->i_ino); ubifs_mkdir()
734 err = ubifs_init_security(dir, inode, &dentry->d_name); ubifs_mkdir()
745 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); ubifs_mkdir()
753 d_instantiate(dentry, inode); ubifs_mkdir()
769 static int ubifs_mknod(struct inode *dir, struct dentry *dentry, ubifs_mknod() argument
777 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_mknod()
788 dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino); ubifs_mknod()
819 err = ubifs_init_security(dir, inode, &dentry->d_name); ubifs_mknod()
827 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); ubifs_mknod()
834 d_instantiate(dentry, inode); ubifs_mknod()
849 static int ubifs_symlink(struct inode *dir, struct dentry *dentry, ubifs_symlink() argument
857 int sz_change = CALC_DENT_SIZE(dentry->d_name.len); ubifs_symlink()
867 dbg_gen("dent '%pd', target '%s' in dir ino %lu", dentry, ubifs_symlink()
900 err = ubifs_init_security(dir, inode, &dentry->d_name); ubifs_symlink()
908 err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); ubifs_symlink()
915 d_instantiate(dentry, inode); ubifs_symlink()
969 static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, ubifs_rename()
970 struct inode *new_dir, struct dentry *new_dentry) ubifs_rename()
1135 int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, ubifs_getattr() argument
1139 struct inode *inode = d_inode(dentry); ubifs_getattr()
/linux-4.1.27/fs/notify/
H A Dfsnotify.c48 * on a child we run all of our children and set a dentry flag saying that the
54 struct dentry *alias; __fsnotify_update_child_dentry_flags()
67 struct dentry *child; __fsnotify_update_child_dentry_flags()
89 /* Notify this dentry's parent about a child's events. */ __fsnotify_parent()
90 int __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) __fsnotify_parent() argument
92 struct dentry *parent; __fsnotify_parent()
96 if (!dentry) __fsnotify_parent()
97 dentry = path->dentry; __fsnotify_parent()
99 if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) __fsnotify_parent()
102 parent = dget_parent(dentry); __fsnotify_parent()
114 dentry->d_name.name, 0); __fsnotify_parent()
116 ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, __fsnotify_parent()
117 dentry->d_name.name, 0); __fsnotify_parent()

Completed in 3631 milliseconds

123456