You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/07/16 18:06:59 UTC

[incubator-nuttx] branch master updated: procfs/mount: Unify uint[32|64]_t to fsblkcnt_t for the code simplification

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3276438984 procfs/mount: Unify uint[32|64]_t to fsblkcnt_t for the code simplification
3276438984 is described below

commit 3276438984140dd2159318468c5b501be3e82879
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jul 16 21:28:55 2022 +0800

    procfs/mount: Unify uint[32|64]_t to fsblkcnt_t for the code simplification
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 fs/mount/fs_procfs_mount.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/fs/mount/fs_procfs_mount.c b/fs/mount/fs_procfs_mount.c
index 4308fd77b6..b191a3c886 100644
--- a/fs/mount/fs_procfs_mount.c
+++ b/fs/mount/fs_procfs_mount.c
@@ -283,15 +283,9 @@ static int usage_entry(FAR const char *mountpoint,
 {
   FAR struct mount_info_s *info = (FAR struct mount_info_s *)arg;
   FAR const char *fstype;
-#ifdef CONFIG_HAVE_LONG_LONG
-  uint64_t size;
-  uint64_t used;
-  uint64_t free;
-#else
-  uint32_t size;
-  uint32_t used;
-  uint32_t free;
-#endif
+  fsblkcnt_t size;
+  fsblkcnt_t used;
+  fsblkcnt_t free;
   int which;
   char sizelabel;
   char freelabel;
@@ -316,15 +310,9 @@ static int usage_entry(FAR const char *mountpoint,
 
   fstype = fs_gettype(statbuf);
 
-#ifdef CONFIG_HAVE_LONG_LONG
-  size = (uint64_t)statbuf->f_bsize * statbuf->f_blocks;
-  free = (uint64_t)statbuf->f_bsize * statbuf->f_bavail;
-  used = (uint64_t)size - free;
-#else
   size = statbuf->f_bsize * statbuf->f_blocks;
   free = statbuf->f_bsize * statbuf->f_bavail;
   used = size - free;
-#endif
 
   /* Find the label for size */
 
@@ -361,15 +349,9 @@ static int usage_entry(FAR const char *mountpoint,
 
   /* Generate usage list one line at a time */
 
-#ifdef CONFIG_HAVE_LONG_LONG
-  mount_sprintf(info, "  %-10s %6llu%c %8llu%c  %8llu%c %s\n", fstype,
-                size, sizelabel, used, usedlabel, free, freelabel,
-                mountpoint);
-#else
-  mount_sprintf(info, "  %-10s %6ld%c %8ld%c  %8ld%c %s\n", fstype,
-                size, sizelabel, used, usedlabel, free, freelabel,
-                mountpoint);
-#endif
+  mount_sprintf(info,
+    "  %-10s %" PRIuOFF "%c %8" PRIuOFF "%c  %8" PRIuOFF "%c %s\n",
+    fstype, size, sizelabel, used, usedlabel, free, freelabel, mountpoint);
 
   return (info->totalsize >= info->buflen) ? 1 : 0;
 }