mirror of
https://github.com/elliotnunn/machfs.git
synced 2025-02-19 11:31:05 +00:00
ready to factor slightly
This commit is contained in:
parent
0d09bae64e
commit
3a65952861
6
thing.py
6
thing.py
@ -106,13 +106,15 @@ class _Node:
|
||||
def _mkbtree(records, bthKeyLen):
|
||||
nodelist = [] # append to this as we go
|
||||
|
||||
index_step = 8 # pointers per index node; min=2, max=11
|
||||
# pointers per index node, range 2-11
|
||||
index_step = 8 # not really worth tuning
|
||||
|
||||
# First node is always a header node, with three records:
|
||||
# header records, reserved record, bitmap record
|
||||
headnode = _Node(ndType=1, ndNHeight=0, records=['header placeholder', bytes(128), 'bitmap placeholder'])
|
||||
nodelist.append(headnode)
|
||||
|
||||
# Followed (in our implementation) by leaf nodes
|
||||
bthNRecs = 0
|
||||
bthRoot = 0
|
||||
bthDepth = 0
|
||||
@ -158,7 +160,7 @@ def _mkbtree(records, bthKeyLen):
|
||||
# Add map nodes with 3952-bit bitmap recs to cover every node
|
||||
bits_covered = 2048
|
||||
mapnodes = []
|
||||
while bits_covered < len(nodelist): # THIS ID NUMBER IS WRONG!
|
||||
while bits_covered < len(nodelist):
|
||||
mapnode = _Node(ndType=2, ndNHeight=1)
|
||||
nodelist.append(mapnode)
|
||||
mapnodes.append(mapnode)
|
||||
|
@ -22,7 +22,7 @@ def test_macos_mount():
|
||||
h.drVN = b'ElmoTest'
|
||||
hf = File()
|
||||
hf.data = b'12345' * 10
|
||||
for i in range(100):
|
||||
for i in reversed(range(100)):
|
||||
last = b'testfile-%03d' % i
|
||||
h[last] = hf
|
||||
ser = h.write(10*1024*1024)
|
||||
@ -32,7 +32,7 @@ def test_macos_mount():
|
||||
assert h2[b'testfile-000'].data == hf.data
|
||||
|
||||
open('/tmp/SMALL.dmg','wb').write(ser)
|
||||
os.system('open /tmp/SMALL.dmg')
|
||||
os.system('hdiutil attach /tmp/SMALL.dmg')
|
||||
n = 10
|
||||
while 1:
|
||||
n += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user