From d308ec83223255d377868da110bead3daac031d0 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sun, 27 Apr 2025 11:25:53 -0500 Subject: [PATCH] Reworked tag encoding a little bit Mainly to make room for some future planned stuff: - Moved the mroot's redund bits from LFSR_TAG_GEOMETRY to LFSR_TAG_MAGIC: LFSR_TAG_MAGIC 0x003r v--- ---- --11 --rr This has the benefit of living in a fixed location (off=0x5), which may make mounting/debugging easier. It also makes LFSR_TAG_GEOMETRY less of a special case (LFSR_TAG_MAGIC is already a _very_ special case). Unfortunately, this does get in the way of our previous magic=0x3 encoding. To compensate (and to avoid conflicts with LFSR_TAG_NULL), I've added the 0x3_ prefix. This has the funny side-effect of rendering redunds 0-3 as ascii 0-3 (0x30-0x33), which is a complete accident but may actually be useful when debugging. Currently all config tags fit in the 0x3_ prefix, which is nice for debugging but not a hard requirement. - Flipped LFSR_TAG_FILELIMIT/NAMELIMIT: LFSR_TAG_FILELIMIT 0x0039 v--- ---- --11 1--1 LFSR_TAG_NAMELIMIT 0x003a v--- ---- --11 1-1- The file limit is a _bit_ more fundamental. It's effectively the required integer size for the filesystem. These may also be followed by LFSR_TAG_ATTRLIMIT based on how future attr revisits go. - Rearranged struct tags so that LFSR_TAG_BRANCH = 0x300: LFSR_TAG_BRANCH 0x030r v--- --11 ---- --rr LFSR_TAG_DATA 0x0304 v--- --11 ---- -1-- LFSR_TAG_BLOCK 0x0308 v--- --11 ---- 1err LFSR_TAG_DDKEY* 0x0310 v--- --11 ---1 ---- LFSR_TAG_DID 0x0314 v--- --11 ---1 -1-- LFSR_TAG_BSHRUB 0x0318 v--- --11 ---1 1--- LFSR_TAG_BTREE 0x031c v--- --11 ---1 11rr LFSR_TAG_MROOT 0x032r v--- --11 --1- --rr LFSR_TAG_MDIR 0x0324 v--- --11 --1- -1rr LFSR_TAG_MTREE 0x032c v--- --11 --1- 11rr *Planned LFSR_TAG_BRANCH is a very special tag when it comes to bshrub/btree traversal, so I think it deserves the subtype=0 slot. This also just makes everything fit together better, and makes room for the future planned ddkey tag. Code changes minimal: code stack ctx before: 35728 2440 640 after: 35732 (+0.0%) 2440 (+0.0%) 640 (+0.0%) --- lfs.c | 93 ++++++++++++++++++++++--------------------- scripts/dbgbmap.py | 48 +++++++++++----------- scripts/dbgbmapd3.py | 48 +++++++++++----------- scripts/dbgbtree.py | 46 ++++++++++----------- scripts/dbglfs.py | 48 +++++++++++----------- scripts/dbgmtree.py | 46 ++++++++++----------- scripts/dbgrbyd.py | 46 ++++++++++----------- scripts/dbgtag.py | 46 ++++++++++----------- tests/test_mount.toml | 2 +- 9 files changed, 212 insertions(+), 211 deletions(-) diff --git a/lfs.c b/lfs.c index b20698c7..5a7ba125 100644 --- a/lfs.c +++ b/lfs.c @@ -1096,14 +1096,15 @@ enum lfsr_tag { // config tags LFSR_TAG_CONFIG = 0x0000, - LFSR_TAG_MAGIC = 0x0003, - LFSR_TAG_VERSION = 0x0004, - LFSR_TAG_RCOMPAT = 0x0005, - LFSR_TAG_WCOMPAT = 0x0006, - LFSR_TAG_OCOMPAT = 0x0007, - LFSR_TAG_GEOMETRY = 0x0009, - LFSR_TAG_NAMELIMIT = 0x000c, - LFSR_TAG_FILELIMIT = 0x000d, + LFSR_TAG_MAGIC = 0x0031, + LFSR_TAG_VERSION = 0x0034, + LFSR_TAG_RCOMPAT = 0x0035, + LFSR_TAG_WCOMPAT = 0x0036, + LFSR_TAG_OCOMPAT = 0x0037, + LFSR_TAG_GEOMETRY = 0x0038, + LFSR_TAG_FILELIMIT = 0x0039, + LFSR_TAG_NAMELIMIT = 0x003a, + LFSR_TAG_UNKNOWNCONFIG = 0x003b, // global-state tags LFSR_TAG_GDELTA = 0x0100, @@ -1123,15 +1124,15 @@ enum lfsr_tag { // struct tags LFSR_TAG_STRUCT = 0x0300, - LFSR_TAG_DATA = 0x0300, - LFSR_TAG_BLOCK = 0x0304, - LFSR_TAG_BSHRUB = 0x0308, - LFSR_TAG_BTREE = 0x030c, - LFSR_TAG_MROOT = 0x0311, - LFSR_TAG_MDIR = 0x0315, - LFSR_TAG_MTREE = 0x031c, - LFSR_TAG_DID = 0x0320, - LFSR_TAG_BRANCH = 0x032c, + LFSR_TAG_BRANCH = 0x0300, + LFSR_TAG_DATA = 0x0304, + LFSR_TAG_BLOCK = 0x0308, + LFSR_TAG_DID = 0x0314, + LFSR_TAG_BSHRUB = 0x0318, + LFSR_TAG_BTREE = 0x031c, + LFSR_TAG_MROOT = 0x0321, + LFSR_TAG_MDIR = 0x0325, + LFSR_TAG_MTREE = 0x032c, // user/sys attributes LFSR_TAG_ATTR = 0x0400, @@ -3508,8 +3509,8 @@ static int lfsr_rbyd_appendrattr_(lfs_t *lfs, lfsr_rbyd_t *rbyd, // leb128? } else if (rattr.count >= 0 - && (rattr.tag == LFSR_TAG_NAMELIMIT - || rattr.tag == LFSR_TAG_FILELIMIT + && (rattr.tag == LFSR_TAG_FILELIMIT + || rattr.tag == LFSR_TAG_NAMELIMIT || rattr.tag == LFSR_TAG_DID)) { // leb128s should not exceed 31-bits LFS_ASSERT(rattr.u.leb128 <= 0x7fffffff); @@ -13818,32 +13819,6 @@ static int lfsr_mountmroot(lfs_t *lfs, const lfsr_mdir_t *mroot) { lfs->block_count = geometry.block_count; - // read the name limit - lfs_size_t name_limit = 0xff; - err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_NAMELIMIT, - NULL, &data); - if (err && err != LFS_ERR_NOENT) { - return err; - } - if (err != LFS_ERR_NOENT) { - err = lfsr_data_readleb128(lfs, &data, &name_limit); - if (err && err != LFS_ERR_CORRUPT) { - return err; - } - if (err == LFS_ERR_CORRUPT) { - name_limit = -1; - } - } - - if (name_limit > lfs->name_limit) { - LFS_ERROR("Incompatible name limit %"PRId32" (> %"PRId32")", - name_limit, - lfs->name_limit); - return LFS_ERR_NOTSUP; - } - - lfs->name_limit = name_limit; - // read the file limit lfs_off_t file_limit = 0x7fffffff; err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_FILELIMIT, @@ -13870,9 +13845,35 @@ static int lfsr_mountmroot(lfs_t *lfs, const lfsr_mdir_t *mroot) { lfs->file_limit = file_limit; + // read the name limit + lfs_size_t name_limit = 0xff; + err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_NAMELIMIT, + NULL, &data); + if (err && err != LFS_ERR_NOENT) { + return err; + } + if (err != LFS_ERR_NOENT) { + err = lfsr_data_readleb128(lfs, &data, &name_limit); + if (err && err != LFS_ERR_CORRUPT) { + return err; + } + if (err == LFS_ERR_CORRUPT) { + name_limit = -1; + } + } + + if (name_limit > lfs->name_limit) { + LFS_ERROR("Incompatible name limit %"PRId32" (> %"PRId32")", + name_limit, + lfs->name_limit); + return LFS_ERR_NOTSUP; + } + + lfs->name_limit = name_limit; + // check for unknown configs lfsr_tag_t tag; - err = lfsr_mdir_lookupnext(lfs, mroot, LFSR_TAG_FILELIMIT+1, + err = lfsr_mdir_lookupnext(lfs, mroot, LFSR_TAG_UNKNOWNCONFIG, &tag, NULL); if (err && err != LFS_ERR_NOENT) { return err; diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index fe3d2712..1d05810c 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -31,31 +31,31 @@ except ModuleNotFoundError: TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -289,8 +289,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -326,15 +326,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -2500,6 +2500,7 @@ class Config: # the filesystem magic string class Magic(Config): tag = TAG_MAGIC + mask = 0x3 def repr(self): return 'magic \"%s\"' % ( @@ -2548,7 +2549,6 @@ class Config: # block device geometry class Geometry(Config): tag = TAG_GEOMETRY - mask = 0x3 def __init__(self, mroot, tag, rattr): super().__init__(mroot, tag, rattr) diff --git a/scripts/dbgbmapd3.py b/scripts/dbgbmapd3.py index 54b00f60..88dd42cc 100755 --- a/scripts/dbgbmapd3.py +++ b/scripts/dbgbmapd3.py @@ -29,31 +29,31 @@ except ModuleNotFoundError: TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -319,8 +319,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -356,15 +356,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -2530,6 +2530,7 @@ class Config: # the filesystem magic string class Magic(Config): tag = TAG_MAGIC + mask = 0x3 def repr(self): return 'magic \"%s\"' % ( @@ -2578,7 +2579,6 @@ class Config: # block device geometry class Geometry(Config): tag = TAG_GEOMETRY - mask = 0x3 def __init__(self, mroot, tag, rattr): super().__init__(mroot, tag, rattr) diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 5188c6ba..c667114d 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -20,31 +20,31 @@ except ModuleNotFoundError: TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -197,8 +197,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -234,15 +234,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index a0f65f16..cd7feeab 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -21,31 +21,31 @@ except ModuleNotFoundError: TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -246,8 +246,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -283,15 +283,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -2457,6 +2457,7 @@ class Config: # the filesystem magic string class Magic(Config): tag = TAG_MAGIC + mask = 0x3 def repr(self): return 'magic \"%s\"' % ( @@ -2505,7 +2506,6 @@ class Config: # block device geometry class Geometry(Config): tag = TAG_GEOMETRY - mask = 0x3 def __init__(self, mroot, tag, rattr): super().__init__(mroot, tag, rattr) diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index e6c445a0..44576205 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -20,31 +20,31 @@ except ModuleNotFoundError: TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -212,8 +212,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -249,15 +249,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index abe4ecf5..a5a671ac 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -30,31 +30,31 @@ COLORS = [ TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -200,8 +200,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -237,15 +237,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') diff --git a/scripts/dbgtag.py b/scripts/dbgtag.py index 33813a47..8ebeedaa 100755 --- a/scripts/dbgtag.py +++ b/scripts/dbgtag.py @@ -13,31 +13,31 @@ import sys TAG_NULL = 0x0000 ## 0x0000 v--- ---- ---- ---- TAG_CONFIG = 0x0000 ## 0x00tt v--- ---- -ttt tttt -TAG_MAGIC = 0x0003 # 0x0003 v--- ---- ---- --11 -TAG_VERSION = 0x0004 # 0x0004 v--- ---- ---- -1-- -TAG_RCOMPAT = 0x0005 # 0x0005 v--- ---- ---- -1-1 -TAG_WCOMPAT = 0x0006 # 0x0006 v--- ---- ---- -11- -TAG_OCOMPAT = 0x0007 # 0x0007 v--- ---- ---- -111 -TAG_GEOMETRY = 0x0009 # 0x0008 v--- ---- ---- 1-rr -TAG_NAMELIMIT = 0x000c # 0x000c v--- ---- ---- 11-- -TAG_FILELIMIT = 0x000d # 0x000d v--- ---- ---- 11-1 -TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt tttt +TAG_MAGIC = 0x0031 # 0x003r v--- ---- --11 --rr +TAG_VERSION = 0x0034 # 0x0034 v--- ---- --11 -1-- +TAG_RCOMPAT = 0x0035 # 0x0035 v--- ---- --11 -1-1 +TAG_WCOMPAT = 0x0036 # 0x0036 v--- ---- --11 -11- +TAG_OCOMPAT = 0x0037 # 0x0037 v--- ---- --11 -111 +TAG_GEOMETRY = 0x0038 # 0x0038 v--- ---- --11 1--- +TAG_FILELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1 +TAG_NAMELIMIT = 0x003a # 0x003a v--- ---- --11 1-1- +TAG_GDELTA = 0x0100 ## 0x01tt v--- ---1 -ttt ttrr TAG_GRMDELTA = 0x0100 # 0x0100 v--- ---1 ---- ---- TAG_NAME = 0x0200 ## 0x02tt v--- --1- -ttt tttt TAG_REG = 0x0201 # 0x0201 v--- --1- ---- ---1 TAG_DIR = 0x0202 # 0x0202 v--- --1- ---- --1- TAG_STICKYNOTE = 0x0203 # 0x0203 v--- --1- ---- --11 TAG_BOOKMARK = 0x0204 # 0x0204 v--- --1- ---- -1-- -TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt tttt -TAG_DATA = 0x0300 # 0x0300 v--- --11 ---- ---- -TAG_BLOCK = 0x0304 # 0x0304 v--- --11 ---- -1rr -TAG_BSHRUB = 0x0308 # 0x0308 v--- --11 ---- 1--- -TAG_BTREE = 0x030c # 0x030c v--- --11 ---- 11rr -TAG_MROOT = 0x0311 # 0x0310 v--- --11 ---1 --rr -TAG_MDIR = 0x0315 # 0x0314 v--- --11 ---1 -1rr -TAG_MTREE = 0x031c # 0x031c v--- --11 ---1 11rr -TAG_DID = 0x0320 # 0x0320 v--- --11 --1- ---- -TAG_BRANCH = 0x032c # 0x032c v--- --11 --1- 11rr +TAG_STRUCT = 0x0300 ## 0x03tt v--- --11 -ttt ttrr +TAG_BRANCH = 0x0300 # 0x030r v--- --11 ---- --rr +TAG_DATA = 0x0304 # 0x0304 v--- --11 ---- -1-- +TAG_BLOCK = 0x0308 # 0x0308 v--- --11 ---- 1err +TAG_DID = 0x0314 # 0x0314 v--- --11 ---1 -1-- +TAG_BSHRUB = 0x0318 # 0x0318 v--- --11 ---1 1--- +TAG_BTREE = 0x031c # 0x031c v--- --11 ---1 11rr +TAG_MROOT = 0x0321 # 0x032r v--- --11 --1- --rr +TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr +TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -104,8 +104,8 @@ def tagrepr(tag, weight=None, size=None, *, else 'wcompat' if (tag & 0xfff) == TAG_WCOMPAT else 'ocompat' if (tag & 0xfff) == TAG_OCOMPAT else 'geometry' if (tag & 0xfff) == TAG_GEOMETRY - else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT + else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'config 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') @@ -141,15 +141,15 @@ def tagrepr(tag, weight=None, size=None, *, elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - 'data' if (tag & 0xfff) == TAG_DATA + 'branch' if (tag & 0xfff) == TAG_BRANCH + else 'data' if (tag & 0xfff) == TAG_DATA else 'block' if (tag & 0xfff) == TAG_BLOCK + else 'did' if (tag & 0xfff) == TAG_DID else 'bshrub' if (tag & 0xfff) == TAG_BSHRUB else 'btree' if (tag & 0xfff) == TAG_BTREE else 'mroot' if (tag & 0xfff) == TAG_MROOT else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE - else 'did' if (tag & 0xfff) == TAG_DID - else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') diff --git a/tests/test_mount.toml b/tests/test_mount.toml index cfbca8f4..01a68692 100644 --- a/tests/test_mount.toml +++ b/tests/test_mount.toml @@ -1095,7 +1095,7 @@ code = ''' lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0; lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_RATTRS( LFSR_RATTR_BUF( - LFSR_TAG_CONFIG + 0x13, 0, + LFSR_TAG_CONFIG + 0x42, 0, "oh no!", strlen("oh no!")))) => 0; lfsr_unmount(&lfs) => 0;