Skip to content

Commit d055bfb

Browse files
committed
Tweaked lfs_fsinfo block_size/block_count fields
Mainly to match superblock ordering and emphasize these are logical blocks.
1 parent 9505f45 commit d055bfb

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

lfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4509,14 +4509,15 @@ static int lfs_fs_rawstat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
45094509
fsinfo->disk_version = superblock.version;
45104510
}
45114511

4512+
// filesystem geometry
4513+
fsinfo->block_size = lfs->cfg->block_size;
4514+
fsinfo->block_count = lfs->block_count;
4515+
45124516
// other on-disk configuration, we cache all of these for internal use
45134517
fsinfo->name_max = lfs->name_max;
45144518
fsinfo->file_max = lfs->file_max;
45154519
fsinfo->attr_max = lfs->attr_max;
45164520

4517-
fsinfo->block_count = lfs->block_count;
4518-
fsinfo->block_size = lfs->cfg->block_size;
4519-
45204521
return 0;
45214522
}
45224523

lfs.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ struct lfs_fsinfo {
293293
// On-disk version.
294294
uint32_t disk_version;
295295

296+
// Size of a logical block in bytes.
297+
lfs_size_t block_size;
298+
299+
// Number of logical blocks in filesystem.
300+
lfs_size_t block_count;
301+
296302
// Upper limit on the length of file names in bytes.
297303
lfs_size_t name_max;
298304

@@ -301,13 +307,6 @@ struct lfs_fsinfo {
301307

302308
// Upper limit on the size of custom attributes in bytes.
303309
lfs_size_t attr_max;
304-
305-
// Number of blocks in filesystem.
306-
// May differ from cfg->block_count if autodetected from filesystem.
307-
lfs_size_t block_count;
308-
309-
// Size of block in bytes.
310-
lfs_size_t block_size;
311310
};
312311

313312
// Custom attribute structure, used to describe custom attributes
@@ -440,12 +439,11 @@ typedef struct lfs {
440439
} free;
441440

442441
const struct lfs_config *cfg;
442+
lfs_size_t block_count;
443443
lfs_size_t name_max;
444444
lfs_size_t file_max;
445445
lfs_size_t attr_max;
446446

447-
lfs_size_t block_count;
448-
449447
#ifdef LFS_MIGRATE
450448
struct lfs1 *lfs1;
451449
#endif

0 commit comments

Comments
 (0)