Преглед изворни кода

Add block_count and block_size to fsinfo

Brian Pugh пре 2 година
родитељ
комит
d6098bd3ce
2 измењених фајлова са 10 додато и 0 уклоњено
  1. 3 0
      lfs.c
  2. 7 0
      lfs.h

+ 3 - 0
lfs.c

@@ -4575,6 +4575,9 @@ static int lfs_fs_rawstat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
     fsinfo->file_max = lfs->file_max;
     fsinfo->attr_max = lfs->attr_max;
 
+    fsinfo->block_count = lfs->block_count;
+    fsinfo->block_size = lfs->cfg->block_size;
+
     return 0;
 }
 

+ 7 - 0
lfs.h

@@ -301,6 +301,13 @@ struct lfs_fsinfo {
 
     // Upper limit on the size of custom attributes in bytes.
     lfs_size_t attr_max;
+
+    // Number of blocks in filesystem.
+    // May differ from cfg->block_count if autodetected from filesystem.
+    lfs_size_t block_count;
+
+    // Size of block in bytes.
+    lfs_size_t block_size;
 };
 
 // Custom attribute structure, used to describe custom attributes