Lines Matching refs:dentry
150 static int debugfs_show_options(struct seq_file *m, struct dentry *root) in debugfs_show_options()
190 f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; in debugfs_automount()
191 return f(d_inode(path->dentry)->i_private); in debugfs_automount()
235 static struct dentry *debug_mount(struct file_system_type *fs_type, in debug_mount()
250 static struct dentry *start_creating(const char *name, struct dentry *parent) in start_creating()
252 struct dentry *dentry; in start_creating() local
274 dentry = lookup_one_len(name, parent, strlen(name)); in start_creating()
275 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { in start_creating()
276 dput(dentry); in start_creating()
277 dentry = ERR_PTR(-EEXIST); in start_creating()
280 if (IS_ERR(dentry)) { in start_creating()
285 return dentry; in start_creating()
288 static struct dentry *failed_creating(struct dentry *dentry) in failed_creating() argument
290 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); in failed_creating()
291 dput(dentry); in failed_creating()
296 static struct dentry *end_creating(struct dentry *dentry) in end_creating() argument
298 mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); in end_creating()
299 return dentry; in end_creating()
328 struct dentry *debugfs_create_file(const char *name, umode_t mode, in debugfs_create_file()
329 struct dentry *parent, void *data, in debugfs_create_file()
332 struct dentry *dentry; in debugfs_create_file() local
338 dentry = start_creating(name, parent); in debugfs_create_file()
340 if (IS_ERR(dentry)) in debugfs_create_file()
343 inode = debugfs_get_inode(dentry->d_sb); in debugfs_create_file()
345 return failed_creating(dentry); in debugfs_create_file()
350 d_instantiate(dentry, inode); in debugfs_create_file()
351 fsnotify_create(d_inode(dentry->d_parent), dentry); in debugfs_create_file()
352 return end_creating(dentry); in debugfs_create_file()
383 struct dentry *debugfs_create_file_size(const char *name, umode_t mode, in debugfs_create_file_size()
384 struct dentry *parent, void *data, in debugfs_create_file_size()
388 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); in debugfs_create_file_size()
414 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) in debugfs_create_dir()
416 struct dentry *dentry = start_creating(name, parent); in debugfs_create_dir() local
419 if (IS_ERR(dentry)) in debugfs_create_dir()
422 inode = debugfs_get_inode(dentry->d_sb); in debugfs_create_dir()
424 return failed_creating(dentry); in debugfs_create_dir()
432 d_instantiate(dentry, inode); in debugfs_create_dir()
433 inc_nlink(d_inode(dentry->d_parent)); in debugfs_create_dir()
434 fsnotify_mkdir(d_inode(dentry->d_parent), dentry); in debugfs_create_dir()
435 return end_creating(dentry); in debugfs_create_dir()
450 struct dentry *debugfs_create_automount(const char *name, in debugfs_create_automount()
451 struct dentry *parent, in debugfs_create_automount()
455 struct dentry *dentry = start_creating(name, parent); in debugfs_create_automount() local
458 if (IS_ERR(dentry)) in debugfs_create_automount()
461 inode = debugfs_get_inode(dentry->d_sb); in debugfs_create_automount()
463 return failed_creating(dentry); in debugfs_create_automount()
468 dentry->d_fsdata = (void *)f; in debugfs_create_automount()
469 d_instantiate(dentry, inode); in debugfs_create_automount()
470 return end_creating(dentry); in debugfs_create_automount()
497 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, in debugfs_create_symlink()
500 struct dentry *dentry; in debugfs_create_symlink() local
506 dentry = start_creating(name, parent); in debugfs_create_symlink()
507 if (IS_ERR(dentry)) { in debugfs_create_symlink()
512 inode = debugfs_get_inode(dentry->d_sb); in debugfs_create_symlink()
515 return failed_creating(dentry); in debugfs_create_symlink()
520 d_instantiate(dentry, inode); in debugfs_create_symlink()
521 return end_creating(dentry); in debugfs_create_symlink()
525 static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) in __debugfs_remove() argument
529 if (simple_positive(dentry)) { in __debugfs_remove()
530 dget(dentry); in __debugfs_remove()
531 if (d_is_dir(dentry)) in __debugfs_remove()
532 ret = simple_rmdir(d_inode(parent), dentry); in __debugfs_remove()
534 simple_unlink(d_inode(parent), dentry); in __debugfs_remove()
536 d_delete(dentry); in __debugfs_remove()
537 dput(dentry); in __debugfs_remove()
556 void debugfs_remove(struct dentry *dentry) in debugfs_remove() argument
558 struct dentry *parent; in debugfs_remove()
561 if (IS_ERR_OR_NULL(dentry)) in debugfs_remove()
564 parent = dentry->d_parent; in debugfs_remove()
569 ret = __debugfs_remove(dentry, parent); in debugfs_remove()
589 void debugfs_remove_recursive(struct dentry *dentry) in debugfs_remove_recursive() argument
591 struct dentry *child, *parent; in debugfs_remove_recursive()
593 if (IS_ERR_OR_NULL(dentry)) in debugfs_remove_recursive()
596 parent = dentry->d_parent; in debugfs_remove_recursive()
600 parent = dentry; in debugfs_remove_recursive()
643 if (child != dentry) in debugfs_remove_recursive()
672 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, in debugfs_rename()
673 struct dentry *new_dir, const char *new_name) in debugfs_rename()
676 struct dentry *dentry = NULL, *trap; in debugfs_rename() local
694 dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); in debugfs_rename()
696 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry)) in debugfs_rename()
702 dentry); in debugfs_rename()
707 d_move(old_dentry, dentry); in debugfs_rename()
713 dput(dentry); in debugfs_rename()
716 if (dentry && !IS_ERR(dentry)) in debugfs_rename()
717 dput(dentry); in debugfs_rename()