MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / n_new

Function n_new

dep/hfsutils/libhfs/node.c:72–98  ·  view source on GitHub ↗

* NAME: node->new() * DESCRIPTION: allocate a new b*-tree node */

Source from the content-addressed store, hash-verified

70 * DESCRIPTION: allocate a new b*-tree node
71 */
72int n_new(node *np)
73{
74 btree *bt = np->bt;
75 unsigned long num;
76
77 if (bt->hdr.bthFree == 0)
78 ERROR(EIO, "b*-tree full");
79
80 num = 0;
81 while (num < bt->hdr.bthNNodes && BMTST(bt->map, num))
82 ++num;
83
84 if (num == bt->hdr.bthNNodes)
85 ERROR(EIO, "free b*-tree node not found");
86
87 np->nnum = num;
88
89 BMSET(bt->map, num);
90 --bt->hdr.bthFree;
91
92 bt->flags |= HFS_BT_UPDATE_HDR;
93
94 return 0;
95
96fail:
97 return -1;
98}
99
100/*
101 * NAME: node->free()

Callers 3

splitFunction · 0.85
bt_spaceFunction · 0.85
bt_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected