Modified NSH 'df -h' command to do some saner conversions. From Ken Pettit
This commit is contained in:
parent
d9f6b144bc
commit
1b4869300a
@ -744,3 +744,8 @@
|
|||||||
specify FAT12, FAT16, or FAT32 (2013-12-5).
|
specify FAT12, FAT16, or FAT32 (2013-12-5).
|
||||||
|
|
||||||
6.33 2014-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
6.33 2014-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
|
* apps/nshlib/nsh_mntcmds.c: Modified the df -h logic to eliminate
|
||||||
|
truncating numbers in conversion (like 7900 -> 7M). From Ken
|
||||||
|
Pettit (2013-12-12).
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static int df_man_readable_handler(FAR const char *mountpoint,
|
|||||||
/* Find the label for size */
|
/* Find the label for size */
|
||||||
|
|
||||||
which = 0;
|
which = 0;
|
||||||
while (size >= 1024)
|
while (size >= 9999 || (size & 0x3FF) == 0 && size)
|
||||||
{
|
{
|
||||||
which++;
|
which++;
|
||||||
size >>= 10;
|
size >>= 10;
|
||||||
@ -204,7 +204,7 @@ static int df_man_readable_handler(FAR const char *mountpoint,
|
|||||||
/* Find the label for free */
|
/* Find the label for free */
|
||||||
|
|
||||||
which = 0;
|
which = 0;
|
||||||
while (free >= 1024)
|
while (free >= 9999 || (free & 0x3FF) == 0 && size)
|
||||||
{
|
{
|
||||||
which++;
|
which++;
|
||||||
free >>= 10;
|
free >>= 10;
|
||||||
@ -214,7 +214,7 @@ static int df_man_readable_handler(FAR const char *mountpoint,
|
|||||||
/* Find the label for used */
|
/* Find the label for used */
|
||||||
|
|
||||||
which = 0;
|
which = 0;
|
||||||
while (used >= 1024)
|
while (used >= 9999 || (used & 0x3FF) == 0 && size)
|
||||||
{
|
{
|
||||||
which++;
|
which++;
|
||||||
used >>= 10;
|
used >>= 10;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user