Renamed scratch files -> orphan files

I was originally avoiding naming these orphans, as they're _technically_
not orphans. They do exist in the mtree. But the name orphan just
describes this types purpose too well.

This does lead to some confusing terms, such as the fact that orphan
files can be non-orphaned if there are any in-device references. But I
think this makes sense?

- LFSR_TAG_SCRATCH -> LFSR_TAG_ORPHAN
- LFSR_F_UNCREAT -> LFSR_F_ORPHAN
- test_fscratch.toml -> test_forphan.toml
This commit is contained in:
Christopher Haster
2024-01-16 22:13:58 -06:00
parent f6742eefb3
commit 15593ccc49
8 changed files with 97 additions and 100 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ TAG_GRMDELTA = 0x0100
TAG_NAME = 0x0200
TAG_REG = 0x0201
TAG_DIR = 0x0202
TAG_SCRATCH = 0x0203
TAG_ORPHAN = 0x0203
TAG_BOOKMARK = 0x0204
TAG_STRUCT = 0x0300
TAG_DATA = 0x0300
+2 -2
View File
@@ -24,7 +24,7 @@ TAG_GRMDELTA = 0x0100
TAG_NAME = 0x0200
TAG_REG = 0x0201
TAG_DIR = 0x0202
TAG_SCRATCH = 0x0203
TAG_ORPHAN = 0x0203
TAG_BOOKMARK = 0x0204
TAG_STRUCT = 0x0300
TAG_DATA = 0x0300
@@ -188,7 +188,7 @@ def tagrepr(tag, w, size, off=None):
'name' if (tag & 0xfff) == TAG_NAME
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
else 'scratch' if (tag & 0xfff) == TAG_SCRATCH
else 'orphan' if (tag & 0xfff) == TAG_ORPHAN
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'name 0x%02x' % (tag & 0xff),
' w%d' % w if w else '',
+9 -9
View File
@@ -25,7 +25,7 @@ TAG_GRMDELTA = 0x0100
TAG_NAME = 0x0200
TAG_REG = 0x0201
TAG_DIR = 0x0202
TAG_SCRATCH = 0x0203
TAG_ORPHAN = 0x0203
TAG_BOOKMARK = 0x0204
TAG_STRUCT = 0x0300
TAG_DATA = 0x0300
@@ -219,7 +219,7 @@ def tagrepr(tag, w, size, off=None):
'name' if (tag & 0xfff) == TAG_NAME
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
else 'scratch' if (tag & 0xfff) == TAG_SCRATCH
else 'orphan' if (tag & 0xfff) == TAG_ORPHAN
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'name 0x%02x' % (tag & 0xff),
' w%d' % w if w else '',
@@ -1181,7 +1181,7 @@ class GState:
yield grepr(tag, data), tag, data
def frepr(mdir, rid, tag):
if tag == TAG_REG or tag == TAG_SCRATCH:
if tag == TAG_REG or tag == TAG_ORPHAN:
size = 0
structs = []
# inlined data?
@@ -1208,7 +1208,7 @@ def frepr(mdir, rid, tag):
size = max(size, weight)
structs.append('btree 0x%x.%x' % (block, trunk))
return '%s %s' % (
'scratch' if tag == TAG_SCRATCH else 'reg',
'orphan' if tag == TAG_ORPHAN else 'reg',
', '.join(it.chain(['%d' % size], structs)))
elif tag == TAG_DIR:
@@ -1983,8 +1983,8 @@ def main(disk, mroots=None, *,
# skip bookmarks
if tag == TAG_BOOKMARK:
continue
# skip scratch files
if tag == TAG_SCRATCH:
# skip orphans
if tag == TAG_ORPHAN:
continue
# skip grmed entries
if (max(mbid-max(mw-1, 0), 0), rid) in gstate.grm:
@@ -2036,7 +2036,7 @@ def main(disk, mroots=None, *,
else '\x1b[90m'
if color and (grmed
or tag == TAG_BOOKMARK
or tag == TAG_SCRATCH)
or tag == TAG_ORPHAN)
else '',
'{%s}:' % ','.join('%04x' % block
for block in it.chain([mdir.block],
@@ -2055,7 +2055,7 @@ def main(disk, mroots=None, *,
notes
or grmed
or tag == TAG_BOOKMARK
or tag == TAG_SCRATCH)
or tag == TAG_ORPHAN)
else ''))
pmbid = mbid
@@ -2099,7 +2099,7 @@ def main(disk, mroots=None, *,
line))
# print file contents?
if ((tag == TAG_REG or tag == TAG_SCRATCH)
if ((tag == TAG_REG or tag == TAG_ORPHAN)
and args.get('structs')):
# inlined sprout?
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(
+2 -2
View File
@@ -24,7 +24,7 @@ TAG_GRMDELTA = 0x0100
TAG_NAME = 0x0200
TAG_REG = 0x0201
TAG_DIR = 0x0202
TAG_SCRATCH = 0x0203
TAG_ORPHAN = 0x0203
TAG_BOOKMARK = 0x0204
TAG_STRUCT = 0x0300
TAG_DATA = 0x0300
@@ -203,7 +203,7 @@ def tagrepr(tag, w, size, off=None):
'name' if (tag & 0xfff) == TAG_NAME
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
else 'scratch' if (tag & 0xfff) == TAG_SCRATCH
else 'orphan' if (tag & 0xfff) == TAG_ORPHAN
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'name 0x%02x' % (tag & 0xff),
' w%d' % w if w else '',
+2 -2
View File
@@ -33,7 +33,7 @@ TAG_GRMDELTA = 0x0100
TAG_NAME = 0x0200
TAG_REG = 0x0201
TAG_DIR = 0x0202
TAG_SCRATCH = 0x0203
TAG_ORPHAN = 0x0203
TAG_BOOKMARK = 0x0204
TAG_STRUCT = 0x0300
TAG_DATA = 0x0300
@@ -190,7 +190,7 @@ def tagrepr(tag, w, size, off=None):
'name' if (tag & 0xfff) == TAG_NAME
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
else 'scratch' if (tag & 0xfff) == TAG_SCRATCH
else 'orphan' if (tag & 0xfff) == TAG_ORPHAN
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'name 0x%02x' % (tag & 0xff),
' w%d' % w if w else '',