diff options
author | Xin Li <delphij@google.com> | 2020-04-27 08:59:19 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-04-27 08:59:19 -0700 |
commit | ad1ac48b4ee2125f1aa4702facfb218bd6f04fc8 (patch) | |
tree | 027a67daa069ed9dc65160f5dcfa878b4ed22a34 /check.c | |
parent | 97214502ea95f9f95b3e86fe749bc8241ec26105 (diff) | |
download | fsck_msdos-ad1ac48b4ee2125f1aa4702facfb218bd6f04fc8.tar.gz |
Import revision ffa396196c4c0fcf8a6bf4d1dd88ffb9ce531ccc from FreeBSD.
Change-Id: Ibbded2a22a581886dd43e0443e786ad867471f1c
Diffstat (limited to 'check.c')
-rw-r--r-- | check.c | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -33,6 +33,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#ifdef HAVE_LIBUTIL_H +#include <libutil.h> +#endif #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -126,15 +129,38 @@ checkfilesys(const char *fname) mod |= FSERROR; } +#ifdef HAVE_LIBUTIL_H + char freestr[7], badstr[7]; + + int64_t freebytes = boot.NumFree * boot.ClusterSize; + humanize_number(freestr, sizeof(freestr), freebytes, "", + HN_AUTOSCALE, HN_DECIMAL | HN_IEC_PREFIXES); + if (boot.NumBad) { + int64_t badbytes = boot.NumBad * boot.ClusterSize; + + humanize_number(badstr, sizeof(badstr), badbytes, "", + HN_AUTOSCALE, HN_B | HN_DECIMAL | HN_IEC_PREFIXES); + + pwarn("%d files, %sB free (%d clusters), %sB bad (%d clusters)\n", + boot.NumFiles, + freestr, boot.NumFree, + badstr, boot.NumBad); + } else { + pwarn("%d files, %sB free (%d clusters)\n", + boot.NumFiles, + freestr, boot.NumFree); + } +#else if (boot.NumBad) - pwarn("%d files, %d free (%d clusters), %d bad (%d clusters)\n", + pwarn("%d files, %d KiB free (%d clusters), %d KiB bad (%d clusters)\n", boot.NumFiles, boot.NumFree * boot.ClusterSize / 1024, boot.NumFree, boot.NumBad * boot.ClusterSize / 1024, boot.NumBad); else - pwarn("%d files, %d free (%d clusters)\n", + pwarn("%d files, %d KiB free (%d clusters)\n", boot.NumFiles, boot.NumFree * boot.ClusterSize / 1024, boot.NumFree); +#endif if (mod && (mod & FSERROR) == 0) { if (mod & FSDIRTY) { @@ -143,7 +169,7 @@ checkfilesys(const char *fname) if (mod & FSDIRTY) { pwarn("MARKING FILE SYSTEM CLEAN\n"); - mod |= writefat(fat); + mod |= cleardirty(fat); } else { pwarn("\n***** FILE SYSTEM IS LEFT MARKED AS DIRTY *****\n"); mod |= FSERROR; /* file system not clean */ |