shell: flash: display capacity and usage
This commit is contained in:
parent
58ae4bb2ea
commit
b55fea5379
1 changed files with 6 additions and 5 deletions
|
@ -105,13 +105,14 @@ static void do_flash_probe(const char *s)
|
|||
}
|
||||
|
||||
if (!(flash = flash_probe())) {
|
||||
fprintf(stderr, "error: unable to probe flash device.\n");
|
||||
fprintf(stderr, "error: unable to probe the flash device.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void do_flash_info(const char *s)
|
||||
{
|
||||
size_t size;
|
||||
size_t size, capacity;
|
||||
|
||||
(void)s;
|
||||
|
||||
|
@ -121,10 +122,10 @@ static void do_flash_info(const char *s)
|
|||
}
|
||||
|
||||
size = flash_get_size(flash);
|
||||
capacity = flash_get_capacity(flash);
|
||||
|
||||
printf("Capacity: %" PRSZu " blocks (", size / (4 * KIB));
|
||||
print_size(size);
|
||||
printf(")\n");
|
||||
printf(" size: %" PRSZu "/%" PRSZu " bytes (%" PRSZu "%% usage)\n",
|
||||
size, capacity, 100 * size / capacity);
|
||||
}
|
||||
|
||||
static void do_flash_read(const char *s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue