MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mqfs_destroy

Function mqfs_destroy

freebsd/kern/uipc_mqueue.c:557–585  ·  view source on GitHub ↗

* Destroy a node or a tree of nodes */

Source from the content-addressed store, hash-verified

555 * Destroy a node or a tree of nodes
556 */
557static int
558mqfs_destroy(struct mqfs_node *node)
559{
560 struct mqfs_node *parent;
561
562 KASSERT(node != NULL,
563 ("%s(): node is NULL", __func__));
564 KASSERT(node->mn_info != NULL,
565 ("%s(): node has no mn_info", __func__));
566
567 /* destroy children */
568 if (node->mn_type == mqfstype_dir || node->mn_type == mqfstype_root)
569 while (! LIST_EMPTY(&node->mn_children))
570 mqfs_destroy(LIST_FIRST(&node->mn_children));
571
572 /* unlink from parent */
573 if ((parent = node->mn_parent) != NULL) {
574 KASSERT(parent->mn_info == node->mn_info,
575 ("%s(): parent has different mn_info", __func__));
576 LIST_REMOVE(node, mn_sibling);
577 }
578
579 if (node->mn_fileno != 0)
580 mqfs_fileno_free(node->mn_info, node);
581 if (node->mn_data != NULL)
582 mqueue_free(node->mn_data);
583 mqnode_free(node);
584 return (0);
585}
586
587/*
588 * Mount a mqfs instance

Callers 4

mqnode_releaseFunction · 0.85
mqfs_create_dirFunction · 0.85
mqfs_uninitFunction · 0.85
mqfs_createFunction · 0.85

Calls 3

mqfs_fileno_freeFunction · 0.85
mqueue_freeFunction · 0.85
mqnode_freeFunction · 0.85

Tested by

no test coverage detected