Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/fsck_msdosfs/check.c
Show All 27 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#ifndef lint | #ifndef lint | ||||
__RCSID("$NetBSD: check.c,v 1.14 2006/06/05 16:51:18 christos Exp $"); | __RCSID("$NetBSD: check.c,v 1.14 2006/06/05 16:51:18 christos Exp $"); | ||||
static const char rcsid[] = | static const char rcsid[] = | ||||
"$FreeBSD$"; | "$FreeBSD$"; | ||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#ifdef HAVE_LIBUTIL_H | |||||
#include <libutil.h> | |||||
#endif | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include "ext.h" | #include "ext.h" | ||||
#include "fsutil.h" | #include "fsutil.h" | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if (mod & FSFATMOD) { | ||||
if (ask(1, "Update FATs")) { | if (ask(1, "Update FATs")) { | ||||
mod |= writefat(fat); | mod |= writefat(fat); | ||||
if (mod & FSFATAL) | if (mod & FSFATAL) | ||||
goto out; | goto out; | ||||
} else | } else | ||||
mod |= FSERROR; | 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) | 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.NumFiles, | ||||
boot.NumFree * boot.ClusterSize / 1024, boot.NumFree, | boot.NumFree * boot.ClusterSize / 1024, boot.NumFree, | ||||
boot.NumBad * boot.ClusterSize / 1024, boot.NumBad); | boot.NumBad * boot.ClusterSize / 1024, boot.NumBad); | ||||
else | else | ||||
pwarn("%d files, %d free (%d clusters)\n", | pwarn("%d files, %d KiB free (%d clusters)\n", | ||||
boot.NumFiles, | boot.NumFiles, | ||||
boot.NumFree * boot.ClusterSize / 1024, boot.NumFree); | boot.NumFree * boot.ClusterSize / 1024, boot.NumFree); | ||||
#endif | |||||
if (mod && (mod & FSERROR) == 0) { | if (mod && (mod & FSERROR) == 0) { | ||||
if (mod & FSDIRTY) { | if (mod & FSDIRTY) { | ||||
if (ask(1, "MARK FILE SYSTEM CLEAN") == 0) | if (ask(1, "MARK FILE SYSTEM CLEAN") == 0) | ||||
mod &= ~FSDIRTY; | mod &= ~FSDIRTY; | ||||
if (mod & FSDIRTY) { | if (mod & FSDIRTY) { | ||||
pwarn("MARKING FILE SYSTEM CLEAN\n"); | pwarn("MARKING FILE SYSTEM CLEAN\n"); | ||||
Show All 24 Lines |