Lines Matching refs:dentry

46 			   struct dentry *dentry, struct iattr *ia)
55 return simple_setattr(&nop_mnt_idmap, dentry, ia);
206 static int debugfs_show_options(struct seq_file *m, struct dentry *root)
237 static void debugfs_release_dentry(struct dentry *dentry)
239 struct debugfs_fsdata *fsd = dentry->d_fsdata;
249 struct debugfs_fsdata *fsd = path->dentry->d_fsdata;
251 return fsd->automount(path->dentry, d_inode(path->dentry)->i_private);
294 static struct dentry *debug_mount(struct file_system_type *fs_type,
315 * @parent: a pointer to the parent dentry of the file.
317 * This function will return a pointer to a dentry if it succeeds. If the file
319 * dentry must be passed to dput() when it is no longer needed.
324 struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
326 struct dentry *dentry;
334 dentry = lookup_positive_unlocked(name, parent, strlen(name));
335 if (IS_ERR(dentry))
337 return dentry;
341 static struct dentry *start_creating(const char *name, struct dentry *parent)
343 struct dentry *dentry;
365 * We need the root dentry to do this, which is in the super
374 dentry = ERR_PTR(-ENOENT);
376 dentry = lookup_one_len(name, parent, strlen(name));
377 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
378 if (d_is_dir(dentry))
384 dput(dentry);
385 dentry = ERR_PTR(-EEXIST);
388 if (IS_ERR(dentry)) {
393 return dentry;
396 static struct dentry *failed_creating(struct dentry *dentry)
398 inode_unlock(d_inode(dentry->d_parent));
399 dput(dentry);
404 static struct dentry *end_creating(struct dentry *dentry)
406 inode_unlock(d_inode(dentry->d_parent));
407 return dentry;
410 static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
411 struct dentry *parent, void *data,
415 struct dentry *dentry;
421 dentry = start_creating(name, parent);
423 if (IS_ERR(dentry))
424 return dentry;
427 failed_creating(dentry);
431 inode = debugfs_get_inode(dentry->d_sb);
435 return failed_creating(dentry);
443 dentry->d_fsdata = (void *)((unsigned long)real_fops |
446 d_instantiate(dentry, inode);
447 fsnotify_create(d_inode(dentry->d_parent), dentry);
448 return end_creating(dentry);
455 * @parent: a pointer to the parent dentry for this file. This should be a
456 * directory dentry if set. If this parameter is NULL, then the
469 * This function will return a pointer to a dentry if it succeeds. This
479 * by this function. Other debugfs functions handle the fact that the "dentry"
483 struct dentry *debugfs_create_file(const char *name, umode_t mode,
484 struct dentry *parent, void *data,
499 * @parent: a pointer to the parent dentry for this file. This should be a
500 * directory dentry if set. If this parameter is NULL, then the
522 struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
523 struct dentry *parent, void *data,
538 * @parent: a pointer to the parent dentry for this file. This should be a
539 * directory dentry if set. If this parameter is NULL, then the
554 struct dentry *parent, void *data,
558 struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
569 * @parent: a pointer to the parent dentry for this file. This should be a
570 * directory dentry if set. If this parameter is NULL, then the
575 * This function will return a pointer to a dentry if it succeeds. This
585 * by this function. Other debugfs functions handle the fact that the "dentry"
589 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
591 struct dentry *dentry = start_creating(name, parent);
594 if (IS_ERR(dentry))
595 return dentry;
598 failed_creating(dentry);
602 inode = debugfs_get_inode(dentry->d_sb);
606 return failed_creating(dentry);
615 d_instantiate(dentry, inode);
616 inc_nlink(d_inode(dentry->d_parent));
617 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
618 return end_creating(dentry);
625 * @parent: a pointer to the parent dentry for this file. This should be a
626 * directory dentry if set. If this parameter is NULL, then the
633 struct dentry *debugfs_create_automount(const char *name,
634 struct dentry *parent,
638 struct dentry *dentry = start_creating(name, parent);
642 if (IS_ERR(dentry))
643 return dentry;
647 failed_creating(dentry);
654 failed_creating(dentry);
659 inode = debugfs_get_inode(dentry->d_sb);
664 return failed_creating(dentry);
670 dentry->d_fsdata = fsd;
673 d_instantiate(dentry, inode);
674 inc_nlink(d_inode(dentry->d_parent));
675 fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
676 return end_creating(dentry);
684 * @parent: a pointer to the parent dentry for this symbolic link. This
685 * should be a directory dentry if set. If this parameter is NULL,
694 * This function will return a pointer to a dentry if it succeeds. This
703 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
706 struct dentry *dentry;
712 dentry = start_creating(name, parent);
713 if (IS_ERR(dentry)) {
715 return dentry;
718 inode = debugfs_get_inode(dentry->d_sb);
723 return failed_creating(dentry);
728 d_instantiate(dentry, inode);
729 return end_creating(dentry);
733 static void __debugfs_file_removed(struct dentry *dentry)
740 * debugfs_file_get() must see a dead dentry or we must see a
744 fsd = READ_ONCE(dentry->d_fsdata);
751 static void remove_one(struct dentry *victim)
760 * @dentry: a pointer to a the dentry of the directory to be removed. If this
771 void debugfs_remove(struct dentry *dentry)
773 if (IS_ERR_OR_NULL(dentry))
777 simple_recursive_removal(dentry, remove_one);
785 * @parent: a pointer to the parent dentry of the item.
791 void debugfs_lookup_and_remove(const char *name, struct dentry *parent)
793 struct dentry *dentry;
795 dentry = debugfs_lookup(name, parent);
796 if (!dentry)
799 debugfs_remove(dentry);
800 dput(dentry);
806 * @old_dir: a pointer to the parent dentry for the renamed object. This
807 * should be a directory dentry.
808 * @old_dentry: dentry of an object to be renamed.
809 * @new_dir: a pointer to the parent dentry where the object should be
810 * moved. This should be a directory dentry.
823 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
824 struct dentry *new_dir, const char *new_name)
827 struct dentry *dentry = NULL, *trap;
845 dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
847 if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry))
853 d_inode(new_dir), dentry, 0);
858 d_move(old_dentry, dentry);
864 dput(dentry);
867 if (dentry && !IS_ERR(dentry))
868 dput(dentry);
870 if (IS_ERR(dentry))
871 return dentry;