Added formatting fixes for larger numbers in fsck and df; made mkfs
test for devices larger than 4GB, so it won't try to test them (and print a warning message), but it will write the FS.
This commit is contained in:
parent
037d5ffb26
commit
ebd38d9a92
@ -381,7 +381,7 @@ fortune: fortune.c
|
|||||||
|
|
||||||
fsck: fsck.c
|
fsck: fsck.c
|
||||||
$(CCLD) -o $@ $?
|
$(CCLD) -o $@ $?
|
||||||
@install -S 1024k $@
|
@install -S 4096k $@
|
||||||
|
|
||||||
fsck1: fsck1.c
|
fsck1: fsck1.c
|
||||||
$(CCLD) -o $@ $?
|
$(CCLD) -o $@ $?
|
||||||
|
@ -117,13 +117,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (Pflag) {
|
if (Pflag) {
|
||||||
printf(!iflag ? "\
|
printf(!iflag ? "\
|
||||||
Filesystem %4d-blocks Used Available Capacity Mounted on\n" : "\
|
Filesystem %4d-blocks Used Available Capacity Mounted on\n" : "\
|
||||||
Filesystem Inodes IUsed IFree %%IUsed Mounted on\n",
|
Filesystem Inodes IUsed IFree %%IUsed Mounted on\n",
|
||||||
unitsize);
|
unitsize);
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", !iflag ? "\
|
printf("%s\n", !iflag ? "\
|
||||||
Filesystem 1K-Blocks Free Used % Files% Mounted on" : "\
|
Filesystem 1K-Blocks Free Used % Files% Mounted on" : "\
|
||||||
Filesystem Files Free Used % BUsed% Mounted on"
|
Filesystem Files Free Used % BUsed% Mounted on"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ int df(const struct mtab *mt)
|
|||||||
while (n < 15) { putchar(' '); n++; }
|
while (n < 15) { putchar(' '); n++; }
|
||||||
|
|
||||||
if (!Pflag && !iflag) {
|
if (!Pflag && !iflag) {
|
||||||
printf(" %7ld %7ld %7ld %3d%% %3d%% %s\n",
|
printf(" %9ld %9ld %9ld %3d%% %3d%% %s\n",
|
||||||
L(totblocks), /* Blocks */
|
L(totblocks), /* Blocks */
|
||||||
L(totblocks - busyblocks), /* free */
|
L(totblocks - busyblocks), /* free */
|
||||||
L(busyblocks), /* used */
|
L(busyblocks), /* used */
|
||||||
@ -368,7 +368,7 @@ int df(const struct mtab *mt)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!Pflag && iflag) {
|
if (!Pflag && iflag) {
|
||||||
printf(" %7ld %7ld %7ld %3d%% %3d%% %s\n",
|
printf(" %9ld %9ld %9ld %3d%% %3d%% %s\n",
|
||||||
L(sp->s_ninodes), /* Files */
|
L(sp->s_ninodes), /* Files */
|
||||||
L(sp->s_ninodes - i_count), /* free */
|
L(sp->s_ninodes - i_count), /* free */
|
||||||
L(i_count), /* used */
|
L(i_count), /* used */
|
||||||
@ -378,7 +378,7 @@ int df(const struct mtab *mt)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (Pflag && !iflag) {
|
if (Pflag && !iflag) {
|
||||||
printf(" %7ld %7ld %7ld %4d%% %s\n",
|
printf(" %9ld %9ld %9ld %4d%% %s\n",
|
||||||
L(totblocks), /* Blocks */
|
L(totblocks), /* Blocks */
|
||||||
L(busyblocks), /* Used */
|
L(busyblocks), /* Used */
|
||||||
totblocks - busyblocks, /* Available */
|
totblocks - busyblocks, /* Available */
|
||||||
@ -387,7 +387,7 @@ int df(const struct mtab *mt)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (Pflag && iflag) {
|
if (Pflag && iflag) {
|
||||||
printf(" %7ld %7ld %7ld %4d%% %s\n",
|
printf(" %9ld %9ld %9ld %4d%% %s\n",
|
||||||
L(sp->s_ninodes), /* Inodes */
|
L(sp->s_ninodes), /* Inodes */
|
||||||
L(i_count), /* IUsed */
|
L(i_count), /* IUsed */
|
||||||
L(sp->s_ninodes - i_count), /* IAvail */
|
L(sp->s_ninodes - i_count), /* IAvail */
|
||||||
|
@ -309,7 +309,11 @@ unsigned nelem, elsize;
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if ((p = (char *)malloc((size_t)nelem * elsize)) == 0)fatal("out of memory");
|
if ((p = (char *)malloc((size_t)nelem * elsize)) == 0) {
|
||||||
|
fprintf(stderr, "Tried to allocate %dkB\n",
|
||||||
|
nelem*elsize/1024);
|
||||||
|
fatal("out of memory");
|
||||||
|
}
|
||||||
memset((void *) p, 0, (size_t)nelem * elsize);
|
memset((void *) p, 0, (size_t)nelem * elsize);
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
@ -1438,21 +1442,21 @@ void printtotal()
|
|||||||
printf("blocksize = %5d ", block_size);
|
printf("blocksize = %5d ", block_size);
|
||||||
printf("zonesize = %5d\n", ZONE_SIZE);
|
printf("zonesize = %5d\n", ZONE_SIZE);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
pr("%6u Regular file%s\n", nregular, "", "s");
|
pr("%8u Regular file%s\n", nregular, "", "s");
|
||||||
pr("%6u Director%s\n", ndirectory, "y", "ies");
|
pr("%8u Director%s\n", ndirectory, "y", "ies");
|
||||||
pr("%6u Block special file%s\n", nblkspec, "", "s");
|
pr("%8u Block special file%s\n", nblkspec, "", "s");
|
||||||
pr("%6u Character special file%s\n", ncharspec, "", "s");
|
pr("%8u Character special file%s\n", ncharspec, "", "s");
|
||||||
if (nbadinode != 0) pr("%6u Bad inode%s\n", nbadinode, "", "s");
|
if (nbadinode != 0) pr("%6u Bad inode%s\n", nbadinode, "", "s");
|
||||||
pr("%6u Free inode%s\n", nfreeinode, "", "s");
|
pr("%8u Free inode%s\n", nfreeinode, "", "s");
|
||||||
pr("%6u Named pipe%s\n", npipe, "", "s");
|
pr("%8u Named pipe%s\n", npipe, "", "s");
|
||||||
pr("%6u Symbolic link%s\n", nsyml, "", "s");
|
pr("%8u Symbolic link%s\n", nsyml, "", "s");
|
||||||
/* Don't print some fields.
|
/* Don't print some fields.
|
||||||
printf("\n");
|
printf("\n");
|
||||||
pr("%6u Data zone%s\n", ztype[0], "", "s");
|
pr("%8u Data zone%s\n", ztype[0], "", "s");
|
||||||
pr("%6u Single indirect zone%s\n", ztype[1], "", "s");
|
pr("%8u Single indirect zone%s\n", ztype[1], "", "s");
|
||||||
pr("%6u Double indirect zone%s\n", ztype[2], "", "s");
|
pr("%8u Double indirect zone%s\n", ztype[2], "", "s");
|
||||||
*/
|
*/
|
||||||
lpr("%6ld Free zone%s\n", nfreezone, "", "s");
|
lpr("%8ld Free zone%s\n", nfreezone, "", "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the device which name is given by `f'. The inodes listed by `clist'
|
/* Check the device which name is given by `f'. The inodes listed by `clist'
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#define BIN 2
|
#define BIN 2
|
||||||
#define BINGRP 2
|
#define BINGRP 2
|
||||||
#define BIT_MAP_SHIFT 13
|
#define BIT_MAP_SHIFT 13
|
||||||
#define N_BLOCKS (1024L * 1024)
|
#define N_BLOCKS MAX_BLOCK_NR
|
||||||
#define N_BLOCKS16 (128L * 1024)
|
#define N_BLOCKS16 (128L * 1024)
|
||||||
#define INODE_MAX ((unsigned) 65535)
|
#define INODE_MAX ((unsigned) 65535)
|
||||||
|
|
||||||
@ -323,6 +323,11 @@ char *argv[];
|
|||||||
special(argv[--optind]);
|
special(argv[--optind]);
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
|
if(ULONG_MAX / block_size <= blocks-1) {
|
||||||
|
fprintf(stderr, "Warning: mkfs not testing device, it's too big.\n");
|
||||||
|
donttest = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!donttest) {
|
if (!donttest) {
|
||||||
short *testb;
|
short *testb;
|
||||||
ssize_t w;
|
ssize_t w;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user