Lines Matching refs:root
31 static DEFINE_SPINLOCK(kernfs_idr_lock); /* root->ino_idr */
91 /* worst case b and a will be the same at root */
102 * where kn_from is treated as root of the path.
103 * @kn_from: kernfs node which should be treated as root for the path
210 * be on the same kernfs-root. If @from is not parent of @to, then a relative
468 struct kernfs_root *root = kernfs_root(kn);
482 wait_event(root->deactivate_waitq,
517 struct kernfs_root *root;
521 root = kernfs_root(kn);
543 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
552 /* just released the root kn, free @root too */
553 idr_destroy(&root->ino_idr);
554 kfree(root);
621 static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
641 ret = idr_alloc_cyclic(&root->ino_idr, kn, 1, 0, GFP_ATOMIC);
642 if (ret >= 0 && ret < root->last_id_lowbits)
643 root->id_highbits++;
644 id_highbits = root->id_highbits;
645 root->last_id_lowbits = ret;
683 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
722 * @root: the kernfs root
731 struct kernfs_node *kernfs_find_and_get_node_by_id(struct kernfs_root *root,
740 kn = idr_find(&root->ino_idr, (u32)ino);
964 * Returns the root of the new hierarchy on success, ERR_PTR() value on
970 struct kernfs_root *root;
973 root = kzalloc(sizeof(*root), GFP_KERNEL);
974 if (!root)
977 idr_init(&root->ino_idr);
978 INIT_LIST_HEAD(&root->supers);
987 root->id_highbits = 0;
989 root->id_highbits = 1;
991 kn = __kernfs_new_node(root, NULL, "", S_IFDIR | S_IRUGO | S_IXUGO,
995 idr_destroy(&root->ino_idr);
996 kfree(root);
1001 kn->dir.root = root;
1003 root->syscall_ops = scops;
1004 root->flags = flags;
1005 root->kn = kn;
1006 init_waitqueue_head(&root->deactivate_waitq);
1008 if (!(root->flags & KERNFS_ROOT_CREATE_DEACTIVATED))
1011 return root;
1016 * @root: root of the hierarchy to destroy
1018 * Destroy the hierarchy anchored at @root by removing all existing
1019 * directories and destroying @root.
1021 void kernfs_destroy_root(struct kernfs_root *root)
1023 kernfs_remove(root->kn); /* will also free @root */
1052 kn->dir.root = parent->dir.root;
1085 kn->dir.root = parent->dir.root;
1239 * @root: kernfs_node whose descendants to walk
1241 * Find the next descendant to visit for post-order traversal of @root's
1242 * descendants. @root is included in the iteration and the last node to be
1246 struct kernfs_node *root)
1252 /* if first iteration, visit leftmost descendant which may be root */
1254 return kernfs_leftmost_descendant(root);
1256 /* if we visited @root, we're done */
1257 if (pos == root)
1273 * If the root has KERNFS_ROOT_CREATE_DEACTIVATED set, a newly created node
1310 * Short-circuit if non-root @kn has already finished removal.
1564 /* can't move or rename root */