mirror of
https://github.com/elliotnunn/machfs.git
synced 2025-02-19 11:31:05 +00:00
Fix bug in B*-tree size calculation
This commit is contained in:
parent
829d3a5189
commit
67edf73321
@ -183,14 +183,15 @@ def make_btree(records, bthKeyLen, blksize):
|
|||||||
most_recent[node.ndType] = i
|
most_recent[node.ndType] = i
|
||||||
bthFNode = most_recent.get(0xFF, 0)
|
bthFNode = most_recent.get(0xFF, 0)
|
||||||
|
|
||||||
|
bthFree = bitmanip.pad_up(len(nodelist), nodemult) - len(nodelist)
|
||||||
|
bthNNodes = len(nodelist) + bthFree
|
||||||
|
|
||||||
# Populate the first (header) record of the header node
|
# Populate the first (header) record of the header node
|
||||||
bthNodeSize = 512
|
bthNodeSize = 512
|
||||||
bthNNodes = len(nodelist); bthFree = 0
|
|
||||||
headnode.records[0] = struct.pack('>HLLLLHHLL76x',
|
headnode.records[0] = struct.pack('>HLLLLHHLL76x',
|
||||||
bthDepth, bthRoot, bthNRecs, bthFNode, bthLNode,
|
bthDepth, bthRoot, bthNRecs, bthFNode, bthLNode,
|
||||||
bthNodeSize, bthKeyLen, bthNNodes, bthFree)
|
bthNodeSize, bthKeyLen, bthNNodes, bthFree)
|
||||||
|
|
||||||
slop_nodes = bitmanip.pad_up(len(nodelist), nodemult) - len(nodelist)
|
nodelist.append(512 * bthFree)
|
||||||
nodelist.append(512 * slop_nodes)
|
|
||||||
|
|
||||||
return b''.join(bytes(node) for node in nodelist)
|
return b''.join(bytes(node) for node in nodelist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user