From: Rafał Miłecki Date: Wed, 8 Jul 2015 05:42:30 +0000 (+0000) Subject: nvram: fix displayed info about NVRAM size X-Git-Tag: reboot~2558 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d3721674913e4be33583b30901321b4852b2134d;p=openwrt%2Fstaging%2Fxback.git nvram: fix displayed info about NVRAM size Use actual partition size and content offset to calculate it. Signed-off-by: Rafał Miłecki SVN-Revision: 46260 --- diff --git a/package/utils/nvram/src/cli.c b/package/utils/nvram/src/cli.c index 66ef904885..488d641cfc 100644 --- a/package/utils/nvram/src/cli.c +++ b/package/utils/nvram/src/cli.c @@ -123,8 +123,8 @@ static int do_info(nvram_handle_t *nvram) printf("NCDL values: 0x%08X\n\n", hdr->config_ncdl); printf("%i bytes used / %i bytes available (%.2f%%)\n", - hdr->len, NVRAM_SPACE - hdr->len, - (100.00 / (double)NVRAM_SPACE) * (double)hdr->len); + hdr->len, nvram->length - nvram->offset - hdr->len, + (100.00 / (double)(nvram->length - nvram->offset)) * (double)hdr->len); return 0; }