You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/19 11:26:52 UTC

[incubator-nuttx] 02/03: fs, include: Use fsblkcnt_t and fsfilcnt_t instead of off_t

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit cfd1c28606198e1c3f452610b7e6dc87676b498f
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Jul 19 16:04:01 2021 +0900

    fs, include: Use fsblkcnt_t and fsfilcnt_t instead of off_t
    
    Summary:
    - On Linux, fsblkcnt_t and fsfilcnt_t are used in struct statfs
    - This commit applies the same logic
    
    Impact:
    - None
    
    Testing:
    - Tested with spresense:rndis_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 fs/fat/fs_fat32.h     |  2 +-
 fs/fat/fs_fat32util.c |  2 +-
 include/sys/statfs.h  | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h
index 70e958e..d2cf889 100644
--- a/fs/fat/fs_fat32.h
+++ b/fs/fat/fs_fat32.h
@@ -1084,7 +1084,7 @@ EXTERN int    fat_ffcacheinvalidate(struct fat_mountpt_s *fs,
 EXTERN int    fat_updatefsinfo(struct fat_mountpt_s *fs);
 EXTERN int    fat_computefreeclusters(struct fat_mountpt_s *fs);
 EXTERN int    fat_nfreeclusters(struct fat_mountpt_s *fs,
-                                off_t *pfreeclusters);
+                                fsblkcnt_t *pfreeclusters);
 EXTERN int    fat_currentsector(struct fat_mountpt_s *fs,
                                 struct fat_file_s *ff, off_t position);
 
diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c
index d24d8fe..63b15e3 100644
--- a/fs/fat/fs_fat32util.c
+++ b/fs/fat/fs_fat32util.c
@@ -2135,7 +2135,7 @@ int fat_computefreeclusters(struct fat_mountpt_s *fs)
  *
  ****************************************************************************/
 
-int fat_nfreeclusters(struct fat_mountpt_s *fs, off_t *pfreeclusters)
+int fat_nfreeclusters(struct fat_mountpt_s *fs, fsblkcnt_t *pfreeclusters)
 {
   /* If number of the first free cluster is valid, then just return that
    * value.
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index 82c304f..0817e31 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -100,14 +100,14 @@
 
 struct statfs
 {
-  uint32_t f_type;     /* Type of filesystem (see definitions above) */
-  size_t   f_namelen;  /* Maximum length of filenames */
-  size_t   f_bsize;    /* Optimal block size for transfers */
-  off_t    f_blocks;   /* Total data blocks in the file system of this size */
-  off_t    f_bfree;    /* Free blocks in the file system */
-  off_t    f_bavail;   /* Free blocks avail to non-superuser */
-  off_t    f_files;    /* Total file nodes in the file system */
-  off_t    f_ffree;    /* Free file nodes in the file system */
+  uint32_t   f_type;     /* Type of filesystem (see definitions above) */
+  size_t     f_namelen;  /* Maximum length of filenames */
+  size_t     f_bsize;    /* Optimal block size for transfers */
+  fsblkcnt_t f_blocks;   /* Total data blocks in the file system of this size */
+  fsblkcnt_t f_bfree;    /* Free blocks in the file system */
+  fsblkcnt_t f_bavail;   /* Free blocks avail to non-superuser */
+  fsfilcnt_t f_files;    /* Total file nodes in the file system */
+  fsfilcnt_t f_ffree;    /* Free file nodes in the file system */
 };
 
 /****************************************************************************