Lines Matching refs:dentry
58 static char *get_dname(struct dentry *dentry) in get_dname() argument
62 int len = dentry->d_name.len; in get_dname()
64 dname = dentry->d_name.name; in get_dname()
73 static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umode_t mode) in tracefs_syscall_mkdir() argument
78 name = get_dname(dentry); in tracefs_syscall_mkdir()
96 static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry) in tracefs_syscall_rmdir() argument
101 name = get_dname(dentry); in tracefs_syscall_rmdir()
113 mutex_unlock(&dentry->d_inode->i_mutex); in tracefs_syscall_rmdir()
118 mutex_lock(&dentry->d_inode->i_mutex); in tracefs_syscall_rmdir()
165 static void change_gid(struct dentry *dentry, kgid_t gid) in change_gid() argument
167 if (!dentry->d_inode) in change_gid()
169 dentry->d_inode->i_gid = gid; in change_gid()
179 static void set_gid(struct dentry *parent, kgid_t gid) in set_gid()
181 struct dentry *this_parent; in set_gid()
193 struct dentry *dentry = list_entry(tmp, struct dentry, d_child); in set_gid() local
196 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in set_gid()
198 change_gid(dentry, gid); in set_gid()
200 if (!list_empty(&dentry->d_subdirs)) { in set_gid()
202 spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); in set_gid()
203 this_parent = dentry; in set_gid()
207 spin_unlock(&dentry->d_lock); in set_gid()
215 struct dentry *child = this_parent; in set_gid()
226 child = list_entry(next, struct dentry, d_child); in set_gid()
316 static int tracefs_show_options(struct seq_file *m, struct dentry *root) in tracefs_show_options()
374 static struct dentry *trace_mount(struct file_system_type *fs_type, in trace_mount()
389 static struct dentry *start_creating(const char *name, struct dentry *parent) in start_creating()
391 struct dentry *dentry; in start_creating() local
410 dentry = lookup_one_len(name, parent, strlen(name)); in start_creating()
411 if (!IS_ERR(dentry) && dentry->d_inode) { in start_creating()
412 dput(dentry); in start_creating()
413 dentry = ERR_PTR(-EEXIST); in start_creating()
416 if (IS_ERR(dentry)) { in start_creating()
421 return dentry; in start_creating()
424 static struct dentry *failed_creating(struct dentry *dentry) in failed_creating() argument
426 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); in failed_creating()
427 dput(dentry); in failed_creating()
432 static struct dentry *end_creating(struct dentry *dentry) in end_creating() argument
434 mutex_unlock(&dentry->d_parent->d_inode->i_mutex); in end_creating()
435 return dentry; in end_creating()
464 struct dentry *tracefs_create_file(const char *name, umode_t mode, in tracefs_create_file()
465 struct dentry *parent, void *data, in tracefs_create_file()
468 struct dentry *dentry; in tracefs_create_file() local
474 dentry = start_creating(name, parent); in tracefs_create_file()
476 if (IS_ERR(dentry)) in tracefs_create_file()
479 inode = tracefs_get_inode(dentry->d_sb); in tracefs_create_file()
481 return failed_creating(dentry); in tracefs_create_file()
486 inode->i_uid = d_inode(dentry->d_parent)->i_uid; in tracefs_create_file()
487 inode->i_gid = d_inode(dentry->d_parent)->i_gid; in tracefs_create_file()
488 d_instantiate(dentry, inode); in tracefs_create_file()
489 fsnotify_create(dentry->d_parent->d_inode, dentry); in tracefs_create_file()
490 return end_creating(dentry); in tracefs_create_file()
493 static struct dentry *__create_dir(const char *name, struct dentry *parent, in __create_dir()
496 struct dentry *dentry = start_creating(name, parent); in __create_dir() local
499 if (IS_ERR(dentry)) in __create_dir()
502 inode = tracefs_get_inode(dentry->d_sb); in __create_dir()
504 return failed_creating(dentry); in __create_dir()
510 inode->i_uid = d_inode(dentry->d_parent)->i_uid; in __create_dir()
511 inode->i_gid = d_inode(dentry->d_parent)->i_gid; in __create_dir()
515 d_instantiate(dentry, inode); in __create_dir()
516 inc_nlink(dentry->d_parent->d_inode); in __create_dir()
517 fsnotify_mkdir(dentry->d_parent->d_inode, dentry); in __create_dir()
518 return end_creating(dentry); in __create_dir()
538 struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) in tracefs_create_dir()
560 struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent, in tracefs_create_instance_dir()
564 struct dentry *dentry; in tracefs_create_instance_dir() local
570 dentry = __create_dir(name, parent, &tracefs_dir_inode_operations); in tracefs_create_instance_dir()
571 if (!dentry) in tracefs_create_instance_dir()
577 return dentry; in tracefs_create_instance_dir()
580 static int __tracefs_remove(struct dentry *dentry, struct dentry *parent) in __tracefs_remove() argument
584 if (simple_positive(dentry)) { in __tracefs_remove()
585 if (dentry->d_inode) { in __tracefs_remove()
586 dget(dentry); in __tracefs_remove()
587 switch (dentry->d_inode->i_mode & S_IFMT) { in __tracefs_remove()
589 ret = simple_rmdir(parent->d_inode, dentry); in __tracefs_remove()
592 simple_unlink(parent->d_inode, dentry); in __tracefs_remove()
596 d_delete(dentry); in __tracefs_remove()
597 dput(dentry); in __tracefs_remove()
612 void tracefs_remove(struct dentry *dentry) in tracefs_remove() argument
614 struct dentry *parent; in tracefs_remove()
617 if (IS_ERR_OR_NULL(dentry)) in tracefs_remove()
620 parent = dentry->d_parent; in tracefs_remove()
625 ret = __tracefs_remove(dentry, parent); in tracefs_remove()
639 void tracefs_remove_recursive(struct dentry *dentry) in tracefs_remove_recursive() argument
641 struct dentry *child, *parent; in tracefs_remove_recursive()
643 if (IS_ERR_OR_NULL(dentry)) in tracefs_remove_recursive()
646 parent = dentry->d_parent; in tracefs_remove_recursive()
650 parent = dentry; in tracefs_remove_recursive()
693 if (child != dentry) in tracefs_remove_recursive()