Skip to contentSkip to conversation

commands: ls: use 14 digits for filesize

PATCH In review Antony Pavlov 2 participants 2 messages Oct 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 commands: ls: use 14 digits for filesize

10 digits are not enough for modern SATA/USB storages. E.g.:

    barebox> ls -l /dev/
    cr-------- 500107862016 ata0
    cr--------   33554432 ata0.0
    cr-------- 500073258496 ata0.1
    cr-------- 32224837632 disk0
    cr--------   67108864 disk0.0
    cr-------- 32156680192 disk0.1

14 digits look much better. E.g.:

    barebox> ls -l /dev/
    cr--------   500107862016 ata0
    cr--------       33554432 ata0.0
    cr--------   500073258496 ata0.1
    cr--------    32224837632 disk0
    cr--------       67108864 disk0.0
    cr--------    32156680192 disk0.1
---
 commands/ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
commands/ls.c +1 -1
index 1a5925d..09437af 100644
@@ -32,7 +32,7 @@ static void ls_one(const char *path, const char* fullname, struct stat *s)
 	unsigned int namelen = strlen(path);
 
 	mkmodestr(s->st_mode, modestr);
-	printf("%s %10llu %*.*s", modestr, s->st_size, namelen, namelen, path);
+	printf("%s %14llu %*.*s", modestr, s->st_size, namelen, namelen, path);
 
 	if (S_ISLNK(s->st_mode)) {
 		char realname[PATH_MAX];
Signature · 7 lines
2.6.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 30 lines · Antony Pavlov

10 digits are not enough for modern SATA/USB storages. E.g.:

    barebox> ls -l /dev/
    cr-------- 500107862016 ata0
    cr--------   33554432 ata0.0
    cr-------- 500073258496 ata0.1
    cr-------- 32224837632 disk0
    cr--------   67108864 disk0.0
    cr-------- 32156680192 disk0.1

14 digits look much better. E.g.:

    barebox> ls -l /dev/
    cr--------   500107862016 ata0
    cr--------       33554432 ata0.0
    cr--------   500073258496 ata0.1
    cr--------    32224837632 disk0
    cr--------       67108864 disk0.0
    cr--------    32156680192 disk0.1
---
 commands/ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
commands/ls.c +0 -0
index 1a5925d..09437af 100644

commands/ls.c static void ls_one(const char *path, const char* fullname, struct stat *s) · line 35

Quoted 5 lines
commands/ls.c +1 -1
@@ -32,7 +32,7 @@ static void ls_one(const char *path, const char* fullname, struct stat *s)
 	unsigned int namelen = strlen(path);
 
 	mkmodestr(s->st_mode, modestr);
-	printf("%s %10llu %*.*s", modestr, s->st_size, namelen, namelen, path);
+	printf("%s %14llu %*.*s", modestr, s->st_size, namelen, namelen, path);

Maybe we should autogenerate that number from the current compile year taking Moores law into account ;)

Until that is done: Applied this one

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox