Big rename! Renamed lfs -> lfs3 and lfsr -> lfs3

This commit is contained in:
Christopher Haster
2025-05-28 15:00:04 -05:00
parent 3413f125d8
commit 6eba1180c8
50 changed files with 52278 additions and 52111 deletions
+2 -2
View File
@@ -432,7 +432,7 @@ def compile(bench_paths, **args):
# create case run function
f.writeln('void __bench__%s__run('
'__attribute__((unused)) '
'struct lfs_config *CFG) {' % (
'struct lfs3_config *CFG) {' % (
case.name))
f.writeln(4*' '+'// bench case %s' % case.name)
if case.code_lineno is not None:
@@ -491,7 +491,7 @@ def compile(bench_paths, **args):
'void);' % (
case.name))
f.writeln('extern void __bench__%s__run('
'struct lfs_config *CFG);' % (
'struct lfs3_config *CFG);' % (
case.name))
f.writeln()
+5 -5
View File
@@ -2769,7 +2769,7 @@ class Gstate:
# high-level littlefs representation
class Lfs:
class Lfs3:
def __init__(self, bd, mtree, config=None, gstate=None, cksum=None, *,
corrupt=False):
self.bd = bd
@@ -3018,7 +3018,7 @@ class Lfs:
# empty path?
if path_ == b'':
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__ = []
for p in path_.split(b'/'):
@@ -3039,7 +3039,7 @@ class Lfs:
else:
path__.append(p)
if dotdots:
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__.reverse()
path_ = path__
@@ -3570,7 +3570,7 @@ class Lfs:
super().__init__(lfs, mid, mdir, tag, name)
# we're recursable if we're a non-grmed directory with a did
if (isinstance(self, Lfs.Dir)
if (isinstance(self, Lfs3.Dir)
and not self.grmed
and self.did is not None):
self.recursable = True
@@ -4507,7 +4507,7 @@ def main_(ring, disk, mroots=None, *,
# fetch the filesystem
bd = Bd(f, block_size, block_count)
lfs = Lfs.fetch(bd, mroots, trunk,
lfs = Lfs3.fetch(bd, mroots, trunk,
# don't bother to check things if we're not reporting errors
no_ck=not args.get('error_on_corrupt'))
corrupted = not bool(lfs)
+5 -5
View File
@@ -2799,7 +2799,7 @@ class Gstate:
# high-level littlefs representation
class Lfs:
class Lfs3:
def __init__(self, bd, mtree, config=None, gstate=None, cksum=None, *,
corrupt=False):
self.bd = bd
@@ -3048,7 +3048,7 @@ class Lfs:
# empty path?
if path_ == b'':
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__ = []
for p in path_.split(b'/'):
@@ -3069,7 +3069,7 @@ class Lfs:
else:
path__.append(p)
if dotdots:
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__.reverse()
path_ = path__
@@ -3600,7 +3600,7 @@ class Lfs:
super().__init__(lfs, mid, mdir, tag, name)
# we're recursable if we're a non-grmed directory with a did
if (isinstance(self, Lfs.Dir)
if (isinstance(self, Lfs3.Dir)
and not self.grmed
and self.did is not None):
self.recursable = True
@@ -4227,7 +4227,7 @@ def main(disk, output, mroots=None, *,
# fetch the filesystem
bd = Bd(f, block_size, block_count)
lfs = Lfs.fetch(bd, mroots, trunk)
lfs = Lfs3.fetch(bd, mroots, trunk)
corrupted = not bool(lfs)
# if we can't figure out the block_count, guess
+4 -4
View File
@@ -35,14 +35,14 @@ def main(errs, *,
# list all known error codes
if list_:
for n, e, h in ERRS:
lines.append(('LFS_ERR_'+n, str(e), h))
lines.append(('LFS3_ERR_'+n, str(e), h))
# find these errors
else:
def find_err(err):
# find by LFS_ERR_+name
# find by LFS3_ERR_+name
for n, e, h in ERRS:
if 'LFS_ERR_'+n == err.upper():
if 'LFS3_ERR_'+n == err.upper():
return n, e, h
# find by ERR_+name
for n, e, h in ERRS:
@@ -73,7 +73,7 @@ def main(errs, *,
for err in errs:
try:
n, e, h = find_err(err)
lines.append(('LFS_ERR_'+n, str(e), h))
lines.append(('LFS3_ERR_'+n, str(e), h))
except KeyError:
lines.append(('?', err, 'Unknown err code'))
+22 -22
View File
@@ -77,8 +77,8 @@ FLAGS = [
('M', 'MODE', 1, "Mount's access mode" ),
('^', 'RDWR', 0, "Mount the filesystem as read and write" ),
('^', 'RDONLY', 1, "Mount the filesystem as read only" ),
('M', 'FLUSH', 0x00000040, "Open all files with LFS_O_FLUSH" ),
('M', 'SYNC', 0x00000080, "Open all files with LFS_O_SYNC" ),
('M', 'FLUSH', 0x00000040, "Open all files with LFS3_O_FLUSH" ),
('M', 'SYNC', 0x00000080, "Open all files with LFS3_O_SYNC" ),
('M', 'REVDBG', 0x00000010, "Add debug info to revision counts" ),
('M', 'REVNOISE', 0x00000020, "Add noise to revision counts" ),
('M', 'CKPROGS', 0x00080000, "Check progs by reading back progged data" ),
@@ -105,16 +105,16 @@ FLAGS = [
# Filesystem info flags
('I', 'RDONLY', 0x00000001, "Mounted read only" ),
('I', 'FLUSH', 0x00000040, "Mounted with LFS_M_FLUSH" ),
('I', 'SYNC', 0x00000080, "Mounted with LFS_M_SYNC" ),
('I', 'REVDBG', 0x00000010, "Mounted with LFS_M_REVDBG" ),
('I', 'REVNOISE', 0x00000020, "Mounted with LFS_M_REVNOISE" ),
('I', 'CKPROGS', 0x00080000, "Mounted with LFS_M_CKPROGS" ),
('I', 'CKFETCHES', 0x00100000, "Mounted with LFS_M_CKFETCHES" ),
('I', 'FLUSH', 0x00000040, "Mounted with LFS3_M_FLUSH" ),
('I', 'SYNC', 0x00000080, "Mounted with LFS3_M_SYNC" ),
('I', 'REVDBG', 0x00000010, "Mounted with LFS3_M_REVDBG" ),
('I', 'REVNOISE', 0x00000020, "Mounted with LFS3_M_REVNOISE" ),
('I', 'CKPROGS', 0x00080000, "Mounted with LFS3_M_CKPROGS" ),
('I', 'CKFETCHES', 0x00100000, "Mounted with LFS3_M_CKFETCHES" ),
('I', 'CKMETAPARITY',
0x00200000, "Mounted with LFS_M_CKMETAPARITY" ),
0x00200000, "Mounted with LFS3_M_CKMETAPARITY" ),
('I', 'CKDATACKSUMREADS',
0x00800000, "Mounted with LFS_M_CKDATACKSUMREADS" ),
0x00800000, "Mounted with LFS3_M_CKDATACKSUMREADS" ),
('I', 'MKCONSISTENT',
0x00000100, "Filesystem needs mkconsistent to write" ),
@@ -233,10 +233,10 @@ def main(flags, *,
# accept prefix prefix
if f.upper() in prefixes:
prefix.update(prefixes[f.upper()])
# accept LFS_+prefix prefix
elif (f.upper().startswith('LFS_')
and f.upper()[len('LFS_'):] in prefixes):
prefix.update(prefixes[f.upper()[len('LFS_'):]])
# accept LFS3_+prefix prefix
elif (f.upper().startswith('LFS3_')
and f.upper()[len('LFS3_'):] in prefixes):
prefix.update(prefixes[f.upper()[len('LFS3_'):]])
else:
flags_.append(f)
@@ -261,30 +261,30 @@ def main(flags, *,
for p, t, n, f, h in flags__:
if not all_ and (t is not None or p[0].islower()):
continue
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
# find flags by name or value
else:
for f_ in flags_:
found = False
# find by LFS_+prefix+_+name
# find by LFS3_+prefix+_+name
for p, t, n, f, h in flags__:
if 'LFS_%s_%s' % (p, n) == f_.upper():
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
if 'LFS3_%s_%s' % (p, n) == f_.upper():
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
found = True
if found:
continue
# find by prefix+_+name
for p, t, n, f, h in flags__:
if '%s_%s' % (p, n) == f_.upper():
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
found = True
if found:
continue
# find by name
for p, t, n, f, h in flags__:
if n == f_.upper():
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
found = True
if found:
continue
@@ -298,11 +298,11 @@ def main(flags, *,
continue
# matches flag?
if t is None and (f__ & f) == f:
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
f___ &= ~f
# matches type?
elif t is not None and (f__ & t) == f:
lines.append(('LFS_%s_%s' % (p, n), '0x%08x' % f, h))
lines.append(('LFS3_%s_%s' % (p, n), '0x%08x' % f, h))
f___ &= ~t
if f___:
lines.append(('?', '0x%08x' % f___, 'Unknown flags'))
+8 -8
View File
@@ -2726,7 +2726,7 @@ class Gstate:
# high-level littlefs representation
class Lfs:
class Lfs3:
def __init__(self, bd, mtree, config=None, gstate=None, cksum=None, *,
corrupt=False):
self.bd = bd
@@ -2975,7 +2975,7 @@ class Lfs:
# empty path?
if path_ == b'':
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__ = []
for p in path_.split(b'/'):
@@ -2996,7 +2996,7 @@ class Lfs:
else:
path__.append(p)
if dotdots:
raise Lfs.PathError("invalid path: %r" % path)
raise Lfs3.PathError("invalid path: %r" % path)
path__.reverse()
path_ = path__
@@ -3527,7 +3527,7 @@ class Lfs:
super().__init__(lfs, mid, mdir, tag, name)
# we're recursable if we're a non-grmed directory with a did
if (isinstance(self, Lfs.Dir)
if (isinstance(self, Lfs3.Dir)
and not self.grmed
and self.did is not None):
self.recursable = True
@@ -4157,7 +4157,7 @@ def dbg_files(lfs, paths, *,
try:
dir = lfs.pathlookup(path,
all=args.get('all'))
except Lfs.PathError as e:
except Lfs3.PathError as e:
print("error: %s" % e,
file=sys.stderr)
sys.exit(-1)
@@ -4178,7 +4178,7 @@ def dbg_files(lfs, paths, *,
# include any orphaned entries in the root directory to help
# debugging (these don't actually live in the root directory)
if not no_orphans and isinstance(dir, Lfs.Root):
if not no_orphans and isinstance(dir, Lfs3.Root):
# finding orphans is expensive, so cache this
if not hasattr(iter_dir, 'orphans'):
iter_dir.orphans = dir.lfs.orphans()
@@ -4224,7 +4224,7 @@ def dbg_files(lfs, paths, *,
if file.orphaned:
notes.append('orphaned')
# missing bookmark/did?
if isinstance(file, Lfs.Dir):
if isinstance(file, Lfs3.Dir):
if file.did is None:
notes.append('missing did')
elif lfs.namelookup(file.did, b'') is None:
@@ -4582,7 +4582,7 @@ def main(disk, mroots=None, paths=None, *,
# fetch the filesystem
bd = Bd(f, block_size, block_count)
lfs = Lfs.fetch(bd, mroots, trunk)
lfs = Lfs3.fetch(bd, mroots, trunk)
# print some information about the filesystem
if not quiet:
+2 -2
View File
@@ -444,7 +444,7 @@ def compile(test_paths, **args):
# create case run function
f.writeln('void __test__%s__run('
'__attribute__((unused)) '
'struct lfs_config *CFG) {' % (
'struct lfs3_config *CFG) {' % (
case.name))
f.writeln(4*' '+'// test case %s' % case.name)
if case.code_lineno is not None:
@@ -503,7 +503,7 @@ def compile(test_paths, **args):
'void);' % (
case.name))
f.writeln('extern void __test__%s__run('
'struct lfs_config *CFG);' % (
'struct lfs3_config *CFG);' % (
case.name))
f.writeln()