Lines Matching refs:parent

59 	return strlcpy(buf, kn->parent ? kn->name : "/", buflen);  in kernfs_name_locked()
67 while (to->parent && to != from) { in kernfs_depth()
69 to = to->parent; in kernfs_depth()
87 a = a->parent; in kernfs_common_ancestor()
91 b = b->parent; in kernfs_common_ancestor()
97 b = b->parent; in kernfs_common_ancestor()
98 a = a->parent; in kernfs_common_ancestor()
171 kn = kn->parent; in kernfs_path_from_node_locked()
293 struct kernfs_node *parent; in kernfs_get_parent() local
297 parent = kn->parent; in kernfs_get_parent()
298 kernfs_get(parent); in kernfs_get_parent()
301 return parent; in kernfs_get_parent()
362 struct rb_node **node = &kn->parent->dir.children.rb_node; in kernfs_link_sibling()
363 struct rb_node *parent = NULL; in kernfs_link_sibling() local
370 parent = *node; in kernfs_link_sibling()
381 rb_link_node(&kn->rb, parent, node); in kernfs_link_sibling()
382 rb_insert_color(&kn->rb, &kn->parent->dir.children); in kernfs_link_sibling()
386 kn->parent->dir.subdirs++; in kernfs_link_sibling()
387 kernfs_inc_rev(kn->parent); in kernfs_link_sibling()
409 kn->parent->dir.subdirs--; in kernfs_unlink_sibling()
410 kernfs_inc_rev(kn->parent); in kernfs_unlink_sibling()
412 rb_erase(&kn->rb, &kn->parent->dir.children); in kernfs_unlink_sibling()
533 struct kernfs_node *parent; in kernfs_put() local
544 parent = kn->parent; in kernfs_put()
548 parent ? parent->name : "", kn->name, atomic_read(&kn->active)); in kernfs_put()
564 kn = parent; in kernfs_put()
595 struct kernfs_node *parent, in __kernfs_new_node() argument
646 if (parent) { in __kernfs_new_node()
647 ret = security_kernfs_init_security(parent, kn); in __kernfs_new_node()
663 struct kernfs_node *kernfs_new_node(struct kernfs_node *parent, in kernfs_new_node() argument
670 kn = __kernfs_new_node(kernfs_root(parent), parent, in kernfs_new_node()
673 kernfs_get(parent); in kernfs_new_node()
674 kn->parent = parent; in kernfs_new_node()
742 struct kernfs_node *parent = kn->parent; in kernfs_add_one() local
743 struct kernfs_root *root = kernfs_root(parent); in kernfs_add_one()
751 has_ns = kernfs_ns_enabled(parent); in kernfs_add_one()
753 has_ns ? "required" : "invalid", parent->name, kn->name)) in kernfs_add_one()
756 if (kernfs_type(parent) != KERNFS_DIR) in kernfs_add_one()
760 if (parent->flags & (KERNFS_REMOVING | KERNFS_EMPTY_DIR)) in kernfs_add_one()
770 ps_iattr = parent->iattr; in kernfs_add_one()
803 static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent, in kernfs_find_ns() argument
807 struct rb_node *node = parent->dir.children.rb_node; in kernfs_find_ns()
808 bool has_ns = kernfs_ns_enabled(parent); in kernfs_find_ns()
811 lockdep_assert_held(&kernfs_root(parent)->kernfs_rwsem); in kernfs_find_ns()
815 has_ns ? "required" : "invalid", parent->name, name); in kernfs_find_ns()
836 static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent, in kernfs_walk_ns() argument
843 lockdep_assert_held_read(&kernfs_root(parent)->kernfs_rwsem); in kernfs_walk_ns()
856 while ((name = strsep(&p, "/")) && parent) { in kernfs_walk_ns()
859 parent = kernfs_find_ns(parent, name, ns); in kernfs_walk_ns()
864 return parent; in kernfs_walk_ns()
877 struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, in kernfs_find_and_get_ns() argument
881 struct kernfs_root *root = kernfs_root(parent); in kernfs_find_and_get_ns()
884 kn = kernfs_find_ns(parent, name, ns); in kernfs_find_and_get_ns()
902 struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent, in kernfs_walk_and_get_ns() argument
906 struct kernfs_root *root = kernfs_root(parent); in kernfs_walk_and_get_ns()
909 kn = kernfs_walk_ns(parent, path, ns); in kernfs_walk_and_get_ns()
1012 struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, in kernfs_create_dir_ns() argument
1021 kn = kernfs_new_node(parent, name, mode | S_IFDIR, in kernfs_create_dir_ns()
1026 kn->dir.root = parent->dir.root; in kernfs_create_dir_ns()
1046 struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, in kernfs_create_empty_dir() argument
1053 kn = kernfs_new_node(parent, name, S_IRUGO|S_IXUGO|S_IFDIR, in kernfs_create_empty_dir()
1059 kn->dir.root = parent->dir.root; in kernfs_create_empty_dir()
1082 struct kernfs_node *parent; in kernfs_dop_revalidate() local
1088 parent = kernfs_dentry_node(dentry->d_parent); in kernfs_dop_revalidate()
1089 if (parent) { in kernfs_dop_revalidate()
1091 root = kernfs_root(parent); in kernfs_dop_revalidate()
1093 if (kernfs_dir_changed(parent, dentry)) { in kernfs_dop_revalidate()
1116 if (kernfs_dentry_node(dentry->d_parent) != kn->parent) in kernfs_dop_revalidate()
1124 if (kn->parent && kernfs_ns_enabled(kn->parent) && in kernfs_dop_revalidate()
1143 struct kernfs_node *parent = dir->i_private; in kernfs_iop_lookup() local
1149 root = kernfs_root(parent); in kernfs_iop_lookup()
1151 if (kernfs_ns_enabled(parent)) in kernfs_iop_lookup()
1154 kn = kernfs_find_ns(parent, dentry->d_name.name, ns); in kernfs_iop_lookup()
1175 kernfs_set_rev(parent, dentry); in kernfs_iop_lookup()
1186 struct kernfs_node *parent = dir->i_private; in kernfs_iop_mkdir() local
1187 struct kernfs_syscall_ops *scops = kernfs_root(parent)->syscall_ops; in kernfs_iop_mkdir()
1193 if (!kernfs_get_active(parent)) in kernfs_iop_mkdir()
1196 ret = scops->mkdir(parent, dentry->d_name.name, mode); in kernfs_iop_mkdir()
1198 kernfs_put_active(parent); in kernfs_iop_mkdir()
1315 return pos->parent; in kernfs_next_descendant_post()
1327 WARN_ON_ONCE(kn->parent && RB_EMPTY_NODE(&kn->rb)); in kernfs_activate_one()
1409 if (kn->parent && RB_EMPTY_NODE(&kn->rb)) in __kernfs_remove()
1440 if (!pos->parent || kernfs_unlink_sibling(pos)) { in __kernfs_remove()
1442 pos->parent ? pos->parent->iattr : NULL; in __kernfs_remove()
1618 int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, in kernfs_remove_by_name_ns() argument
1624 if (!parent) { in kernfs_remove_by_name_ns()
1630 root = kernfs_root(parent); in kernfs_remove_by_name_ns()
1633 kn = kernfs_find_ns(parent, name, ns); in kernfs_remove_by_name_ns()
1664 if (!kn->parent) in kernfs_rename_ns()
1676 if ((kn->parent == new_parent) && (kn->ns == new_ns) && in kernfs_rename_ns()
1703 old_parent = kn->parent; in kernfs_rename_ns()
1704 kn->parent = new_parent; in kernfs_rename_ns()
1739 struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos) in kernfs_dir_pos() argument
1743 pos->parent == parent && hash == pos->hash; in kernfs_dir_pos()
1749 struct rb_node *node = parent->dir.children.rb_node; in kernfs_dir_pos()
1773 struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos) in kernfs_dir_next_pos() argument
1775 pos = kernfs_dir_pos(ns, parent, ino, pos); in kernfs_dir_next_pos()
1791 struct kernfs_node *parent = kernfs_dentry_node(dentry); in kernfs_fop_readdir() local
1799 root = kernfs_root(parent); in kernfs_fop_readdir()
1802 if (kernfs_ns_enabled(parent)) in kernfs_fop_readdir()
1805 for (pos = kernfs_dir_pos(ns, parent, ctx->pos, pos); in kernfs_fop_readdir()
1807 pos = kernfs_dir_next_pos(ns, parent, ctx->pos, pos)) { in kernfs_fop_readdir()