Warning cleanup.

Format changes by peter
This commit is contained in:
Poul-Henning Kamp 2002-07-30 13:01:25 +00:00
parent b55e3089db
commit 599304a42f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100935
12 changed files with 74 additions and 74 deletions

View File

@ -52,7 +52,7 @@ static const char rcsid[] =
#include "fsck.h"
char *lfname = "lost+found";
const char *lfname = "lost+found";
int lfmode = 01777;
struct dirtemplate emptydir = {
0, DIRBLKSIZ, DT_UNKNOWN, 0, "",
@ -246,14 +246,14 @@ dircheck(struct inodesc *idesc, struct direct *dp)
}
void
direrror(ino_t ino, char *errmesg)
direrror(ino_t ino, const char *errmesg)
{
fileerror(ino, ino, errmesg);
}
void
fileerror(ino_t cwd, ino_t ino, char *errmesg)
fileerror(ino_t cwd, ino_t ino, const char *errmesg)
{
union dinode *dp;
char pathbuf[MAXPATHLEN + 1];
@ -333,8 +333,9 @@ adjust(struct inodesc *idesc, int lcnt)
cmd.value = idesc->id_number;
cmd.size = -lcnt;
if (debug)
printf("adjrefcnt ino %ld amt %ld\n",
(long)cmd.value, cmd.size);
printf("adjrefcnt ino %ld amt %lld\n",
(long)cmd.value,
(long long)cmd.size);
if (sysctl(adjrefcnt, MIBSIZE, 0, 0,
&cmd, sizeof cmd) == -1)
rwerror("ADJUST INODE", cmd.value);
@ -408,7 +409,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
return (0);
if (lfdir == 0) {
dp = ginode(ROOTINO);
idesc.id_name = lfname;
idesc.id_name = strdup(lfname);
idesc.id_type = DATA;
idesc.id_func = findino;
idesc.id_number = ROOTINO;
@ -501,7 +502,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
* fix an entry in a directory.
*/
int
changeino(ino_t dir, char *name, ino_t newnum)
changeino(ino_t dir, const char *name, ino_t newnum)
{
struct inodesc idesc;
@ -510,7 +511,7 @@ changeino(ino_t dir, char *name, ino_t newnum)
idesc.id_func = chgino;
idesc.id_number = dir;
idesc.id_fix = DONTKNOW;
idesc.id_name = name;
idesc.id_name = strdup(name);
idesc.id_parent = newnum; /* new value for name */
return (ckinode(ginode(dir), &idesc));
}
@ -519,7 +520,7 @@ changeino(ino_t dir, char *name, ino_t newnum)
* make an entry in a directory
*/
int
makeentry(ino_t parent, ino_t ino, char *name)
makeentry(ino_t parent, ino_t ino, const char *name)
{
union dinode *dp;
struct inodesc idesc;
@ -534,7 +535,7 @@ makeentry(ino_t parent, ino_t ino, char *name)
idesc.id_number = parent;
idesc.id_parent = ino; /* this is the inode to enter */
idesc.id_fix = DONTKNOW;
idesc.id_name = name;
idesc.id_name = strdup(name);
dp = ginode(parent);
if (DIP(dp, di_size) % DIRBLKSIZ) {
DIP(dp, di_size) = roundup(DIP(dp, di_size), DIRBLKSIZ);

View File

@ -149,7 +149,8 @@ ino_t cursnapshot;
struct inodesc {
enum fixstate id_fix; /* policy on fixing errors */
int (*id_func)(); /* function to be applied to blocks of inode */
int (*id_func)(struct inodesc *);
/* function to be applied to blocks of inode */
ino_t id_number; /* inode number described */
ino_t id_parent; /* for DATA nodes, their parent */
ufs_lbn_t id_lbn; /* logical block number of current block */
@ -253,7 +254,7 @@ char *blockmap; /* ptr to primary blk allocation map */
ino_t maxino; /* number of inodes in filesystem */
ino_t lfdir; /* lost & found directory inode number */
char *lfname; /* lost & found directory name */
const char *lfname; /* lost & found directory name */
int lfmode; /* lost & found directory creation mode */
ufs2_daddr_t n_blks; /* number of blocks in use */
@ -289,7 +290,7 @@ void adjust(struct inodesc *, int lcnt);
ufs2_daddr_t allocblk(long frags);
ino_t allocdir(ino_t parent, ino_t request, int mode);
ino_t allocino(ino_t request, int type);
void blkerror(ino_t ino, char *type, ufs2_daddr_t blk);
void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk);
char *blockcheck(char *name);
int bread(int fd, char *buf, ufs2_daddr_t blk, long size);
void bufinit(void);
@ -297,20 +298,20 @@ void bwrite(int fd, char *buf, ufs2_daddr_t blk, long size);
void cacheino(union dinode *dp, ino_t inumber);
void catch(int);
void catchquit(int);
int changeino(ino_t dir, char *name, ino_t newnum);
int changeino(ino_t dir, const char *name, ino_t newnum);
int chkrange(ufs2_daddr_t blk, int cnt);
void ckfini(int markclean);
int ckinode(union dinode *dp, struct inodesc *);
void clri(struct inodesc *, char *type, int flag);
void clri(struct inodesc *, const char *type, int flag);
int clearentry(struct inodesc *);
void direrror(ino_t ino, char *errmesg);
void direrror(ino_t ino, const char *errmesg);
int dirscan(struct inodesc *);
int dofix(struct inodesc *, char *msg);
int dofix(struct inodesc *, const char *msg);
void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);
void ffs_fragacct(struct fs *, int, int32_t [], int);
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
void fileerror(ino_t cwd, ino_t ino, char *errmesg);
void fileerror(ino_t cwd, ino_t ino, const char *errmesg);
int findino(struct inodesc *);
int findname(struct inodesc *);
void flush(int fd, struct bufarea *bp);
@ -329,7 +330,7 @@ void inocleanup(void);
void inodirty(void);
struct inostat *inoinfo(ino_t inum);
int linkup(ino_t orphan, ino_t parentdir, char *name);
int makeentry(ino_t parent, ino_t ino, char *name);
int makeentry(ino_t parent, ino_t ino, const char *name);
void panic(const char *fmt, ...) __printflike(1, 2);
void pass1(void);
void pass1b(void);
@ -344,8 +345,8 @@ void pinode(ino_t ino);
void propagate(void);
void pwarn(const char *fmt, ...) __printflike(1, 2);
int readsb(int listerr);
int reply(char *question);
void rwerror(char *mesg, ufs2_daddr_t blk);
int reply(const char *question);
void rwerror(const char *mesg, ufs2_daddr_t blk);
void sblock_init(void);
void setinodebuf(ino_t);
int setup(char *dev);

View File

@ -85,7 +85,7 @@ ftypeok(union dinode *dp)
}
int
reply(char *question)
reply(const char *question)
{
int persevere;
char c;
@ -236,9 +236,9 @@ flush(int fd, struct bufarea *bp)
return;
}
if (bp->b_errs != 0)
pfatal("WRITING %sZERO'ED BLOCK %d TO DISK\n",
pfatal("WRITING %sZERO'ED BLOCK %lld TO DISK\n",
(bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
bp->b_bno);
(long long)bp->b_bno);
bp->b_errs = 0;
bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
if (bp != &sblk)
@ -252,7 +252,7 @@ flush(int fd, struct bufarea *bp)
}
void
rwerror(char *mesg, ufs2_daddr_t blk)
rwerror(const char *mesg, ufs2_daddr_t blk)
{
if (bkgrdcheck)
@ -360,11 +360,11 @@ bread(int fd, char *buf, ufs2_daddr_t blk, long size)
if (read(fd, cp, (int)secsize) != secsize) {
(void)lseek(fd, offset + i + secsize, 0);
if (secsize != dev_bsize && dev_bsize != 1)
printf(" %ld (%ld),",
(blk * dev_bsize + i) / secsize,
blk + i / dev_bsize);
printf(" %lld (%lld),",
(long long)(blk * dev_bsize + i) / secsize,
(long long)blk + i / dev_bsize);
else
printf(" %ld,", blk + i / dev_bsize);
printf(" %lld,", (long long)blk + i / dev_bsize);
errs++;
}
}
@ -399,7 +399,7 @@ bwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, 0);
printf(" %ld,", blk + i / dev_bsize);
printf(" %lld,", (long long)blk + i / dev_bsize);
}
printf("\n");
return;
@ -495,7 +495,7 @@ getpathname(char *namebuf, ino_t curdir, ino_t ino)
while (ino != ROOTINO) {
idesc.id_number = ino;
idesc.id_func = findino;
idesc.id_name = "..";
idesc.id_name = strdup("..");
if ((ckinode(ginode(ino), &idesc) & FOUND) == 0)
break;
namelookup:
@ -520,7 +520,7 @@ getpathname(char *namebuf, ino_t curdir, ino_t ino)
}
void
catch(int sig)
catch(int sig __unused)
{
ckfini(0);
@ -533,7 +533,7 @@ catch(int sig)
* so that reboot sequence may be interrupted.
*/
void
catchquit(int sig)
catchquit(int sig __unused)
{
printf("returning to single-user after filesystem check\n");
returntosingle = 1;
@ -544,7 +544,7 @@ catchquit(int sig)
* determine whether an inode should be fixed.
*/
int
dofix(struct inodesc *idesc, char *msg)
dofix(struct inodesc *idesc, const char *msg)
{
switch (idesc->id_fix) {
@ -614,7 +614,7 @@ pfatal(const char *fmt, ...)
return;
}
if (cdevname == NULL)
cdevname = "fsck";
cdevname = strdup("fsck");
(void)fprintf(stdout, "%s: ", cdevname);
(void)vfprintf(stdout, fmt, ap);
(void)fprintf(stdout,

View File

@ -156,7 +156,7 @@ static int
iblock(struct inodesc *idesc, long ilevel, off_t isize)
{
struct bufarea *bp;
int i, n, (*func)(), nif;
int i, n, (*func)(struct inodesc *), nif;
off_t sizepb;
char buf[BUFSIZ];
char pathbuf[MAXPATHLEN + 1];
@ -469,7 +469,7 @@ inodirty(void)
}
void
clri(struct inodesc *idesc, char *type, int flag)
clri(struct inodesc *idesc, const char *type, int flag)
{
union dinode *dp;
@ -492,8 +492,8 @@ clri(struct inodesc *idesc, char *type, int flag)
cmd.value = idesc->id_number;
cmd.size = -DIP(dp, di_nlink);
if (debug)
printf("adjrefcnt ino %ld amt %ld\n",
(long)cmd.value, cmd.size);
printf("adjrefcnt ino %ld amt %lld\n",
(long)cmd.value, (long long)cmd.size);
if (sysctl(adjrefcnt, MIBSIZE, 0, 0,
&cmd, sizeof cmd) == -1)
rwerror("ADJUST INODE", cmd.value);
@ -569,7 +569,7 @@ pinode(ino_t ino)
}
void
blkerror(ino_t ino, char *type, ufs2_daddr_t blk)
blkerror(ino_t ino, const char *type, ufs2_daddr_t blk)
{
pfatal("%lld %s I=%lu", (intmax_t)blk, type, (u_long)ino);

View File

@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#include "fsck.h"
static void usage(void) __dead2;
static int argtoi(int flag, char *req, char *str, int base);
static int argtoi(int flag, const char *req, const char *str, int base);
static int checkfilesys(char *filesys);
static struct statfs *getmntpt(const char *);
@ -166,7 +166,7 @@ main(int argc, char *argv[])
}
static int
argtoi(int flag, char *req, char *str, int base)
argtoi(int flag, const char *req, const char *str, int base)
{
char *cp;
int ret;
@ -190,7 +190,7 @@ checkfilesys(char *filesys)
struct statfs *mntp;
struct zlncnt *zlnp;
ufs2_daddr_t blks;
int cylno, size;
int cylno, size, ret;
ino_t files;
cdevname = filesys;
@ -295,8 +295,9 @@ checkfilesys(char *filesys)
clean:
pwarn("clean, %ld free ", (long)(sblock.fs_cstotal.cs_nffree +
sblock.fs_frag * sblock.fs_cstotal.cs_nbfree));
printf("(%d frags, %d blocks, %.1f%% fragmentation)\n",
sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree,
printf("(%lld frags, %lld blocks, %.1f%% fragmentation)\n",
(long long)sblock.fs_cstotal.cs_nffree,
(long long)sblock.fs_cstotal.cs_nbfree,
sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize);
return (0);
}
@ -368,22 +369,23 @@ checkfilesys(char *filesys)
blks = maxfsblock - (n_ffree + sblock.fs_frag * n_bfree) - blks;
if (bkgrdflag && (files > 0 || blks > 0)) {
countdirs = sblock.fs_cstotal.cs_ndir - countdirs;
pwarn("Reclaimed: %ld directories, %ld files, %d fragments\n",
countdirs, (long)files - countdirs, blks);
pwarn("Reclaimed: %ld directories, %ld files, %lld fragments\n",
countdirs, (long)files - countdirs, (long long)blks);
}
pwarn("%ld files, %ld used, %qu free ",
(long)n_files, (long)n_blks, n_ffree + sblock.fs_frag * n_bfree);
pwarn("%ld files, %lld used, %llu free ",
(long)n_files, (long long)n_blks,
n_ffree + sblock.fs_frag * n_bfree);
printf("(%qu frags, %qu blocks, %.1f%% fragmentation)\n",
n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize);
if (debug) {
if (files < 0)
printf("%d inodes missing\n", -files);
if (blks < 0)
printf("%d blocks missing\n", -blks);
printf("%lld blocks missing\n", -(long long)blks);
if (duplist != NULL) {
printf("The following duplicate blocks remain:");
for (dp = duplist; dp; dp = dp->next)
printf(" %d,", dp->dup);
printf(" %lld,", (long long)dp->dup);
printf("\n");
}
if (zlnhead != NULL) {
@ -430,8 +432,6 @@ checkfilesys(char *filesys)
if (rerun)
printf("\n***** PLEASE RERUN FSCK *****\n");
if (mntp != NULL) {
struct ufs_args args;
int ret;
/*
* We modified a mounted filesystem. Do a mount update on
* it unless it is read-write, so we can continue using it
@ -466,7 +466,7 @@ getmntpt(const char *name)
{
struct stat devstat, mntdevstat;
char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
char *devname;
char *ddevname;
struct statfs *mntbuf, *statfsp;
int i, mntsize, isdev;
@ -479,10 +479,10 @@ getmntpt(const char *name)
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for (i = 0; i < mntsize; i++) {
statfsp = &mntbuf[i];
devname = statfsp->f_mntfromname;
if (*devname != '/') {
ddevname = statfsp->f_mntfromname;
if (*ddevname != '/') {
strcpy(device, _PATH_DEV);
strcat(device, devname);
strcat(device, ddevname);
strcpy(statfsp->f_mntfromname, device);
}
if (isdev == 0) {
@ -490,7 +490,7 @@ getmntpt(const char *name)
continue;
return (statfsp);
}
if (stat(devname, &mntdevstat) == 0 &&
if (stat(ddevname, &mntdevstat) == 0 &&
mntdevstat.st_rdev == devstat.st_rdev)
return (statfsp);
}

View File

@ -190,7 +190,6 @@ checkinode(ino_t inumber, struct inodesc *idesc)
off_t kernmaxfilesize;
ufs2_daddr_t ndb;
mode_t mode;
char *symbuf;
int j;
dp = getnextinode(inumber);
@ -347,8 +346,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
cmd.value = idesc->id_number;
cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
if (debug)
printf("adjblkcnt ino %qu amount %ld\n",
cmd.value, cmd.size);
printf("adjblkcnt ino %qu amount %lld\n",
cmd.value, (long long)cmd.size);
if (sysctl(adjblkcnt, MIBSIZE, 0, 0,
&cmd, sizeof cmd) == -1)
rwerror("ADJUST INODE BLOCK COUNT", cmd.value);

View File

@ -230,7 +230,7 @@ pass2check(struct inodesc *idesc)
struct inoinfo *inp;
int n, entrysize, ret = 0;
union dinode *dp;
char *errmsg;
const char *errmsg;
struct direct proto;
char namebuf[MAXPATHLEN + 1];
char pathbuf[MAXPATHLEN + 1];
@ -461,6 +461,6 @@ static int
blksort(const void *arg1, const void *arg2)
{
return ((*(struct inoinfo **)arg1)->i_blks[0] -
(*(struct inoinfo **)arg2)->i_blks[0]);
return ((*(struct inoinfo * const *)arg1)->i_blks[0] -
(*(struct inoinfo * const *)arg2)->i_blks[0]);
}

View File

@ -50,7 +50,7 @@ static const char rcsid[] =
#include "fsck.h"
static void check_maps(u_char *, u_char *, int, int, char *, int *, int, int);
static void check_maps(u_char *, u_char *, int, int, const char *, int *, int, int);
void
pass5(void)
@ -81,7 +81,7 @@ pass5(void)
}
}
if (fs->fs_maxcontig > 1) {
char *doit = 0;
const char *doit = 0;
if (fs->fs_contigsumsize < 1) {
doit = "CREAT";
@ -348,7 +348,7 @@ check_maps(
u_char *map2, /* map of determined allocations */
int mapsize, /* size of above two maps */
int startvalue, /* resource value for first element in map */
char *name, /* name of resource found in maps */
const char *name, /* name of resource found in maps */
int *opcode, /* sysctl opcode to free resource */
int skip, /* number of entries to skip before starting to free */
int limit) /* limit on number of entries to free */

View File

@ -60,7 +60,7 @@ struct bufarea asblk;
#define altsblock (*asblk.b_un.b_fs)
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
static void badsb(int listerr, char *s);
static void badsb(int listerr, const char *s);
static int calcsb(char *dev, int devfd, struct fs *fs);
static struct disklabel *getdisklabel(char *s, int fd);
@ -74,7 +74,6 @@ setup(char *dev)
{
long cg, asked, i, j;
long bmapsize;
off_t sizepb;
struct stat statb;
struct fs proto;
size_t size;
@ -389,7 +388,7 @@ readsb(int listerr)
}
static void
badsb(int listerr, char *s)
badsb(int listerr, const char *s)
{
if (!listerr)

View File

@ -113,7 +113,7 @@ blockcheck(char *origname)
}
void
infohandler(int sig)
infohandler(int sig __unused)
{
got_siginfo = 1;
}

View File

@ -6,7 +6,7 @@ PROG= fsdb
MAN= fsdb.8
SRCS= fsdb.c fsdbutil.c \
dir.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
pass5.c preen.c setup.c utilities.c ffs_subr.c ffs_tables.c
pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
CFLAGS+= -I${.CURDIR}/../fsck_ffs
WARNS= 0
LDADD+= -ledit -ltermcap

View File

@ -32,8 +32,8 @@
extern int bread(int fd, char *buf, ufs2_daddr_t blk, long size);
extern void bwrite(int fd, char *buf, ufs2_daddr_t blk, long size);
extern void rwerror(char *mesg, ufs2_daddr_t blk);
extern int reply(char *question);
extern void rwerror(const char *mesg, ufs2_daddr_t blk);
extern int reply(const char *question);
extern long dev_bsize;
extern long secsize;