[PATCH 5/6] commands: stat: fix size display for FILE_SIZE_STREAM
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jan 6 01:18:34 PST 2025
FILE_SIZE_STREAM is a special value that indicates that the size field
should be ignored as the cdev in question is a stream device.
Teach the stat command about this.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
fs/fs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index 6d047f197640..8cdd0c55202b 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -188,9 +188,13 @@ void stat_print(int dirfd, const char *filename, const struct stat *st)
typeprefix = "cdev link to ";
}
- printf("\n");
+ printf("\nSize: ");
+
+ if (st->st_size == FILE_SIZE_STREAM)
+ printf("%-20s", "stream");
+ else
+ printf("%-20llu", st->st_size);
- printf(" Size: %-20llu", st->st_size);
if (bdev)
printf("Blocks: %llu\tIO Block: %u\t",
(u64)bdev->num_blocks, 1 << bdev->blockbits);
--
2.39.5
More information about the barebox
mailing list