Adopted lazy geometry encoding

- LFSR_TAG_GEOMETRY ---> lfsr_data_fromgeometry

Not much to say about this one, LFSR_TAG_GEOMETRY is a bit of an
outlier.

I did consider deduplicating with the mptr encoder, but decided that
would be too hacky, and create problems for future metadata redundancy
things.

Still saves code though, which is nice:

           code          stack          ctx
  before: 35632           2440          636
  after:  35580 (-0.1%)   2440 (+0.0%)  636 (+0.0%)
This commit is contained in:
Christopher Haster
2025-02-10 00:30:40 -06:00
parent e15412d1d6
commit 81140fcfd9
2 changed files with 36 additions and 35 deletions
+8 -14
View File
@@ -995,15 +995,12 @@ code = '''
// note we're messing around with internals to do this! this
// is not a user API
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
uint8_t geometry_buf[LFSR_GEOMETRY_DSIZE];
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_RATTRS(
LFSR_RATTR(
LFSR_RATTR__(
LFSR_TAG_GEOMETRY, 0,
LFSR_DATA_GEOMETRY(
(&(lfsr_geometry_t){
INC_BLOCK_SIZE,
BLOCK_COUNT}),
geometry_buf)))) => 0;
(&(lfsr_geometry_t){
INC_BLOCK_SIZE,
BLOCK_COUNT}), LFSR_GEOMETRY_DSIZE))) => 0;
lfsr_unmount(&lfs) => 0;
// mount should now fail
@@ -1025,15 +1022,12 @@ code = '''
// note we're messing around with internals to do this! this
// is not a user API
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
uint8_t geometry_buf[LFSR_GEOMETRY_DSIZE];
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_RATTRS(
LFSR_RATTR(
LFSR_RATTR__(
LFSR_TAG_GEOMETRY, 0,
LFSR_DATA_GEOMETRY(
(&(lfsr_geometry_t){
BLOCK_SIZE,
INC_BLOCK_COUNT}),
geometry_buf)))) => 0;
(&(lfsr_geometry_t){
BLOCK_SIZE,
INC_BLOCK_COUNT}), LFSR_GEOMETRY_DSIZE))) => 0;
lfsr_unmount(&lfs) => 0;
// mount should now fail