Reordered LFSR_TAG_NAMELIMIT/FILELIMIT
Not sure why, but this just seems more intuitive/correct. Maybe because LFSR_TAG_NAME is always the first tag in a file's attr set: LFSR_TAG_NAMELIMIT 0x0039 v--- ---- --11 1--1 LFSR_TAG_FILELIMIT 0x003a v--- ---- --11 1-1- Seeing as several parts of the codebase still use the previous order, it seems reasonable to switch back to that. No code changes.
This commit is contained in:
@@ -1102,8 +1102,8 @@ enum lfsr_tag {
|
||||
LFSR_TAG_WCOMPAT = 0x0036,
|
||||
LFSR_TAG_OCOMPAT = 0x0037,
|
||||
LFSR_TAG_GEOMETRY = 0x0038,
|
||||
LFSR_TAG_FILELIMIT = 0x0039,
|
||||
LFSR_TAG_NAMELIMIT = 0x003a,
|
||||
LFSR_TAG_NAMELIMIT = 0x0039,
|
||||
LFSR_TAG_FILELIMIT = 0x003a,
|
||||
// in-device only, to help find unknown config tags
|
||||
LFSR_TAG_UNKNOWNCONFIG = 0x003b,
|
||||
|
||||
@@ -3588,8 +3588,8 @@ static int lfsr_rbyd_appendrattr_(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
|
||||
// leb128?
|
||||
} else if (rattr.count >= 0
|
||||
&& (rattr.tag == LFSR_TAG_FILELIMIT
|
||||
|| rattr.tag == LFSR_TAG_NAMELIMIT
|
||||
&& (rattr.tag == LFSR_TAG_NAMELIMIT
|
||||
|| rattr.tag == LFSR_TAG_FILELIMIT
|
||||
|| rattr.tag == LFSR_TAG_DID)) {
|
||||
// leb128s should not exceed 31-bits
|
||||
LFS_ASSERT(rattr.u.leb128 <= 0x7fffffff);
|
||||
@@ -14362,32 +14362,6 @@ static int lfsr_mountmroot(lfs_t *lfs, const lfsr_mdir_t *mroot) {
|
||||
|
||||
lfs->block_count = geometry.block_count;
|
||||
|
||||
// read the file limit
|
||||
lfs_off_t file_limit = 0x7fffffff;
|
||||
err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_FILELIMIT,
|
||||
NULL, &data);
|
||||
if (err && err != LFS_ERR_NOENT) {
|
||||
return err;
|
||||
}
|
||||
if (err != LFS_ERR_NOENT) {
|
||||
err = lfsr_data_readleb128(lfs, &data, &file_limit);
|
||||
if (err && err != LFS_ERR_CORRUPT) {
|
||||
return err;
|
||||
}
|
||||
if (err == LFS_ERR_CORRUPT) {
|
||||
file_limit = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_limit > lfs->file_limit) {
|
||||
LFS_ERROR("Incompatible file limit %"PRId32" (> %"PRId32")",
|
||||
file_limit,
|
||||
lfs->file_limit);
|
||||
return LFS_ERR_NOTSUP;
|
||||
}
|
||||
|
||||
lfs->file_limit = file_limit;
|
||||
|
||||
// read the name limit
|
||||
lfs_size_t name_limit = 0xff;
|
||||
err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_NAMELIMIT,
|
||||
@@ -14414,6 +14388,32 @@ static int lfsr_mountmroot(lfs_t *lfs, const lfsr_mdir_t *mroot) {
|
||||
|
||||
lfs->name_limit = name_limit;
|
||||
|
||||
// read the file limit
|
||||
lfs_off_t file_limit = 0x7fffffff;
|
||||
err = lfsr_mdir_lookup(lfs, mroot, LFSR_TAG_FILELIMIT,
|
||||
NULL, &data);
|
||||
if (err && err != LFS_ERR_NOENT) {
|
||||
return err;
|
||||
}
|
||||
if (err != LFS_ERR_NOENT) {
|
||||
err = lfsr_data_readleb128(lfs, &data, &file_limit);
|
||||
if (err && err != LFS_ERR_CORRUPT) {
|
||||
return err;
|
||||
}
|
||||
if (err == LFS_ERR_CORRUPT) {
|
||||
file_limit = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_limit > lfs->file_limit) {
|
||||
LFS_ERROR("Incompatible file limit %"PRId32" (> %"PRId32")",
|
||||
file_limit,
|
||||
lfs->file_limit);
|
||||
return LFS_ERR_NOTSUP;
|
||||
}
|
||||
|
||||
lfs->file_limit = file_limit;
|
||||
|
||||
// check for unknown configs
|
||||
lfsr_tag_t tag;
|
||||
err = lfsr_mdir_lookupnext(lfs, mroot, LFSR_TAG_UNKNOWNCONFIG,
|
||||
|
||||
+3
-3
@@ -37,8 +37,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -292,8 +292,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
@@ -35,8 +35,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -322,8 +322,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
+3
-3
@@ -26,8 +26,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
+3
-3
@@ -27,8 +27,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -249,8 +249,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
+3
-3
@@ -26,8 +26,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -215,8 +215,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
+3
-3
@@ -36,8 +36,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -203,8 +203,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
+3
-3
@@ -19,8 +19,8 @@ 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_NAMELIMIT = 0x0039 # 0x0039 v--- ---- --11 1--1
|
||||
TAG_FILELIMIT = 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
|
||||
@@ -107,8 +107,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 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % weight if weight else '',
|
||||
' %s' % size if size is not None else '')
|
||||
|
||||
Reference in New Issue
Block a user