From 2425b0f89b897e4df7b9ed342ee17545e620bba6 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 12 Jun 2024 12:25:01 -0500 Subject: [PATCH] Removed fsinfo.disk_version With rcompat/wcompat flags, on-disk minor version bumps will hopefully not be needed for a long time (ever?). And if the on-disk version never changes, why was a word to report it every lfsr_fs_stat call? But this may be something to listen to user feedback on. Worst case we can always readd fsinfo.disk_version if users find it useful. Code changes: code stack before: 33922 2592 after: 33918 (-0.0%) 2592 (+0.0%) --- lfs.c | 1 - lfs.h | 3 --- tests/test_compat.toml | 36 ------------------------------------ tests/test_grow.toml | 26 -------------------------- 4 files changed, 66 deletions(-) diff --git a/lfs.c b/lfs.c index 8ea2c028..f0a8254a 100644 --- a/lfs.c +++ b/lfs.c @@ -8994,7 +8994,6 @@ static int lfs_alloc(lfs_t *lfs, lfs_block_t *block, bool erase) { /// Other filesystem things /// int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) { - fsinfo->disk_version = LFS_DISK_VERSION; fsinfo->block_size = lfs->cfg->block_size; fsinfo->block_count = lfs->block_count; fsinfo->name_limit = lfs->name_limit; diff --git a/lfs.h b/lfs.h index e1fbac1d..bfe1ac0f 100644 --- a/lfs.h +++ b/lfs.h @@ -325,9 +325,6 @@ struct lfs_info { // Filesystem info structure struct lfs_fsinfo { - // On-disk version - uint32_t disk_version; - // TODO should we add rcompat/wcompat flags here? // Size of a logical block in bytes. diff --git a/tests/test_compat.toml b/tests/test_compat.toml index 7604a4cf..178efc77 100644 --- a/tests/test_compat.toml +++ b/tests/test_compat.toml @@ -92,12 +92,6 @@ code = ''' // now mount with new version lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - lfsr_unmount(&lfs) => 0; ''' @@ -131,11 +125,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // can we list the directories? lfsr_dir_t dir; lfsr_dir_open(&lfs, &dir, "/") => 0; @@ -208,11 +197,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // can we list the files? lfsr_dir_t dir; lfsr_dir_open(&lfs, &dir, "/") => 0; @@ -306,11 +290,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // can we list the directories? lfsr_dir_t dir; lfsr_dir_open(&lfs, &dir, "/") => 0; @@ -413,11 +392,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // write another COUNT/2 dirs for (lfs_size_t i = COUNT/2; i < COUNT; i++) { char name[8]; @@ -503,11 +477,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // write half COUNT files prng = 42; for (lfs_size_t i = 0; i < COUNT; i++) { @@ -634,11 +603,6 @@ code = ''' lfs_t lfs; lfsr_mount(&lfs, CFG) => 0; - // we should be able to read the version using lfsr_fs_stat - struct lfs_fsinfo fsinfo; - lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFSP_DISK_VERSION); - // write half COUNT files prng = 42; for (lfs_size_t i = 0; i < COUNT; i++) { diff --git a/tests/test_grow.toml b/tests/test_grow.toml index 31966bc0..10a294fb 100644 --- a/tests/test_grow.toml +++ b/tests/test_grow.toml @@ -34,7 +34,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -71,7 +70,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -111,7 +109,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -156,7 +153,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == BIGGER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -218,7 +214,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -257,7 +252,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == BIGGER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -297,7 +291,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == BIGGER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -336,7 +329,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -375,7 +367,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -415,7 +406,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == SMALLER_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -457,7 +447,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -511,7 +500,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -602,7 +590,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -749,7 +736,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -835,7 +821,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -911,7 +896,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -986,7 +970,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -1179,7 +1162,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -1282,7 +1264,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -1594,7 +1575,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -1708,7 +1688,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -2099,7 +2078,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -2242,7 +2220,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -2450,7 +2427,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -2557,7 +2533,6 @@ code = ''' // fsstat up to date? struct lfs_fsinfo fsinfo; lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == INIT_BLOCK_COUNT); assert(fsinfo.name_limit == LFS_NAME_MAX); @@ -2892,7 +2867,6 @@ code = ''' // fsstat up to date? lfsr_fs_stat(&lfs, &fsinfo) => 0; - assert(fsinfo.disk_version == LFS_DISK_VERSION); assert(fsinfo.block_size == BLOCK_SIZE); assert(fsinfo.block_count == block_count_); assert(fsinfo.name_limit == LFS_NAME_MAX);