aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r--fs/kernfs/dir.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 3cff0a233cd1..42a250f83b98 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -350,6 +350,24 @@ const struct dentry_operations kernfs_dops = {
350 .d_release = kernfs_dop_release, 350 .d_release = kernfs_dop_release,
351}; 351};
352 352
353/**
354 * kernfs_node_from_dentry - determine kernfs_node associated with a dentry
355 * @dentry: the dentry in question
356 *
357 * Return the kernfs_node associated with @dentry. If @dentry is not a
358 * kernfs one, %NULL is returned.
359 *
360 * While the returned kernfs_node will stay accessible as long as @dentry
361 * is accessible, the returned node can be in any state and the caller is
362 * fully responsible for determining what's accessible.
363 */
364struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
365{
366 if (dentry->d_op == &kernfs_dops)
367 return dentry->d_fsdata;
368 return NULL;
369}
370
353static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root, 371static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
354 const char *name, umode_t mode, 372 const char *name, umode_t mode,
355 unsigned flags) 373 unsigned flags)