Tried to use correct types for cfg/fsinfo things

In theory, lfs3_size_t should be used for in-block sizes (though this is
also mixed up with in-device sizes?), lfs3_off_t for file sizes, and
lfs3_block_t for block counts (I don't think lfs3_off_t/lfs3_block_t
will ever differ, but the notation is helpful).

Though I've not done a great job at keeping these types organized...

Changed:

- cfg.block_count:      lfs3_size_t  -> lfs3_block_t
- cfg.file_limit:       lfs3_size_t  -> lfs3_off_t
- fsinfo.block_count:   lfs3_size_t  -> lfs3_block_t
- fsinfo.file_limit:    lfs3_size_t  -> lfs3_off_t
- lfs3_fs_usage:        lfs3_ssize_t -> lfs3_sblock_t
- geometry.block_size:  lfs3_size_t  -> lfs3_off_t
- geometry.block_count: lfs3_size_t  -> lfs3_block_t
- and some internals

No code changes.
This commit is contained in:
Christopher Haster
2025-12-02 14:37:08 -06:00
parent 7d9fe534d1
commit 1abd9d732f
2 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -15197,8 +15197,8 @@ static inline int lfs3_data_readocompat(lfs3_t *lfs3, lfs3_data_t *data,
//
// note these are stored minus 1 to avoid overflow issues
struct lfs3_geometry {
lfs3_off_t block_size;
lfs3_off_t block_count;
lfs3_size_t block_size;
lfs3_block_t block_count;
};
// geometry on-disk encoding
@@ -16102,8 +16102,8 @@ int lfs3_fs_stat(lfs3_t *lfs3, struct lfs3_fsinfo *fsinfo) {
return 0;
}
lfs3_ssize_t lfs3_fs_usage(lfs3_t *lfs3) {
lfs3_size_t count = 0;
lfs3_sblock_t lfs3_fs_usage(lfs3_t *lfs3) {
lfs3_block_t count = 0;
lfs3_mtrv_t mtrv;
lfs3_mtrv_init(&mtrv, LFS3_T_RDONLY);
while (true) {