shell: flash: display capacity and usage

This commit is contained in:
S.J.R. van Schaik 2017-06-14 13:14:34 +02:00
parent 58ae4bb2ea
commit b55fea5379

View file

@ -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)