mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
o __P removed
o ansi function prototypes o unifdef -D__STDC__ o __dead2 on usage prototype o remove now-bogus main prototype
This commit is contained in:
parent
73bf18edb8
commit
b70cd7ee68
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92839
@ -71,15 +71,13 @@ union {
|
||||
|
||||
long dev_bsize = 1;
|
||||
|
||||
int dumpfs __P((char *));
|
||||
int dumpcg __P((char *, int, int));
|
||||
void pbits __P((void *, int));
|
||||
void usage __P((void));
|
||||
int dumpfs(const char *);
|
||||
int dumpcg(const char *, int, int);
|
||||
void pbits(void *, int);
|
||||
void usage(void) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct fstab *fs;
|
||||
int ch, eval;
|
||||
@ -105,8 +103,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
dumpfs(name)
|
||||
char *name;
|
||||
dumpfs(const char *name)
|
||||
{
|
||||
ssize_t n;
|
||||
int fd, c, i, j, k, size;
|
||||
@ -244,9 +241,7 @@ err: if (fd != -1)
|
||||
};
|
||||
|
||||
int
|
||||
dumpcg(name, fd, c)
|
||||
char *name;
|
||||
int fd, c;
|
||||
dumpcg(const char *name, int fd, int c)
|
||||
{
|
||||
off_t cur;
|
||||
int i, j;
|
||||
@ -311,9 +306,7 @@ dumpcg(name, fd, c)
|
||||
};
|
||||
|
||||
void
|
||||
pbits(vp, max)
|
||||
void *vp;
|
||||
int max;
|
||||
pbits(void *vp, int max)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
@ -335,7 +328,7 @@ pbits(vp, max)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: dumpfs filesys | device\n");
|
||||
exit(1);
|
||||
|
@ -80,25 +80,20 @@ static char *options = NULL;
|
||||
static int flags = 0;
|
||||
static int forceflag = 0;
|
||||
|
||||
int main __P((int, char *[]));
|
||||
|
||||
static int checkfs __P((const char *, const char *, const char *, char *,
|
||||
pid_t *));
|
||||
static int selected __P((const char *));
|
||||
static void addoption __P((char *));
|
||||
static const char *getoptions __P((const char *));
|
||||
static void addentry __P((struct fstypelist *, const char *, const char *));
|
||||
static void maketypelist __P((char *));
|
||||
static void catopt __P((char **, const char *));
|
||||
static void mangle __P((char *, int *, const char ***, int *));
|
||||
static const char *getfslab __P((const char *));
|
||||
static void usage __P((void));
|
||||
static int isok __P((struct fstab *));
|
||||
static int checkfs(const char *, const char *, const char *, char *, pid_t *);
|
||||
static int selected(const char *);
|
||||
static void addoption(char *);
|
||||
static const char *getoptions(const char *);
|
||||
static void addentry(struct fstypelist *, const char *, const char *);
|
||||
static void maketypelist(char *);
|
||||
static void catopt(char **, const char *);
|
||||
static void mangle(char *, int *, const char ***, int *);
|
||||
static const char *getfslab(const char *);
|
||||
static void usage(void) __dead2;
|
||||
static int isok(struct fstab *);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct fstab *fs;
|
||||
int i, rval = 0;
|
||||
@ -230,8 +225,7 @@ main(argc, argv)
|
||||
|
||||
|
||||
static int
|
||||
isok(fs)
|
||||
struct fstab *fs;
|
||||
isok(struct fstab *fs)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -283,10 +277,8 @@ isok(fs)
|
||||
|
||||
|
||||
static int
|
||||
checkfs(pvfstype, spec, mntpt, auxopt, pidp)
|
||||
const char *pvfstype, *spec, *mntpt;
|
||||
char *auxopt;
|
||||
pid_t *pidp;
|
||||
checkfs(const char *pvfstype, const char *spec, const char *mntpt,
|
||||
char *auxopt, pid_t *pidp)
|
||||
{
|
||||
/* List of directories containing fsck_xxx subcommands. */
|
||||
static const char *edirs[] = {
|
||||
@ -416,8 +408,7 @@ checkfs(pvfstype, spec, mntpt, auxopt, pidp)
|
||||
|
||||
|
||||
static int
|
||||
selected(type)
|
||||
const char *type;
|
||||
selected(const char *type)
|
||||
{
|
||||
struct entry *e;
|
||||
|
||||
@ -431,8 +422,7 @@ selected(type)
|
||||
|
||||
|
||||
static const char *
|
||||
getoptions(type)
|
||||
const char *type;
|
||||
getoptions(const char *type)
|
||||
{
|
||||
struct entry *e;
|
||||
|
||||
@ -444,8 +434,7 @@ getoptions(type)
|
||||
|
||||
|
||||
static void
|
||||
addoption(optstr)
|
||||
char *optstr;
|
||||
addoption(char *optstr)
|
||||
{
|
||||
char *newoptions;
|
||||
struct entry *e;
|
||||
@ -465,10 +454,7 @@ addoption(optstr)
|
||||
|
||||
|
||||
static void
|
||||
addentry(list, type, opts)
|
||||
struct fstypelist *list;
|
||||
const char *type;
|
||||
const char *opts;
|
||||
addentry(struct fstypelist *list, const char *type, const char *opts)
|
||||
{
|
||||
struct entry *e;
|
||||
|
||||
@ -480,8 +466,7 @@ addentry(list, type, opts)
|
||||
|
||||
|
||||
static void
|
||||
maketypelist(fslist)
|
||||
char *fslist;
|
||||
maketypelist(char *fslist)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@ -502,9 +487,7 @@ maketypelist(fslist)
|
||||
|
||||
|
||||
static void
|
||||
catopt(sp, o)
|
||||
char **sp;
|
||||
const char *o;
|
||||
catopt(char **sp, const char *o)
|
||||
{
|
||||
char *s;
|
||||
size_t i, j;
|
||||
@ -522,10 +505,7 @@ catopt(sp, o)
|
||||
|
||||
|
||||
static void
|
||||
mangle(options, argcp, argvp, maxargcp)
|
||||
char *options;
|
||||
int *argcp, *maxargcp;
|
||||
const char ***argvp;
|
||||
mangle(char *options, int *argcp, const char ***argvp, int *maxargcp)
|
||||
{
|
||||
char *p, *s;
|
||||
int argc, maxargc;
|
||||
@ -563,8 +543,7 @@ mangle(options, argcp, argvp, maxargcp)
|
||||
|
||||
|
||||
const static char *
|
||||
getfslab(str)
|
||||
const char *str;
|
||||
getfslab(const char *str)
|
||||
{
|
||||
struct disklabel dl;
|
||||
int fd;
|
||||
@ -599,7 +578,7 @@ getfslab(str)
|
||||
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
static const char common[] =
|
||||
|
@ -43,11 +43,7 @@ __RCSID("$NetBSD: fsutil.c,v 1.7 1998/07/30 17:41:03 thorpej Exp $");
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fstab.h>
|
||||
#include <err.h>
|
||||
@ -65,58 +61,41 @@ static int preen = 0;
|
||||
|
||||
extern char *__progname;
|
||||
|
||||
static void vmsg __P((int, const char *, va_list)) __printflike(2, 0);
|
||||
static void vmsg(int, const char *, va_list) __printflike(2, 0);
|
||||
|
||||
void
|
||||
setcdevname(cd, pr)
|
||||
const char *cd;
|
||||
int pr;
|
||||
setcdevname(const char *cd, int pr)
|
||||
{
|
||||
dev = cd;
|
||||
preen = pr;
|
||||
}
|
||||
|
||||
const char *
|
||||
cdevname()
|
||||
cdevname(void)
|
||||
{
|
||||
return dev;
|
||||
}
|
||||
|
||||
int
|
||||
hotroot()
|
||||
hotroot(void)
|
||||
{
|
||||
return hot;
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
void
|
||||
#if __STDC__
|
||||
errexit(const char *fmt, ...)
|
||||
#else
|
||||
errexit(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
const char *fmt;
|
||||
|
||||
va_start(ap);
|
||||
fmt = va_arg(ap, const char *);
|
||||
#endif
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(8);
|
||||
}
|
||||
|
||||
static void
|
||||
vmsg(fatal, fmt, ap)
|
||||
int fatal;
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
vmsg(int fatal, const char *fmt, va_list ap)
|
||||
{
|
||||
if (!fatal && preen)
|
||||
(void) printf("%s: ", dev);
|
||||
@ -136,82 +115,45 @@ vmsg(fatal, fmt, ap)
|
||||
|
||||
/*VARARGS*/
|
||||
void
|
||||
#if __STDC__
|
||||
pfatal(const char *fmt, ...)
|
||||
#else
|
||||
pfatal(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
const char *fmt;
|
||||
|
||||
va_start(ap);
|
||||
fmt = va_arg(ap, const char *);
|
||||
#endif
|
||||
vmsg(1, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*VARARGS*/
|
||||
void
|
||||
#if __STDC__
|
||||
pwarn(const char *fmt, ...)
|
||||
#else
|
||||
pwarn(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
const char *fmt;
|
||||
|
||||
va_start(ap);
|
||||
fmt = va_arg(ap, const char *);
|
||||
#endif
|
||||
va_start(ap, fmt);
|
||||
vmsg(0, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
perror(s)
|
||||
const char *s;
|
||||
perror(const char *s)
|
||||
{
|
||||
pfatal("%s (%s)", s, strerror(errno));
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
panic(const char *fmt, ...)
|
||||
#else
|
||||
panic(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
const char *fmt;
|
||||
|
||||
va_start(ap);
|
||||
fmt = va_arg(ap, const char *);
|
||||
#endif
|
||||
vmsg(1, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(8);
|
||||
}
|
||||
|
||||
const char *
|
||||
unrawname(name)
|
||||
const char *name;
|
||||
unrawname(const char *name)
|
||||
{
|
||||
static char unrawbuf[32];
|
||||
const char *dp;
|
||||
@ -230,8 +172,7 @@ unrawname(name)
|
||||
}
|
||||
|
||||
const char *
|
||||
rawname(name)
|
||||
const char *name;
|
||||
rawname(const char *name)
|
||||
{
|
||||
static char rawbuf[32];
|
||||
const char *dp;
|
||||
@ -243,8 +184,7 @@ rawname(name)
|
||||
}
|
||||
|
||||
const char *
|
||||
devcheck(origname)
|
||||
const char *origname;
|
||||
devcheck(const char *origname)
|
||||
{
|
||||
struct stat stslash, stchar;
|
||||
|
||||
@ -269,8 +209,7 @@ devcheck(origname)
|
||||
* Get the mount point information for name.
|
||||
*/
|
||||
struct statfs *
|
||||
getmntpt(name)
|
||||
const char *name;
|
||||
getmntpt(const char *name)
|
||||
{
|
||||
struct stat devstat, mntdevstat;
|
||||
char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
|
||||
@ -306,69 +245,9 @@ getmntpt(name)
|
||||
return (statfsp);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX this code is from NetBSD, but fails in FreeBSD because we
|
||||
* don't have blockdevs. I don't think its needed.
|
||||
*/
|
||||
const char *
|
||||
blockcheck(origname)
|
||||
const char *origname;
|
||||
{
|
||||
struct stat stslash, stblock, stchar;
|
||||
const char *newname, *raw;
|
||||
struct fstab *fsp;
|
||||
int retried = 0;
|
||||
|
||||
hot = 0;
|
||||
if (stat("/", &stslash) < 0) {
|
||||
perror("/");
|
||||
printf("Can't stat root\n");
|
||||
return (origname);
|
||||
}
|
||||
newname = origname;
|
||||
retry:
|
||||
if (stat(newname, &stblock) < 0) {
|
||||
perror(newname);
|
||||
printf("Can't stat %s\n", newname);
|
||||
return (origname);
|
||||
}
|
||||
if (S_ISBLK(stblock.st_mode)) {
|
||||
if (stslash.st_dev == stblock.st_rdev)
|
||||
hot++;
|
||||
raw = rawname(newname);
|
||||
if (stat(raw, &stchar) < 0) {
|
||||
perror(raw);
|
||||
printf("Can't stat %s\n", raw);
|
||||
return (origname);
|
||||
}
|
||||
if (S_ISCHR(stchar.st_mode)) {
|
||||
return (raw);
|
||||
} else {
|
||||
printf("%s is not a character device\n", raw);
|
||||
return (origname);
|
||||
}
|
||||
} else if (S_ISCHR(stblock.st_mode) && !retried) {
|
||||
newname = unrawname(newname);
|
||||
retried++;
|
||||
goto retry;
|
||||
} else if ((fsp = getfsfile(newname)) != 0 && !retried) {
|
||||
newname = fsp->fs_spec;
|
||||
retried++;
|
||||
goto retry;
|
||||
}
|
||||
/*
|
||||
* Not a block or character device, just return name and
|
||||
* let the user decide whether to use it.
|
||||
*/
|
||||
return (origname);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void *
|
||||
emalloc(s)
|
||||
size_t s;
|
||||
emalloc(size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
@ -380,9 +259,7 @@ emalloc(s)
|
||||
|
||||
|
||||
void *
|
||||
erealloc(p, s)
|
||||
void *p;
|
||||
size_t s;
|
||||
erealloc(void *p, size_t s)
|
||||
{
|
||||
void *q;
|
||||
|
||||
@ -394,8 +271,7 @@ erealloc(p, s)
|
||||
|
||||
|
||||
char *
|
||||
estrdup(s)
|
||||
const char *s;
|
||||
estrdup(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@ -31,28 +31,25 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
void perror __P((const char *));
|
||||
void errexit __P((const char *, ...))
|
||||
void perror(const char *);
|
||||
void errexit(const char *, ...)
|
||||
__attribute__((__noreturn__,__format__(__printf__,1,2)));
|
||||
void pfatal __P((const char *, ...))
|
||||
void pfatal(const char *, ...)
|
||||
__attribute__((__format__(__printf__,1,2)));
|
||||
void pwarn __P((const char *, ...))
|
||||
void pwarn(const char *, ...)
|
||||
__attribute__((__format__(__printf__,1,2)));
|
||||
void panic __P((const char *, ...))
|
||||
void panic(const char *, ...)
|
||||
__attribute__((__noreturn__,__format__(__printf__,1,2)));
|
||||
const char *rawname __P((const char *));
|
||||
const char *unrawname __P((const char *));
|
||||
#if 0
|
||||
const char *blockcheck __P((const char *));
|
||||
#endif
|
||||
const char *devcheck __P((const char *));
|
||||
const char *cdevname __P((void));
|
||||
void setcdevname __P((const char *, int));
|
||||
struct statfs *getmntpt __P((const char *));
|
||||
int hotroot __P((void));
|
||||
void *emalloc __P((size_t));
|
||||
void *erealloc __P((void *, size_t));
|
||||
char *estrdup __P((const char *));
|
||||
const char *rawname(const char *);
|
||||
const char *unrawname(const char *);
|
||||
const char *devcheck(const char *);
|
||||
const char *cdevname(void);
|
||||
void setcdevname(const char *, int);
|
||||
struct statfs *getmntpt(const char *);
|
||||
int hotroot(void);
|
||||
void *emalloc(size_t);
|
||||
void *erealloc(void *, size_t);
|
||||
char *estrdup(const char *);
|
||||
|
||||
#define CHECK_PREEN 0x0001
|
||||
#define CHECK_VERBOSE 0x0002
|
||||
@ -61,5 +58,5 @@ char *estrdup __P((const char *));
|
||||
#define DO_BACKGRD 0x0010
|
||||
|
||||
struct fstab;
|
||||
int checkfstab __P((int, int (*)(struct fstab *),
|
||||
int (*) (const char *, const char *, const char *, char *, pid_t *)));
|
||||
int checkfstab(int, int (*)(struct fstab *),
|
||||
int (*) (const char *, const char *, const char *, char *, pid_t *));
|
||||
|
@ -79,18 +79,15 @@ TAILQ_HEAD(disk, diskentry) diskh;
|
||||
|
||||
static int nrun = 0, ndisks = 0;
|
||||
|
||||
static struct diskentry *finddisk __P((const char *));
|
||||
static void addpart __P((const char *, const char *, const char *));
|
||||
static int startdisk __P((struct diskentry *,
|
||||
int (*)(const char *, const char *, const char *, char *, pid_t *)));
|
||||
static void printpart __P((void));
|
||||
static struct diskentry *finddisk(const char *);
|
||||
static void addpart(const char *, const char *, const char *);
|
||||
static int startdisk(struct diskentry *,
|
||||
int (*)(const char *, const char *, const char *, char *, pid_t *));
|
||||
static void printpart(void);
|
||||
|
||||
int
|
||||
checkfstab(flags, docheck, checkit)
|
||||
int flags;
|
||||
int (*docheck) __P((struct fstab *));
|
||||
int (*checkit) __P((const char *, const char *, const char *, char *,
|
||||
pid_t *));
|
||||
checkfstab(int flags, int (*docheck)(struct fstab *),
|
||||
int (*checkit)(const char *, const char *, const char *, char *, pid_t *))
|
||||
{
|
||||
struct fstab *fs;
|
||||
struct diskentry *d, *nextdisk;
|
||||
@ -247,8 +244,7 @@ checkfstab(flags, docheck, checkit)
|
||||
|
||||
|
||||
static struct diskentry *
|
||||
finddisk(name)
|
||||
const char *name;
|
||||
finddisk(const char *name)
|
||||
{
|
||||
const char *p;
|
||||
size_t len = 0;
|
||||
@ -285,7 +281,7 @@ finddisk(name)
|
||||
|
||||
|
||||
static void
|
||||
printpart()
|
||||
printpart(void)
|
||||
{
|
||||
struct diskentry *d;
|
||||
struct partentry *p;
|
||||
@ -300,8 +296,7 @@ printpart()
|
||||
|
||||
|
||||
static void
|
||||
addpart(type, devname, mntpt)
|
||||
const char *type, *devname, *mntpt;
|
||||
addpart(const char *type, const char *devname, const char *mntpt)
|
||||
{
|
||||
struct diskentry *d = finddisk(devname);
|
||||
struct partentry *p;
|
||||
@ -322,10 +317,8 @@ addpart(type, devname, mntpt)
|
||||
|
||||
|
||||
static int
|
||||
startdisk(d, checkit)
|
||||
struct diskentry *d;
|
||||
int (*checkit) __P((const char *, const char *, const char *, char *,
|
||||
pid_t *));
|
||||
startdisk(struct diskentry *d, int (*checkit)(const char *, const char *,
|
||||
const char *, char *, pid_t *))
|
||||
{
|
||||
struct partentry *p = TAILQ_FIRST(&d->d_part);
|
||||
int rv;
|
||||
|
@ -67,20 +67,20 @@ struct odirtemplate odirhead = {
|
||||
0, DIRBLKSIZ - 12, 2, ".."
|
||||
};
|
||||
|
||||
static int chgino __P((struct inodesc *));
|
||||
static int dircheck __P((struct inodesc *, struct direct *));
|
||||
static int expanddir __P((struct dinode *dp, char *name));
|
||||
static void freedir __P((ino_t ino, ino_t parent));
|
||||
static struct direct *fsck_readdir __P((struct inodesc *));
|
||||
static struct bufarea *getdirblk __P((ufs_daddr_t blkno, long size));
|
||||
static int lftempname __P((char *bufp, ino_t ino));
|
||||
static int mkentry __P((struct inodesc *));
|
||||
static int chgino(struct inodesc *);
|
||||
static int dircheck(struct inodesc *, struct direct *);
|
||||
static int expanddir(struct dinode *dp, char *name);
|
||||
static void freedir(ino_t ino, ino_t parent);
|
||||
static struct direct *fsck_readdir(struct inodesc *);
|
||||
static struct bufarea *getdirblk(ufs_daddr_t blkno, long size);
|
||||
static int lftempname(char *bufp, ino_t ino);
|
||||
static int mkentry(struct inodesc *);
|
||||
|
||||
/*
|
||||
* Propagate connected state through the tree.
|
||||
*/
|
||||
void
|
||||
propagate()
|
||||
propagate(void)
|
||||
{
|
||||
struct inoinfo **inpp, *inp;
|
||||
struct inoinfo **inpend;
|
||||
@ -106,8 +106,7 @@ propagate()
|
||||
* Scan each entry in a directory block.
|
||||
*/
|
||||
int
|
||||
dirscan(idesc)
|
||||
struct inodesc *idesc;
|
||||
dirscan(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct bufarea *bp;
|
||||
@ -170,8 +169,7 @@ dirscan(idesc)
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
static struct direct *
|
||||
fsck_readdir(idesc)
|
||||
struct inodesc *idesc;
|
||||
fsck_readdir(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp, *ndp;
|
||||
struct bufarea *bp;
|
||||
@ -232,9 +230,7 @@ fsck_readdir(idesc)
|
||||
* This is a superset of the checks made in the kernel.
|
||||
*/
|
||||
static int
|
||||
dircheck(idesc, dp)
|
||||
struct inodesc *idesc;
|
||||
struct direct *dp;
|
||||
dircheck(struct inodesc *idesc, struct direct *dp)
|
||||
{
|
||||
int size;
|
||||
char *cp;
|
||||
@ -281,18 +277,14 @@ dircheck(idesc, dp)
|
||||
}
|
||||
|
||||
void
|
||||
direrror(ino, errmesg)
|
||||
ino_t ino;
|
||||
char *errmesg;
|
||||
direrror(ino_t ino, char *errmesg)
|
||||
{
|
||||
|
||||
fileerror(ino, ino, errmesg);
|
||||
}
|
||||
|
||||
void
|
||||
fileerror(cwd, ino, errmesg)
|
||||
ino_t cwd, ino;
|
||||
char *errmesg;
|
||||
fileerror(ino_t cwd, ino_t ino, char *errmesg)
|
||||
{
|
||||
struct dinode *dp;
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
@ -314,9 +306,7 @@ fileerror(cwd, ino, errmesg)
|
||||
}
|
||||
|
||||
void
|
||||
adjust(idesc, lcnt)
|
||||
struct inodesc *idesc;
|
||||
int lcnt;
|
||||
adjust(struct inodesc *idesc, int lcnt)
|
||||
{
|
||||
struct dinode *dp;
|
||||
int saveresolved;
|
||||
@ -384,8 +374,7 @@ adjust(idesc, lcnt)
|
||||
}
|
||||
|
||||
static int
|
||||
mkentry(idesc)
|
||||
struct inodesc *idesc;
|
||||
mkentry(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct direct newent;
|
||||
@ -429,8 +418,7 @@ mkentry(idesc)
|
||||
}
|
||||
|
||||
static int
|
||||
chgino(idesc)
|
||||
struct inodesc *idesc;
|
||||
chgino(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -445,10 +433,7 @@ chgino(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
linkup(orphan, parentdir, name)
|
||||
ino_t orphan;
|
||||
ino_t parentdir;
|
||||
char *name;
|
||||
linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
{
|
||||
struct dinode *dp;
|
||||
int lostdir;
|
||||
@ -567,10 +552,7 @@ linkup(orphan, parentdir, name)
|
||||
* fix an entry in a directory.
|
||||
*/
|
||||
int
|
||||
changeino(dir, name, newnum)
|
||||
ino_t dir;
|
||||
char *name;
|
||||
ino_t newnum;
|
||||
changeino(ino_t dir, char *name, ino_t newnum)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
@ -588,9 +570,7 @@ changeino(dir, name, newnum)
|
||||
* make an entry in a directory
|
||||
*/
|
||||
int
|
||||
makeentry(parent, ino, name)
|
||||
ino_t parent, ino;
|
||||
char *name;
|
||||
makeentry(ino_t parent, ino_t ino, char *name)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct inodesc idesc;
|
||||
@ -624,9 +604,7 @@ makeentry(parent, ino, name)
|
||||
* Attempt to expand the size of a directory
|
||||
*/
|
||||
static int
|
||||
expanddir(dp, name)
|
||||
struct dinode *dp;
|
||||
char *name;
|
||||
expanddir(struct dinode *dp, char *name)
|
||||
{
|
||||
ufs_daddr_t lastbn, newblk;
|
||||
struct bufarea *bp;
|
||||
@ -681,9 +659,7 @@ expanddir(dp, name)
|
||||
* allocate a new directory
|
||||
*/
|
||||
ino_t
|
||||
allocdir(parent, request, mode)
|
||||
ino_t parent, request;
|
||||
int mode;
|
||||
allocdir(ino_t parent, ino_t request, int mode)
|
||||
{
|
||||
ino_t ino;
|
||||
char *cp;
|
||||
@ -742,8 +718,7 @@ allocdir(parent, request, mode)
|
||||
* free a directory inode
|
||||
*/
|
||||
static void
|
||||
freedir(ino, parent)
|
||||
ino_t ino, parent;
|
||||
freedir(ino_t ino, ino_t parent)
|
||||
{
|
||||
struct dinode *dp;
|
||||
|
||||
@ -759,9 +734,7 @@ freedir(ino, parent)
|
||||
* generate a temporary name for the lost+found directory.
|
||||
*/
|
||||
static int
|
||||
lftempname(bufp, ino)
|
||||
char *bufp;
|
||||
ino_t ino;
|
||||
lftempname(char *bufp, ino_t ino)
|
||||
{
|
||||
ino_t in;
|
||||
char *cp;
|
||||
@ -786,9 +759,7 @@ lftempname(bufp, ino)
|
||||
* Insure that it is held until another is requested.
|
||||
*/
|
||||
static struct bufarea *
|
||||
getdirblk(blkno, size)
|
||||
ufs_daddr_t blkno;
|
||||
long size;
|
||||
getdirblk(ufs_daddr_t blkno, long size)
|
||||
{
|
||||
|
||||
if (pdirbp != 0)
|
||||
|
@ -257,67 +257,67 @@ struct dinode zino;
|
||||
struct fstab;
|
||||
|
||||
|
||||
void adjust __P((struct inodesc *, int lcnt));
|
||||
ufs_daddr_t allocblk __P((long frags));
|
||||
ino_t allocdir __P((ino_t parent, ino_t request, int mode));
|
||||
ino_t allocino __P((ino_t request, int type));
|
||||
void blkerror __P((ino_t ino, char *type, ufs_daddr_t blk));
|
||||
char *blockcheck __P((char *name));
|
||||
int bread __P((int fd, char *buf, ufs_daddr_t blk, long size));
|
||||
void bufinit __P((void));
|
||||
void bwrite __P((int fd, char *buf, ufs_daddr_t blk, long size));
|
||||
void cacheino __P((struct dinode *dp, ino_t inumber));
|
||||
void catch __P((int));
|
||||
void catchquit __P((int));
|
||||
int changeino __P((ino_t dir, char *name, ino_t newnum));
|
||||
int chkrange __P((ufs_daddr_t blk, int cnt));
|
||||
void ckfini __P((int markclean));
|
||||
int ckinode __P((struct dinode *dp, struct inodesc *));
|
||||
void clri __P((struct inodesc *, char *type, int flag));
|
||||
int clearentry __P((struct inodesc *));
|
||||
void direrror __P((ino_t ino, char *errmesg));
|
||||
int dirscan __P((struct inodesc *));
|
||||
int dofix __P((struct inodesc *, char *msg));
|
||||
void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void ffs_fragacct __P((struct fs *, int, int32_t [], int));
|
||||
int ffs_isblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void ffs_setblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void fileerror __P((ino_t cwd, ino_t ino, char *errmesg));
|
||||
int findino __P((struct inodesc *));
|
||||
int findname __P((struct inodesc *));
|
||||
void flush __P((int fd, struct bufarea *bp));
|
||||
void freeblk __P((ufs_daddr_t blkno, long frags));
|
||||
void freeino __P((ino_t ino));
|
||||
void freeinodebuf __P((void));
|
||||
int ftypeok __P((struct dinode *dp));
|
||||
void getblk __P((struct bufarea *bp, ufs_daddr_t blk, long size));
|
||||
struct bufarea *getdatablk __P((ufs_daddr_t blkno, long size));
|
||||
struct inoinfo *getinoinfo __P((ino_t inumber));
|
||||
struct dinode *getnextinode __P((ino_t inumber));
|
||||
void getpathname __P((char *namebuf, ino_t curdir, ino_t ino));
|
||||
struct dinode *ginode __P((ino_t inumber));
|
||||
void infohandler __P((int sig));
|
||||
void inocleanup __P((void));
|
||||
void inodirty __P((void));
|
||||
struct inostat *inoinfo __P((ino_t inum));
|
||||
int linkup __P((ino_t orphan, ino_t parentdir, char *name));
|
||||
int makeentry __P((ino_t parent, ino_t ino, char *name));
|
||||
void panic __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void pass1 __P((void));
|
||||
void pass1b __P((void));
|
||||
int pass1check __P((struct inodesc *));
|
||||
void pass2 __P((void));
|
||||
void pass3 __P((void));
|
||||
void pass4 __P((void));
|
||||
int pass4check __P((struct inodesc *));
|
||||
void pass5 __P((void));
|
||||
void pfatal __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void pinode __P((ino_t ino));
|
||||
void propagate __P((void));
|
||||
void pwarn __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
int readsb __P((int listerr));
|
||||
int reply __P((char *question));
|
||||
void rwerror __P((char *mesg, ufs_daddr_t blk));
|
||||
void sblock_init __P((void));
|
||||
void setinodebuf __P((ino_t));
|
||||
int setup __P((char *dev));
|
||||
void adjust(struct inodesc *, int lcnt);
|
||||
ufs_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, ufs_daddr_t blk);
|
||||
char *blockcheck(char *name);
|
||||
int bread(int fd, char *buf, ufs_daddr_t blk, long size);
|
||||
void bufinit(void);
|
||||
void bwrite(int fd, char *buf, ufs_daddr_t blk, long size);
|
||||
void cacheino(struct dinode *dp, ino_t inumber);
|
||||
void catch(int);
|
||||
void catchquit(int);
|
||||
int changeino(ino_t dir, char *name, ino_t newnum);
|
||||
int chkrange(ufs_daddr_t blk, int cnt);
|
||||
void ckfini(int markclean);
|
||||
int ckinode(struct dinode *dp, struct inodesc *);
|
||||
void clri(struct inodesc *, char *type, int flag);
|
||||
int clearentry(struct inodesc *);
|
||||
void direrror(ino_t ino, char *errmesg);
|
||||
int dirscan(struct inodesc *);
|
||||
int dofix(struct inodesc *, char *msg);
|
||||
void ffs_clrblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void ffs_fragacct(struct fs *, int, int32_t [], int);
|
||||
int ffs_isblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void ffs_setblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void fileerror(ino_t cwd, ino_t ino, char *errmesg);
|
||||
int findino(struct inodesc *);
|
||||
int findname(struct inodesc *);
|
||||
void flush(int fd, struct bufarea *bp);
|
||||
void freeblk(ufs_daddr_t blkno, long frags);
|
||||
void freeino(ino_t ino);
|
||||
void freeinodebuf(void);
|
||||
int ftypeok(struct dinode *dp);
|
||||
void getblk(struct bufarea *bp, ufs_daddr_t blk, long size);
|
||||
struct bufarea *getdatablk(ufs_daddr_t blkno, long size);
|
||||
struct inoinfo *getinoinfo(ino_t inumber);
|
||||
struct dinode *getnextinode(ino_t inumber);
|
||||
void getpathname(char *namebuf, ino_t curdir, ino_t ino);
|
||||
struct dinode *ginode(ino_t inumber);
|
||||
void infohandler(int sig);
|
||||
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);
|
||||
void panic(const char *fmt, ...) __printflike(1, 2);
|
||||
void pass1(void);
|
||||
void pass1b(void);
|
||||
int pass1check(struct inodesc *);
|
||||
void pass2(void);
|
||||
void pass3(void);
|
||||
void pass4(void);
|
||||
int pass4check(struct inodesc *);
|
||||
void pass5(void);
|
||||
void pfatal(const char *fmt, ...) __printflike(1, 2);
|
||||
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, ufs_daddr_t blk);
|
||||
void sblock_init(void);
|
||||
void setinodebuf(ino_t);
|
||||
int setup(char *dev);
|
||||
|
@ -62,8 +62,7 @@ static const char rcsid[] =
|
||||
long diskreads, totalreads; /* Disk cache statistics */
|
||||
|
||||
int
|
||||
ftypeok(dp)
|
||||
struct dinode *dp;
|
||||
ftypeok(struct dinode *dp)
|
||||
{
|
||||
switch (dp->di_mode & IFMT) {
|
||||
|
||||
@ -84,8 +83,7 @@ ftypeok(dp)
|
||||
}
|
||||
|
||||
int
|
||||
reply(question)
|
||||
char *question;
|
||||
reply(char *question)
|
||||
{
|
||||
int persevere;
|
||||
char c;
|
||||
@ -125,8 +123,7 @@ reply(question)
|
||||
* Look up state information for an inode.
|
||||
*/
|
||||
struct inostat *
|
||||
inoinfo(inum)
|
||||
ino_t inum;
|
||||
inoinfo(ino_t inum)
|
||||
{
|
||||
static struct inostat unallocated = { USTATE, 0, 0 };
|
||||
struct inostatlist *ilp;
|
||||
@ -145,7 +142,7 @@ inoinfo(inum)
|
||||
* Malloc buffers and set up cache.
|
||||
*/
|
||||
void
|
||||
bufinit()
|
||||
bufinit(void)
|
||||
{
|
||||
struct bufarea *bp;
|
||||
long bufcnt, i;
|
||||
@ -183,9 +180,7 @@ bufinit()
|
||||
* Manage a cache of directory blocks.
|
||||
*/
|
||||
struct bufarea *
|
||||
getdatablk(blkno, size)
|
||||
ufs_daddr_t blkno;
|
||||
long size;
|
||||
getdatablk(ufs_daddr_t blkno, long size)
|
||||
{
|
||||
struct bufarea *bp;
|
||||
|
||||
@ -212,10 +207,7 @@ getdatablk(blkno, size)
|
||||
}
|
||||
|
||||
void
|
||||
getblk(bp, blk, size)
|
||||
struct bufarea *bp;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
getblk(struct bufarea *bp, ufs_daddr_t blk, long size)
|
||||
{
|
||||
ufs_daddr_t dblk;
|
||||
|
||||
@ -230,9 +222,7 @@ getblk(bp, blk, size)
|
||||
}
|
||||
|
||||
void
|
||||
flush(fd, bp)
|
||||
int fd;
|
||||
struct bufarea *bp;
|
||||
flush(int fd, struct bufarea *bp)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -260,9 +250,7 @@ flush(fd, bp)
|
||||
}
|
||||
|
||||
void
|
||||
rwerror(mesg, blk)
|
||||
char *mesg;
|
||||
ufs_daddr_t blk;
|
||||
rwerror(char *mesg, ufs_daddr_t blk)
|
||||
{
|
||||
|
||||
if (bkgrdcheck)
|
||||
@ -275,8 +263,7 @@ rwerror(mesg, blk)
|
||||
}
|
||||
|
||||
void
|
||||
ckfini(markclean)
|
||||
int markclean;
|
||||
ckfini(int markclean)
|
||||
{
|
||||
struct bufarea *bp, *nbp;
|
||||
int ofsmodified, cnt = 0;
|
||||
@ -348,11 +335,7 @@ ckfini(markclean)
|
||||
}
|
||||
|
||||
int
|
||||
bread(fd, buf, blk, size)
|
||||
int fd;
|
||||
char *buf;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
bread(int fd, char *buf, ufs_daddr_t blk, long size)
|
||||
{
|
||||
char *cp;
|
||||
int i, errs;
|
||||
@ -389,11 +372,7 @@ bread(fd, buf, blk, size)
|
||||
}
|
||||
|
||||
void
|
||||
bwrite(fd, buf, blk, size)
|
||||
int fd;
|
||||
char *buf;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
bwrite(int fd, char *buf, ufs_daddr_t blk, long size)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
@ -427,8 +406,7 @@ bwrite(fd, buf, blk, size)
|
||||
* allocate a data block with the specified number of fragments
|
||||
*/
|
||||
ufs_daddr_t
|
||||
allocblk(frags)
|
||||
long frags;
|
||||
allocblk(long frags)
|
||||
{
|
||||
int i, j, k, cg, baseblk;
|
||||
struct cg *cgp = &cgrp;
|
||||
@ -471,9 +449,7 @@ allocblk(frags)
|
||||
* Free a previously allocated block
|
||||
*/
|
||||
void
|
||||
freeblk(blkno, frags)
|
||||
ufs_daddr_t blkno;
|
||||
long frags;
|
||||
freeblk(ufs_daddr_t blkno, long frags)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
@ -486,9 +462,7 @@ freeblk(blkno, frags)
|
||||
* Find a pathname
|
||||
*/
|
||||
void
|
||||
getpathname(namebuf, curdir, ino)
|
||||
char *namebuf;
|
||||
ino_t curdir, ino;
|
||||
getpathname(char *namebuf, ino_t curdir, ino_t ino)
|
||||
{
|
||||
int len;
|
||||
char *cp;
|
||||
@ -543,8 +517,7 @@ getpathname(namebuf, curdir, ino)
|
||||
}
|
||||
|
||||
void
|
||||
catch(sig)
|
||||
int sig;
|
||||
catch(int sig)
|
||||
{
|
||||
if (!doinglevel2)
|
||||
ckfini(0);
|
||||
@ -557,8 +530,7 @@ catch(sig)
|
||||
* so that reboot sequence may be interrupted.
|
||||
*/
|
||||
void
|
||||
catchquit(sig)
|
||||
int sig;
|
||||
catchquit(int sig)
|
||||
{
|
||||
printf("returning to single-user after filesystem check\n");
|
||||
returntosingle = 1;
|
||||
@ -569,9 +541,7 @@ catchquit(sig)
|
||||
* determine whether an inode should be fixed.
|
||||
*/
|
||||
int
|
||||
dofix(idesc, msg)
|
||||
struct inodesc *idesc;
|
||||
char *msg;
|
||||
dofix(struct inodesc *idesc, char *msg)
|
||||
{
|
||||
|
||||
switch (idesc->id_fix) {
|
||||
@ -607,11 +577,7 @@ dofix(idesc, msg)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* An unexpected inconsistency occured.
|
||||
@ -619,20 +585,10 @@ dofix(idesc, msg)
|
||||
* otherwise just print message and continue.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
pfatal(const char *fmt, ...)
|
||||
#else
|
||||
pfatal(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (!preen) {
|
||||
(void)vfprintf(stdout, fmt, ap);
|
||||
va_end(ap);
|
||||
@ -680,20 +636,10 @@ pfatal(fmt, va_alist)
|
||||
* protocol, or a warning (preceded by filename) when preening.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
pwarn(const char *fmt, ...)
|
||||
#else
|
||||
pwarn(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (preen)
|
||||
(void)fprintf(stdout, "%s: ", cdevname);
|
||||
(void)vfprintf(stdout, fmt, ap);
|
||||
@ -704,20 +650,10 @@ pwarn(fmt, va_alist)
|
||||
* Stub for routines from kernel.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
panic(const char *fmt, ...)
|
||||
#else
|
||||
panic(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
pfatal("INTERNAL INCONSISTENCY:");
|
||||
(void)vfprintf(stdout, fmt, ap);
|
||||
va_end(ap);
|
||||
|
@ -55,12 +55,10 @@ static const char rcsid[] =
|
||||
|
||||
static ino_t startinum;
|
||||
|
||||
static int iblock __P((struct inodesc *, long ilevel, quad_t isize));
|
||||
static int iblock(struct inodesc *, long ilevel, quad_t isize);
|
||||
|
||||
int
|
||||
ckinode(dp, idesc)
|
||||
struct dinode *dp;
|
||||
struct inodesc *idesc;
|
||||
ckinode(struct dinode *dp, struct inodesc *idesc)
|
||||
{
|
||||
ufs_daddr_t *ap;
|
||||
int ret;
|
||||
@ -152,10 +150,7 @@ ckinode(dp, idesc)
|
||||
}
|
||||
|
||||
static int
|
||||
iblock(idesc, ilevel, isize)
|
||||
struct inodesc *idesc;
|
||||
long ilevel;
|
||||
quad_t isize;
|
||||
iblock(struct inodesc *idesc, long ilevel, quad_t isize)
|
||||
{
|
||||
ufs_daddr_t *ap;
|
||||
ufs_daddr_t *aplim;
|
||||
@ -242,9 +237,7 @@ iblock(idesc, ilevel, isize)
|
||||
* Return 0 if in range, 1 if out of range.
|
||||
*/
|
||||
int
|
||||
chkrange(blk, cnt)
|
||||
ufs_daddr_t blk;
|
||||
int cnt;
|
||||
chkrange(ufs_daddr_t blk, int cnt)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -288,8 +281,7 @@ chkrange(blk, cnt)
|
||||
* General purpose interface for reading inodes.
|
||||
*/
|
||||
struct dinode *
|
||||
ginode(inumber)
|
||||
ino_t inumber;
|
||||
ginode(ino_t inumber)
|
||||
{
|
||||
ufs_daddr_t iblk;
|
||||
|
||||
@ -315,8 +307,7 @@ static long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
|
||||
static struct dinode *inodebuf;
|
||||
|
||||
struct dinode *
|
||||
getnextinode(inumber)
|
||||
ino_t inumber;
|
||||
getnextinode(ino_t inumber)
|
||||
{
|
||||
long size;
|
||||
ufs_daddr_t dblk;
|
||||
@ -345,8 +336,7 @@ getnextinode(inumber)
|
||||
}
|
||||
|
||||
void
|
||||
setinodebuf(inum)
|
||||
ino_t inum;
|
||||
setinodebuf(ino_t inum)
|
||||
{
|
||||
|
||||
if (inum % sblock.fs_ipg != 0)
|
||||
@ -374,7 +364,7 @@ setinodebuf(inum)
|
||||
}
|
||||
|
||||
void
|
||||
freeinodebuf()
|
||||
freeinodebuf(void)
|
||||
{
|
||||
|
||||
if (inodebuf != NULL)
|
||||
@ -390,9 +380,7 @@ freeinodebuf()
|
||||
* Enter inodes into the cache.
|
||||
*/
|
||||
void
|
||||
cacheino(dp, inumber)
|
||||
struct dinode *dp;
|
||||
ino_t inumber;
|
||||
cacheino(struct dinode *dp, ino_t inumber)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
struct inoinfo **inpp;
|
||||
@ -428,8 +416,7 @@ cacheino(dp, inumber)
|
||||
* Look up an inode cache structure.
|
||||
*/
|
||||
struct inoinfo *
|
||||
getinoinfo(inumber)
|
||||
ino_t inumber;
|
||||
getinoinfo(ino_t inumber)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
|
||||
@ -446,7 +433,7 @@ getinoinfo(inumber)
|
||||
* Clean up all the inode cache structure.
|
||||
*/
|
||||
void
|
||||
inocleanup()
|
||||
inocleanup(void)
|
||||
{
|
||||
struct inoinfo **inpp;
|
||||
|
||||
@ -460,17 +447,14 @@ inocleanup()
|
||||
}
|
||||
|
||||
void
|
||||
inodirty()
|
||||
inodirty(void)
|
||||
{
|
||||
|
||||
dirty(pbp);
|
||||
}
|
||||
|
||||
void
|
||||
clri(idesc, type, flag)
|
||||
struct inodesc *idesc;
|
||||
char *type;
|
||||
int flag;
|
||||
clri(struct inodesc *idesc, char *type, int flag)
|
||||
{
|
||||
struct dinode *dp;
|
||||
|
||||
@ -503,8 +487,7 @@ clri(idesc, type, flag)
|
||||
}
|
||||
|
||||
int
|
||||
findname(idesc)
|
||||
struct inodesc *idesc;
|
||||
findname(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -517,8 +500,7 @@ findname(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
findino(idesc)
|
||||
struct inodesc *idesc;
|
||||
findino(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -533,8 +515,7 @@ findino(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
clearentry(idesc)
|
||||
struct inodesc *idesc;
|
||||
clearentry(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -547,8 +528,7 @@ clearentry(idesc)
|
||||
}
|
||||
|
||||
void
|
||||
pinode(ino)
|
||||
ino_t ino;
|
||||
pinode(ino_t ino)
|
||||
{
|
||||
struct dinode *dp;
|
||||
char *p;
|
||||
@ -574,10 +554,7 @@ pinode(ino)
|
||||
}
|
||||
|
||||
void
|
||||
blkerror(ino, type, blk)
|
||||
ino_t ino;
|
||||
char *type;
|
||||
ufs_daddr_t blk;
|
||||
blkerror(ino_t ino, char *type, ufs_daddr_t blk)
|
||||
{
|
||||
|
||||
pfatal("%ld %s I=%lu", (long)blk, type, (u_long)ino);
|
||||
@ -606,9 +583,7 @@ blkerror(ino, type, blk)
|
||||
* allocate an unused inode
|
||||
*/
|
||||
ino_t
|
||||
allocino(request, type)
|
||||
ino_t request;
|
||||
int type;
|
||||
allocino(ino_t request, int type)
|
||||
{
|
||||
ino_t ino;
|
||||
struct dinode *dp;
|
||||
@ -667,8 +642,7 @@ allocino(request, type)
|
||||
* deallocate an inode
|
||||
*/
|
||||
void
|
||||
freeino(ino)
|
||||
ino_t ino;
|
||||
freeino(ino_t ino)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
struct dinode *dp;
|
||||
|
@ -65,16 +65,13 @@ static const char rcsid[] =
|
||||
|
||||
#include "fsck.h"
|
||||
|
||||
static void usage __P((void));
|
||||
static int argtoi __P((int flag, char *req, char *str, int base));
|
||||
static int checkfilesys __P((char *filesys));
|
||||
static struct statfs *getmntpt __P((const char *));
|
||||
int main __P((int argc, char *argv[]));
|
||||
static void usage(void) __dead2;
|
||||
static int argtoi(int flag, char *req, char *str, int base);
|
||||
static int checkfilesys(char *filesys);
|
||||
static struct statfs *getmntpt(const char *);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
struct rlimit rlimit;
|
||||
@ -164,10 +161,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
argtoi(flag, req, str, base)
|
||||
int flag;
|
||||
char *req, *str;
|
||||
int base;
|
||||
argtoi(int flag, char *req, char *str, int base)
|
||||
{
|
||||
char *cp;
|
||||
int ret;
|
||||
@ -183,8 +177,7 @@ argtoi(flag, req, str, base)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
checkfilesys(filesys)
|
||||
char *filesys;
|
||||
checkfilesys(char *filesys)
|
||||
{
|
||||
ufs_daddr_t n_ffree, n_bfree;
|
||||
struct ufs_args args;
|
||||
@ -464,8 +457,7 @@ checkfilesys(filesys)
|
||||
* Get the mount point information for name.
|
||||
*/
|
||||
static struct statfs *
|
||||
getmntpt(name)
|
||||
const char *name;
|
||||
getmntpt(const char *name)
|
||||
{
|
||||
struct stat devstat, mntdevstat;
|
||||
char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
|
||||
@ -502,7 +494,7 @@ getmntpt(name)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
|
||||
|
@ -56,10 +56,10 @@ static ufs_daddr_t badblk;
|
||||
static ufs_daddr_t dupblk;
|
||||
static ino_t lastino; /* last inode in use */
|
||||
|
||||
static void checkinode __P((ino_t inumber, struct inodesc *));
|
||||
static void checkinode(ino_t inumber, struct inodesc *);
|
||||
|
||||
void
|
||||
pass1()
|
||||
pass1(void)
|
||||
{
|
||||
u_int8_t *cp;
|
||||
ino_t inumber;
|
||||
@ -178,9 +178,7 @@ pass1()
|
||||
}
|
||||
|
||||
static void
|
||||
checkinode(inumber, idesc)
|
||||
ino_t inumber;
|
||||
struct inodesc *idesc;
|
||||
checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct zlncnt *zlnp;
|
||||
@ -374,8 +372,7 @@ checkinode(inumber, idesc)
|
||||
}
|
||||
|
||||
int
|
||||
pass1check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass1check(struct inodesc *idesc)
|
||||
{
|
||||
int res = KEEPON;
|
||||
int anyout, nfrags;
|
||||
|
@ -49,10 +49,10 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
static struct dups *duphead;
|
||||
static int pass1bcheck __P((struct inodesc *));
|
||||
static int pass1bcheck(struct inodesc *);
|
||||
|
||||
void
|
||||
pass1b()
|
||||
pass1b(void)
|
||||
{
|
||||
int c, i;
|
||||
struct dinode *dp;
|
||||
@ -86,8 +86,7 @@ pass1b()
|
||||
}
|
||||
|
||||
static int
|
||||
pass1bcheck(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass1bcheck(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
int nfrags, res = KEEPON;
|
||||
|
@ -52,11 +52,11 @@ static const char rcsid[] =
|
||||
|
||||
#define MINDIRSIZE (sizeof (struct dirtemplate))
|
||||
|
||||
static int blksort __P((const void *, const void *));
|
||||
static int pass2check __P((struct inodesc *));
|
||||
static int blksort(const void *, const void *);
|
||||
static int pass2check(struct inodesc *);
|
||||
|
||||
void
|
||||
pass2()
|
||||
pass2(void)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct inoinfo **inpp, *inp;
|
||||
@ -220,8 +220,7 @@ pass2()
|
||||
}
|
||||
|
||||
static int
|
||||
pass2check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass2check(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct inoinfo *inp;
|
||||
@ -488,8 +487,7 @@ pass2check(idesc)
|
||||
* Routine to sort disk blocks.
|
||||
*/
|
||||
static int
|
||||
blksort(arg1, arg2)
|
||||
const void *arg1, *arg2;
|
||||
blksort(const void *arg1, const void *arg2)
|
||||
{
|
||||
|
||||
return ((*(struct inoinfo **)arg1)->i_blks[0] -
|
||||
|
@ -50,7 +50,7 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
void
|
||||
pass3()
|
||||
pass3(void)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
int loopcnt, inpindex, state;
|
||||
|
@ -50,7 +50,7 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
void
|
||||
pass4()
|
||||
pass4(void)
|
||||
{
|
||||
ino_t inumber;
|
||||
struct zlncnt *zlnp;
|
||||
@ -121,8 +121,7 @@ pass4()
|
||||
}
|
||||
|
||||
int
|
||||
pass4check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass4check(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
int nfrags, res = KEEPON;
|
||||
|
@ -50,11 +50,10 @@ static const char rcsid[] =
|
||||
|
||||
#include "fsck.h"
|
||||
|
||||
static void check_maps __P((u_char *, u_char *, int, int, char *, int *,
|
||||
int, int));
|
||||
static void check_maps(u_char *, u_char *, int, int, char *, int *, int, int);
|
||||
|
||||
void
|
||||
pass5()
|
||||
pass5(void)
|
||||
{
|
||||
int c, blk, frags, basesize, sumsize, mapsize, savednrpos = 0;
|
||||
int inomapsize, blkmapsize;
|
||||
@ -363,21 +362,21 @@ pass5()
|
||||
}
|
||||
|
||||
static void
|
||||
check_maps(map1, map2, mapsize, startvalue, name, opcode, skip, limit)
|
||||
u_char *map1; /* map of claimed allocations */
|
||||
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 */
|
||||
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 */
|
||||
check_maps(
|
||||
u_char *map1, /* map of claimed allocations */
|
||||
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 */
|
||||
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 */
|
||||
{
|
||||
# define BUFSIZE 16
|
||||
char buf[BUFSIZE];
|
||||
long i, j, k, l, m, n, size;
|
||||
int astart, aend, ustart, uend;
|
||||
void (*msg) __P((const char *fmt, ...));
|
||||
void (*msg)(const char *fmt, ...);
|
||||
|
||||
if (bkgrdflag)
|
||||
msg = pfatal;
|
||||
|
@ -69,17 +69,13 @@ struct disk {
|
||||
|
||||
int nrun, ndisks;
|
||||
|
||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||
static struct disk *finddisk __P((char *name));
|
||||
static int startdisk __P((struct disk *dk,
|
||||
int (*checkit)(char *, char *, long, int)));
|
||||
static void addpart(char *name, char *fsname, long auxdata);
|
||||
static struct disk *finddisk(char *name);
|
||||
static int startdisk(struct disk *dk,int (*checkit)(char *, char *, long, int));
|
||||
|
||||
int
|
||||
checkfstab(preen, maxrun, docheck, chkit)
|
||||
int preen;
|
||||
int maxrun;
|
||||
int (*docheck)(struct fstab *);
|
||||
int (*chkit)(char *, char *, long, int);
|
||||
checkfstab(int preen, int maxrun, int (*docheck)(struct fstab *),
|
||||
int (*chkit)(char *, char *, long, int))
|
||||
{
|
||||
struct fstab *fsp;
|
||||
struct disk *dk, *nextdisk;
|
||||
@ -202,8 +198,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
||||
}
|
||||
|
||||
static struct disk *
|
||||
finddisk(name)
|
||||
char *name;
|
||||
finddisk(char *name)
|
||||
{
|
||||
struct disk *dk, **dkp;
|
||||
char *p;
|
||||
@ -240,9 +235,7 @@ finddisk(name)
|
||||
}
|
||||
|
||||
static void
|
||||
addpart(name, fsname, auxdata)
|
||||
char *name, *fsname;
|
||||
long auxdata;
|
||||
addpart(char *name, char *fsname, long auxdata)
|
||||
{
|
||||
struct disk *dk = finddisk(name);
|
||||
struct part *pt, **ppt = &dk->part;
|
||||
@ -272,9 +265,7 @@ addpart(name, fsname, auxdata)
|
||||
}
|
||||
|
||||
static int
|
||||
startdisk(dk, checkit)
|
||||
struct disk *dk;
|
||||
int (*checkit)(char *, char *, long, int);
|
||||
startdisk(struct disk *dk, int (*checkit)(char *, char *, long, int))
|
||||
{
|
||||
struct part *pt = dk->part;
|
||||
|
||||
|
@ -60,9 +60,9 @@ struct bufarea asblk;
|
||||
#define altsblock (*asblk.b_un.b_fs)
|
||||
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
|
||||
|
||||
static void badsb __P((int listerr, char *s));
|
||||
static int calcsb __P((char *dev, int devfd, struct fs *fs));
|
||||
static struct disklabel *getdisklabel __P((char *s, int fd));
|
||||
static void badsb(int listerr, char *s);
|
||||
static int calcsb(char *dev, int devfd, struct fs *fs);
|
||||
static struct disklabel *getdisklabel(char *s, int fd);
|
||||
|
||||
/*
|
||||
* Read in a superblock finding an alternate if necessary.
|
||||
@ -70,8 +70,7 @@ static struct disklabel *getdisklabel __P((char *s, int fd));
|
||||
* is already clean (preen mode only).
|
||||
*/
|
||||
int
|
||||
setup(dev)
|
||||
char *dev;
|
||||
setup(char *dev)
|
||||
{
|
||||
long cg, asked, i, j;
|
||||
long bmapsize;
|
||||
@ -360,8 +359,7 @@ setup(dev)
|
||||
* Read in the super block and its summary info.
|
||||
*/
|
||||
int
|
||||
readsb(listerr)
|
||||
int listerr;
|
||||
readsb(int listerr)
|
||||
{
|
||||
ufs_daddr_t super = bflag ? bflag : SBOFF / dev_bsize;
|
||||
|
||||
@ -468,9 +466,7 @@ readsb(listerr)
|
||||
}
|
||||
|
||||
static void
|
||||
badsb(listerr, s)
|
||||
int listerr;
|
||||
char *s;
|
||||
badsb(int listerr, char *s)
|
||||
{
|
||||
|
||||
if (!listerr)
|
||||
@ -481,7 +477,7 @@ badsb(listerr, s)
|
||||
}
|
||||
|
||||
void
|
||||
sblock_init()
|
||||
sblock_init(void)
|
||||
{
|
||||
struct disklabel *lp;
|
||||
|
||||
@ -507,10 +503,7 @@ sblock_init()
|
||||
* their needed information is available!
|
||||
*/
|
||||
static int
|
||||
calcsb(dev, devfd, fs)
|
||||
char *dev;
|
||||
int devfd;
|
||||
struct fs *fs;
|
||||
calcsb(char *dev, int devfd, struct fs *fs)
|
||||
{
|
||||
struct disklabel *lp;
|
||||
struct partition *pp;
|
||||
@ -568,9 +561,7 @@ calcsb(dev, devfd, fs)
|
||||
}
|
||||
|
||||
static struct disklabel *
|
||||
getdisklabel(s, fd)
|
||||
char *s;
|
||||
int fd;
|
||||
getdisklabel(char *s, int fd)
|
||||
{
|
||||
static struct disklabel lab;
|
||||
|
||||
|
@ -61,8 +61,7 @@ static const char rcsid[] =
|
||||
|
||||
|
||||
char *
|
||||
blockcheck(origname)
|
||||
char *origname;
|
||||
blockcheck(char *origname)
|
||||
{
|
||||
struct stat stblock;
|
||||
char *newname, *cp;
|
||||
@ -114,8 +113,7 @@ blockcheck(origname)
|
||||
}
|
||||
|
||||
void
|
||||
infohandler(sig)
|
||||
int sig;
|
||||
infohandler(int sig)
|
||||
{
|
||||
got_siginfo = 1;
|
||||
}
|
||||
|
@ -63,20 +63,20 @@ struct odirtemplate odirhead = {
|
||||
0, DIRBLKSIZ - 12, 2, ".."
|
||||
};
|
||||
|
||||
static int chgino __P((struct inodesc *));
|
||||
static int dircheck __P((struct inodesc *, struct direct *));
|
||||
static int expanddir __P((struct dinode *dp, char *name));
|
||||
static void freedir __P((ino_t ino, ino_t parent));
|
||||
static struct direct *fsck_readdir __P((struct inodesc *));
|
||||
static struct bufarea *getdirblk __P((ufs_daddr_t blkno, long size));
|
||||
static int lftempname __P((char *bufp, ino_t ino));
|
||||
static int mkentry __P((struct inodesc *));
|
||||
static int chgino(struct inodesc *);
|
||||
static int dircheck(struct inodesc *, struct direct *);
|
||||
static int expanddir(struct dinode *dp, char *name);
|
||||
static void freedir(ino_t ino, ino_t parent);
|
||||
static struct direct *fsck_readdir(struct inodesc *);
|
||||
static struct bufarea *getdirblk(ufs_daddr_t blkno, long size);
|
||||
static int lftempname(char *bufp, ino_t ino);
|
||||
static int mkentry(struct inodesc *);
|
||||
|
||||
/*
|
||||
* Propagate connected state through the tree.
|
||||
*/
|
||||
void
|
||||
propagate()
|
||||
propagate(void)
|
||||
{
|
||||
struct inoinfo **inpp, *inp;
|
||||
struct inoinfo **inpend;
|
||||
@ -102,8 +102,7 @@ propagate()
|
||||
* Scan each entry in a directory block.
|
||||
*/
|
||||
int
|
||||
dirscan(idesc)
|
||||
struct inodesc *idesc;
|
||||
dirscan(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct bufarea *bp;
|
||||
@ -166,8 +165,7 @@ dirscan(idesc)
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
static struct direct *
|
||||
fsck_readdir(idesc)
|
||||
struct inodesc *idesc;
|
||||
fsck_readdir(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dp, *ndp;
|
||||
struct bufarea *bp;
|
||||
@ -228,9 +226,7 @@ fsck_readdir(idesc)
|
||||
* This is a superset of the checks made in the kernel.
|
||||
*/
|
||||
static int
|
||||
dircheck(idesc, dp)
|
||||
struct inodesc *idesc;
|
||||
struct direct *dp;
|
||||
dircheck(struct inodesc *idesc, struct direct *dp)
|
||||
{
|
||||
int size;
|
||||
char *cp;
|
||||
@ -277,18 +273,14 @@ dircheck(idesc, dp)
|
||||
}
|
||||
|
||||
void
|
||||
direrror(ino, errmesg)
|
||||
ino_t ino;
|
||||
char *errmesg;
|
||||
direrror(ino_t ino, char *errmesg)
|
||||
{
|
||||
|
||||
fileerror(ino, ino, errmesg);
|
||||
}
|
||||
|
||||
void
|
||||
fileerror(cwd, ino, errmesg)
|
||||
ino_t cwd, ino;
|
||||
char *errmesg;
|
||||
fileerror(ino_t cwd, ino_t ino, char *errmesg)
|
||||
{
|
||||
struct dinode *dp;
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
@ -310,9 +302,7 @@ fileerror(cwd, ino, errmesg)
|
||||
}
|
||||
|
||||
void
|
||||
adjust(idesc, lcnt)
|
||||
struct inodesc *idesc;
|
||||
int lcnt;
|
||||
adjust(struct inodesc *idesc, int lcnt)
|
||||
{
|
||||
struct dinode *dp;
|
||||
int saveresolved;
|
||||
@ -369,8 +359,7 @@ adjust(idesc, lcnt)
|
||||
}
|
||||
|
||||
static int
|
||||
mkentry(idesc)
|
||||
struct inodesc *idesc;
|
||||
mkentry(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct direct newent;
|
||||
@ -414,8 +403,7 @@ mkentry(idesc)
|
||||
}
|
||||
|
||||
static int
|
||||
chgino(idesc)
|
||||
struct inodesc *idesc;
|
||||
chgino(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -430,10 +418,7 @@ chgino(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
linkup(orphan, parentdir, name)
|
||||
ino_t orphan;
|
||||
ino_t parentdir;
|
||||
char *name;
|
||||
linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
{
|
||||
struct dinode *dp;
|
||||
int lostdir;
|
||||
@ -548,10 +533,7 @@ linkup(orphan, parentdir, name)
|
||||
* fix an entry in a directory.
|
||||
*/
|
||||
int
|
||||
changeino(dir, name, newnum)
|
||||
ino_t dir;
|
||||
char *name;
|
||||
ino_t newnum;
|
||||
changeino(ino_t dir, char *name, ino_t newnum)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
@ -569,9 +551,7 @@ changeino(dir, name, newnum)
|
||||
* make an entry in a directory
|
||||
*/
|
||||
int
|
||||
makeentry(parent, ino, name)
|
||||
ino_t parent, ino;
|
||||
char *name;
|
||||
makeentry(ino_t parent, ino_t ino, char *name)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct inodesc idesc;
|
||||
@ -605,9 +585,7 @@ makeentry(parent, ino, name)
|
||||
* Attempt to expand the size of a directory
|
||||
*/
|
||||
static int
|
||||
expanddir(dp, name)
|
||||
struct dinode *dp;
|
||||
char *name;
|
||||
expanddir(struct dinode *dp, char *name)
|
||||
{
|
||||
ufs_daddr_t lastbn, newblk;
|
||||
struct bufarea *bp;
|
||||
@ -662,9 +640,7 @@ expanddir(dp, name)
|
||||
* allocate a new directory
|
||||
*/
|
||||
ino_t
|
||||
allocdir(parent, request, mode)
|
||||
ino_t parent, request;
|
||||
int mode;
|
||||
allocdir(ino_t parent, ino_t request, int mode)
|
||||
{
|
||||
ino_t ino;
|
||||
char *cp;
|
||||
@ -723,8 +699,7 @@ allocdir(parent, request, mode)
|
||||
* free a directory inode
|
||||
*/
|
||||
static void
|
||||
freedir(ino, parent)
|
||||
ino_t ino, parent;
|
||||
freedir(ino_t ino, ino_t parent)
|
||||
{
|
||||
struct dinode *dp;
|
||||
|
||||
@ -740,9 +715,7 @@ freedir(ino, parent)
|
||||
* generate a temporary name for the lost+found directory.
|
||||
*/
|
||||
static int
|
||||
lftempname(bufp, ino)
|
||||
char *bufp;
|
||||
ino_t ino;
|
||||
lftempname(char *bufp, ino_t ino)
|
||||
{
|
||||
ino_t in;
|
||||
char *cp;
|
||||
@ -767,9 +740,7 @@ lftempname(bufp, ino)
|
||||
* Insure that it is held until another is requested.
|
||||
*/
|
||||
static struct bufarea *
|
||||
getdirblk(blkno, size)
|
||||
ufs_daddr_t blkno;
|
||||
long size;
|
||||
getdirblk(ufs_daddr_t blkno, long size)
|
||||
{
|
||||
|
||||
if (pdirbp != 0)
|
||||
|
@ -241,64 +241,64 @@ struct dinode zino;
|
||||
struct fstab;
|
||||
|
||||
|
||||
void adjust __P((struct inodesc *, int lcnt));
|
||||
ufs_daddr_t allocblk __P((long frags));
|
||||
ino_t allocdir __P((ino_t parent, ino_t request, int mode));
|
||||
ino_t allocino __P((ino_t request, int type));
|
||||
void blkerror __P((ino_t ino, char *type, ufs_daddr_t blk));
|
||||
char *blockcheck __P((char *name));
|
||||
int bread __P((int fd, char *buf, ufs_daddr_t blk, long size));
|
||||
void bufinit __P((void));
|
||||
void bwrite __P((int fd, char *buf, ufs_daddr_t blk, long size));
|
||||
void cacheino __P((struct dinode *dp, ino_t inumber));
|
||||
void catch __P((int));
|
||||
void catchquit __P((int));
|
||||
int changeino __P((ino_t dir, char *name, ino_t newnum));
|
||||
int chkrange __P((ufs_daddr_t blk, int cnt));
|
||||
void ckfini __P((int markclean));
|
||||
int ckinode __P((struct dinode *dp, struct inodesc *));
|
||||
void clri __P((struct inodesc *, char *type, int flag));
|
||||
int clearentry __P((struct inodesc *));
|
||||
void direrror __P((ino_t ino, char *errmesg));
|
||||
int dirscan __P((struct inodesc *));
|
||||
int dofix __P((struct inodesc *, char *msg));
|
||||
void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void ffs_fragacct __P((struct fs *, int, int32_t [], int));
|
||||
int ffs_isblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void ffs_setblock __P((struct fs *, u_char *, ufs_daddr_t));
|
||||
void fileerror __P((ino_t cwd, ino_t ino, char *errmesg));
|
||||
int findino __P((struct inodesc *));
|
||||
int findname __P((struct inodesc *));
|
||||
void flush __P((int fd, struct bufarea *bp));
|
||||
void freeblk __P((ufs_daddr_t blkno, long frags));
|
||||
void freeino __P((ino_t ino));
|
||||
void freeinodebuf __P((void));
|
||||
int ftypeok __P((struct dinode *dp));
|
||||
void getblk __P((struct bufarea *bp, ufs_daddr_t blk, long size));
|
||||
struct bufarea *getdatablk __P((ufs_daddr_t blkno, long size));
|
||||
struct inoinfo *getinoinfo __P((ino_t inumber));
|
||||
struct dinode *getnextinode __P((ino_t inumber));
|
||||
void getpathname __P((char *namebuf, ino_t curdir, ino_t ino));
|
||||
struct dinode *ginode __P((ino_t inumber));
|
||||
void inocleanup __P((void));
|
||||
void inodirty __P((void));
|
||||
struct inostat *inoinfo __P((ino_t inum));
|
||||
int linkup __P((ino_t orphan, ino_t parentdir, char *name));
|
||||
int makeentry __P((ino_t parent, ino_t ino, char *name));
|
||||
void panic __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void pass1 __P((void));
|
||||
void pass1b __P((void));
|
||||
int pass1check __P((struct inodesc *));
|
||||
void pass2 __P((void));
|
||||
void pass3 __P((void));
|
||||
void pass4 __P((void));
|
||||
int pass4check __P((struct inodesc *));
|
||||
void pass5 __P((void));
|
||||
void pfatal __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void pinode __P((ino_t ino));
|
||||
void propagate __P((void));
|
||||
void pwarn __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
int reply __P((char *question));
|
||||
void setinodebuf __P((ino_t));
|
||||
int setup __P((char *dev));
|
||||
void voidquit __P((int));
|
||||
void adjust(struct inodesc *, int lcnt);
|
||||
ufs_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, ufs_daddr_t blk);
|
||||
char *blockcheck(char *name);
|
||||
int bread(int fd, char *buf, ufs_daddr_t blk, long size);
|
||||
void bufinit(void);
|
||||
void bwrite(int fd, char *buf, ufs_daddr_t blk, long size);
|
||||
void cacheino(struct dinode *dp, ino_t inumber);
|
||||
void catch(int);
|
||||
void catchquit(int);
|
||||
int changeino(ino_t dir, char *name, ino_t newnum);
|
||||
int chkrange(ufs_daddr_t blk, int cnt);
|
||||
void ckfini(int markclean);
|
||||
int ckinode(struct dinode *dp, struct inodesc *);
|
||||
void clri(struct inodesc *, char *type, int flag);
|
||||
int clearentry(struct inodesc *);
|
||||
void direrror(ino_t ino, char *errmesg);
|
||||
int dirscan(struct inodesc *);
|
||||
int dofix(struct inodesc *, char *msg);
|
||||
void ffs_clrblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void ffs_fragacct(struct fs *, int, int32_t [], int);
|
||||
int ffs_isblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void ffs_setblock(struct fs *, u_char *, ufs_daddr_t);
|
||||
void fileerror(ino_t cwd, ino_t ino, char *errmesg);
|
||||
int findino(struct inodesc *);
|
||||
int findname(struct inodesc *);
|
||||
void flush(int fd, struct bufarea *bp);
|
||||
void freeblk(ufs_daddr_t blkno, long frags);
|
||||
void freeino(ino_t ino);
|
||||
void freeinodebuf(void);
|
||||
int ftypeok(struct dinode *dp);
|
||||
void getblk(struct bufarea *bp, ufs_daddr_t blk, long size);
|
||||
struct bufarea *getdatablk(ufs_daddr_t blkno, long size);
|
||||
struct inoinfo *getinoinfo(ino_t inumber);
|
||||
struct dinode *getnextinode(ino_t inumber);
|
||||
void getpathname(char *namebuf, ino_t curdir, ino_t ino);
|
||||
struct dinode *ginode(ino_t inumber);
|
||||
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);
|
||||
void panic(const char *fmt, ...) __printflike(1, 2);
|
||||
void pass1(void);
|
||||
void pass1b(void);
|
||||
int pass1check(struct inodesc *);
|
||||
void pass2(void);
|
||||
void pass3(void);
|
||||
void pass4(void);
|
||||
int pass4check(struct inodesc *);
|
||||
void pass5(void);
|
||||
void pfatal(const char *fmt, ...) __printflike(1, 2);
|
||||
void pinode(ino_t ino);
|
||||
void propagate(void);
|
||||
void pwarn(const char *fmt, ...) __printflike(1, 2);
|
||||
int reply(char *question);
|
||||
void setinodebuf(ino_t);
|
||||
int setup(char *dev);
|
||||
void voidquit(int);
|
||||
|
@ -60,11 +60,10 @@ static const char rcsid[] =
|
||||
|
||||
long diskreads, totalreads; /* Disk cache statistics */
|
||||
|
||||
static void rwerror __P((char *mesg, ufs_daddr_t blk));
|
||||
static void rwerror(char *mesg, ufs_daddr_t blk);
|
||||
|
||||
int
|
||||
ftypeok(dp)
|
||||
struct dinode *dp;
|
||||
ftypeok(struct dinode *dp)
|
||||
{
|
||||
switch (dp->di_mode & IFMT) {
|
||||
|
||||
@ -85,8 +84,7 @@ ftypeok(dp)
|
||||
}
|
||||
|
||||
int
|
||||
reply(question)
|
||||
char *question;
|
||||
reply(char *question)
|
||||
{
|
||||
int persevere;
|
||||
char c;
|
||||
@ -126,8 +124,7 @@ reply(question)
|
||||
* Look up state information for an inode.
|
||||
*/
|
||||
struct inostat *
|
||||
inoinfo(inum)
|
||||
ino_t inum;
|
||||
inoinfo(ino_t inum)
|
||||
{
|
||||
static struct inostat unallocated = { USTATE, 0, 0 };
|
||||
struct inostatlist *ilp;
|
||||
@ -146,7 +143,7 @@ inoinfo(inum)
|
||||
* Malloc buffers and set up cache.
|
||||
*/
|
||||
void
|
||||
bufinit()
|
||||
bufinit(void)
|
||||
{
|
||||
struct bufarea *bp;
|
||||
long bufcnt, i;
|
||||
@ -184,9 +181,7 @@ bufinit()
|
||||
* Manage a cache of directory blocks.
|
||||
*/
|
||||
struct bufarea *
|
||||
getdatablk(blkno, size)
|
||||
ufs_daddr_t blkno;
|
||||
long size;
|
||||
getdatablk(ufs_daddr_t blkno, long size)
|
||||
{
|
||||
struct bufarea *bp;
|
||||
|
||||
@ -213,10 +208,7 @@ getdatablk(blkno, size)
|
||||
}
|
||||
|
||||
void
|
||||
getblk(bp, blk, size)
|
||||
struct bufarea *bp;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
getblk(struct bufarea *bp, ufs_daddr_t blk, long size)
|
||||
{
|
||||
ufs_daddr_t dblk;
|
||||
|
||||
@ -231,9 +223,7 @@ getblk(bp, blk, size)
|
||||
}
|
||||
|
||||
void
|
||||
flush(fd, bp)
|
||||
int fd;
|
||||
struct bufarea *bp;
|
||||
flush(int fd, struct bufarea *bp)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -257,9 +247,7 @@ flush(fd, bp)
|
||||
}
|
||||
|
||||
static void
|
||||
rwerror(mesg, blk)
|
||||
char *mesg;
|
||||
ufs_daddr_t blk;
|
||||
rwerror(char *mesg, ufs_daddr_t blk)
|
||||
{
|
||||
|
||||
if (preen == 0)
|
||||
@ -270,8 +258,7 @@ rwerror(mesg, blk)
|
||||
}
|
||||
|
||||
void
|
||||
ckfini(markclean)
|
||||
int markclean;
|
||||
ckfini(int markclean)
|
||||
{
|
||||
struct bufarea *bp, *nbp;
|
||||
int ofsmodified, cnt = 0;
|
||||
@ -323,11 +310,7 @@ ckfini(markclean)
|
||||
}
|
||||
|
||||
int
|
||||
bread(fd, buf, blk, size)
|
||||
int fd;
|
||||
char *buf;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
bread(int fd, char *buf, ufs_daddr_t blk, long size)
|
||||
{
|
||||
char *cp;
|
||||
int i, errs;
|
||||
@ -364,11 +347,7 @@ bread(fd, buf, blk, size)
|
||||
}
|
||||
|
||||
void
|
||||
bwrite(fd, buf, blk, size)
|
||||
int fd;
|
||||
char *buf;
|
||||
ufs_daddr_t blk;
|
||||
long size;
|
||||
bwrite(int fd, char *buf, ufs_daddr_t blk, long size)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
@ -402,8 +381,7 @@ bwrite(fd, buf, blk, size)
|
||||
* allocate a data block with the specified number of fragments
|
||||
*/
|
||||
ufs_daddr_t
|
||||
allocblk(frags)
|
||||
long frags;
|
||||
allocblk(long frags)
|
||||
{
|
||||
int i, j, k, cg, baseblk;
|
||||
struct cg *cgp = &cgrp;
|
||||
@ -446,9 +424,7 @@ allocblk(frags)
|
||||
* Free a previously allocated block
|
||||
*/
|
||||
void
|
||||
freeblk(blkno, frags)
|
||||
ufs_daddr_t blkno;
|
||||
long frags;
|
||||
freeblk(ufs_daddr_t blkno, long frags)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
@ -461,9 +437,7 @@ freeblk(blkno, frags)
|
||||
* Find a pathname
|
||||
*/
|
||||
void
|
||||
getpathname(namebuf, curdir, ino)
|
||||
char *namebuf;
|
||||
ino_t curdir, ino;
|
||||
getpathname(char *namebuf, ino_t curdir, ino_t ino)
|
||||
{
|
||||
int len;
|
||||
char *cp;
|
||||
@ -518,8 +492,7 @@ getpathname(namebuf, curdir, ino)
|
||||
}
|
||||
|
||||
void
|
||||
catch(sig)
|
||||
int sig;
|
||||
catch(int sig)
|
||||
{
|
||||
if (!doinglevel2)
|
||||
ckfini(0);
|
||||
@ -532,8 +505,7 @@ catch(sig)
|
||||
* so that reboot sequence may be interrupted.
|
||||
*/
|
||||
void
|
||||
catchquit(sig)
|
||||
int sig;
|
||||
catchquit(int sig)
|
||||
{
|
||||
printf("returning to single-user after filesystem check\n");
|
||||
returntosingle = 1;
|
||||
@ -545,8 +517,7 @@ catchquit(sig)
|
||||
* Used by child processes in preen.
|
||||
*/
|
||||
void
|
||||
voidquit(sig)
|
||||
int sig;
|
||||
voidquit(int sig)
|
||||
{
|
||||
|
||||
sleep(1);
|
||||
@ -558,9 +529,7 @@ voidquit(sig)
|
||||
* determine whether an inode should be fixed.
|
||||
*/
|
||||
int
|
||||
dofix(idesc, msg)
|
||||
struct inodesc *idesc;
|
||||
char *msg;
|
||||
dofix(struct inodesc *idesc, char *msg)
|
||||
{
|
||||
|
||||
switch (idesc->id_fix) {
|
||||
@ -596,11 +565,7 @@ dofix(idesc, msg)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* An unexpected inconsistency occured.
|
||||
@ -608,20 +573,10 @@ dofix(idesc, msg)
|
||||
* otherwise just print message and continue.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
pfatal(const char *fmt, ...)
|
||||
#else
|
||||
pfatal(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (!preen) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
@ -646,20 +601,10 @@ pfatal(fmt, va_alist)
|
||||
* protocol, or a warning (preceded by filename) when preening.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
pwarn(const char *fmt, ...)
|
||||
#else
|
||||
pwarn(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (preen)
|
||||
(void)fprintf(stderr, "%s: ", cdevname);
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
@ -670,20 +615,10 @@ pwarn(fmt, va_alist)
|
||||
* Stub for routines from kernel.
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
panic(const char *fmt, ...)
|
||||
#else
|
||||
panic(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
pfatal("INTERNAL INCONSISTENCY:");
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
@ -54,12 +54,10 @@ static const char rcsid[] =
|
||||
|
||||
static ino_t startinum;
|
||||
|
||||
static int iblock __P((struct inodesc *, long ilevel, quad_t isize));
|
||||
static int iblock(struct inodesc *, long ilevel, quad_t isize);
|
||||
|
||||
int
|
||||
ckinode(dp, idesc)
|
||||
struct dinode *dp;
|
||||
struct inodesc *idesc;
|
||||
ckinode(struct dinode *dp, struct inodesc *idesc)
|
||||
{
|
||||
ufs_daddr_t *ap;
|
||||
int ret;
|
||||
@ -151,10 +149,7 @@ ckinode(dp, idesc)
|
||||
}
|
||||
|
||||
static int
|
||||
iblock(idesc, ilevel, isize)
|
||||
struct inodesc *idesc;
|
||||
long ilevel;
|
||||
quad_t isize;
|
||||
iblock(struct inodesc *idesc, long ilevel, quad_t isize)
|
||||
{
|
||||
ufs_daddr_t *ap;
|
||||
ufs_daddr_t *aplim;
|
||||
@ -239,9 +234,7 @@ iblock(idesc, ilevel, isize)
|
||||
* Return 0 if in range, 1 if out of range.
|
||||
*/
|
||||
int
|
||||
chkrange(blk, cnt)
|
||||
ufs_daddr_t blk;
|
||||
int cnt;
|
||||
chkrange(ufs_daddr_t blk, int cnt)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -285,8 +278,7 @@ chkrange(blk, cnt)
|
||||
* General purpose interface for reading inodes.
|
||||
*/
|
||||
struct dinode *
|
||||
ginode(inumber)
|
||||
ino_t inumber;
|
||||
ginode(ino_t inumber)
|
||||
{
|
||||
ufs_daddr_t iblk;
|
||||
|
||||
@ -312,8 +304,7 @@ long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
|
||||
struct dinode *inodebuf;
|
||||
|
||||
struct dinode *
|
||||
getnextinode(inumber)
|
||||
ino_t inumber;
|
||||
getnextinode(ino_t inumber)
|
||||
{
|
||||
long size;
|
||||
ufs_daddr_t dblk;
|
||||
@ -342,8 +333,7 @@ getnextinode(inumber)
|
||||
}
|
||||
|
||||
void
|
||||
setinodebuf(inum)
|
||||
ino_t inum;
|
||||
setinodebuf(ino_t inum)
|
||||
{
|
||||
|
||||
if (inum % sblock.fs_ipg != 0)
|
||||
@ -371,7 +361,7 @@ setinodebuf(inum)
|
||||
}
|
||||
|
||||
void
|
||||
freeinodebuf()
|
||||
freeinodebuf(void)
|
||||
{
|
||||
|
||||
if (inodebuf != NULL)
|
||||
@ -387,9 +377,7 @@ freeinodebuf()
|
||||
* Enter inodes into the cache.
|
||||
*/
|
||||
void
|
||||
cacheino(dp, inumber)
|
||||
struct dinode *dp;
|
||||
ino_t inumber;
|
||||
cacheino(struct dinode *dp, ino_t inumber)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
struct inoinfo **inpp;
|
||||
@ -425,8 +413,7 @@ cacheino(dp, inumber)
|
||||
* Look up an inode cache structure.
|
||||
*/
|
||||
struct inoinfo *
|
||||
getinoinfo(inumber)
|
||||
ino_t inumber;
|
||||
getinoinfo(ino_t inumber)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
|
||||
@ -443,7 +430,7 @@ getinoinfo(inumber)
|
||||
* Clean up all the inode cache structure.
|
||||
*/
|
||||
void
|
||||
inocleanup()
|
||||
inocleanup(void)
|
||||
{
|
||||
struct inoinfo **inpp;
|
||||
|
||||
@ -457,17 +444,14 @@ inocleanup()
|
||||
}
|
||||
|
||||
void
|
||||
inodirty()
|
||||
inodirty(void)
|
||||
{
|
||||
|
||||
dirty(pbp);
|
||||
}
|
||||
|
||||
void
|
||||
clri(idesc, type, flag)
|
||||
struct inodesc *idesc;
|
||||
char *type;
|
||||
int flag;
|
||||
clri(struct inodesc *idesc, char *type, int flag)
|
||||
{
|
||||
struct dinode *dp;
|
||||
|
||||
@ -489,8 +473,7 @@ clri(idesc, type, flag)
|
||||
}
|
||||
|
||||
int
|
||||
findname(idesc)
|
||||
struct inodesc *idesc;
|
||||
findname(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -503,8 +486,7 @@ findname(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
findino(idesc)
|
||||
struct inodesc *idesc;
|
||||
findino(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -519,8 +501,7 @@ findino(idesc)
|
||||
}
|
||||
|
||||
int
|
||||
clearentry(idesc)
|
||||
struct inodesc *idesc;
|
||||
clearentry(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
|
||||
@ -533,8 +514,7 @@ clearentry(idesc)
|
||||
}
|
||||
|
||||
void
|
||||
pinode(ino)
|
||||
ino_t ino;
|
||||
pinode(ino_t ino)
|
||||
{
|
||||
struct dinode *dp;
|
||||
char *p;
|
||||
@ -560,10 +540,7 @@ pinode(ino)
|
||||
}
|
||||
|
||||
void
|
||||
blkerror(ino, type, blk)
|
||||
ino_t ino;
|
||||
char *type;
|
||||
ufs_daddr_t blk;
|
||||
blkerror(ino_t ino, char *type, ufs_daddr_t blk)
|
||||
{
|
||||
|
||||
pfatal("%ld %s I=%lu", blk, type, ino);
|
||||
@ -592,9 +569,7 @@ blkerror(ino, type, blk)
|
||||
* allocate an unused inode
|
||||
*/
|
||||
ino_t
|
||||
allocino(request, type)
|
||||
ino_t request;
|
||||
int type;
|
||||
allocino(ino_t request, int type)
|
||||
{
|
||||
ino_t ino;
|
||||
struct dinode *dp;
|
||||
@ -653,8 +628,7 @@ allocino(request, type)
|
||||
* deallocate an inode
|
||||
*/
|
||||
void
|
||||
freeino(ino)
|
||||
ino_t ino;
|
||||
freeino(ino_t ino)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
struct dinode *dp;
|
||||
|
@ -64,18 +64,14 @@ static const char rcsid[] =
|
||||
|
||||
int returntosingle;
|
||||
|
||||
static void usage __P((void));
|
||||
static int argtoi __P((int flag, char *req, char *str, int base));
|
||||
static int docheck __P((struct fstab *fsp));
|
||||
static int checkfilesys __P((char *filesys, char *mntpt, long auxdata,
|
||||
int child));
|
||||
static struct statfs *getmntpt __P((const char *));
|
||||
int main __P((int argc, char *argv[]));
|
||||
static void usage(void) __dead2;
|
||||
static int argtoi(int flag, char *req, char *str, int base);
|
||||
static int docheck(struct fstab *fsp);
|
||||
static int checkfilesys(char *filesys, char *mntpt, long auxdata, int child);
|
||||
static struct statfs *getmntpt(const char *);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
struct rlimit rlimit;
|
||||
@ -162,10 +158,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
argtoi(flag, req, str, base)
|
||||
int flag;
|
||||
char *req, *str;
|
||||
int base;
|
||||
argtoi(int flag, char *req, char *str, int base)
|
||||
{
|
||||
char *cp;
|
||||
int ret;
|
||||
@ -181,10 +174,7 @@ argtoi(flag, req, str, base)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
checkfilesys(filesys, mntpt, auxdata, child)
|
||||
char *filesys, *mntpt;
|
||||
long auxdata;
|
||||
int child;
|
||||
checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
|
||||
{
|
||||
ufs_daddr_t n_ffree, n_bfree;
|
||||
struct dups *dp;
|
||||
@ -374,8 +364,7 @@ checkfilesys(filesys, mntpt, auxdata, child)
|
||||
* Get the directory that the device is mounted on.
|
||||
*/
|
||||
static struct statfs *
|
||||
getmntpt(name)
|
||||
const char *name;
|
||||
getmntpt(const char *name)
|
||||
{
|
||||
struct stat devstat, mntdevstat;
|
||||
char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
|
||||
@ -404,7 +393,7 @@ getmntpt(name)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
|
||||
|
@ -55,10 +55,10 @@ static ufs_daddr_t badblk;
|
||||
static ufs_daddr_t dupblk;
|
||||
static ino_t lastino; /* last inode in use */
|
||||
|
||||
static void checkinode __P((ino_t inumber, struct inodesc *));
|
||||
static void checkinode(ino_t inumber, struct inodesc *);
|
||||
|
||||
void
|
||||
pass1()
|
||||
pass1(void)
|
||||
{
|
||||
u_int8_t *cp;
|
||||
ino_t inumber;
|
||||
@ -167,9 +167,7 @@ pass1()
|
||||
}
|
||||
|
||||
static void
|
||||
checkinode(inumber, idesc)
|
||||
ino_t inumber;
|
||||
struct inodesc *idesc;
|
||||
checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct zlncnt *zlnp;
|
||||
@ -342,8 +340,7 @@ checkinode(inumber, idesc)
|
||||
}
|
||||
|
||||
int
|
||||
pass1check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass1check(struct inodesc *idesc)
|
||||
{
|
||||
int res = KEEPON;
|
||||
int anyout, nfrags;
|
||||
|
@ -49,10 +49,10 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
static struct dups *duphead;
|
||||
static int pass1bcheck __P((struct inodesc *));
|
||||
static int pass1bcheck(struct inodesc *);
|
||||
|
||||
void
|
||||
pass1b()
|
||||
pass1b(void)
|
||||
{
|
||||
int c, i;
|
||||
struct dinode *dp;
|
||||
@ -80,8 +80,7 @@ pass1b()
|
||||
}
|
||||
|
||||
static int
|
||||
pass1bcheck(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass1bcheck(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
int nfrags, res = KEEPON;
|
||||
|
@ -51,11 +51,11 @@ static const char rcsid[] =
|
||||
|
||||
#define MINDIRSIZE (sizeof (struct dirtemplate))
|
||||
|
||||
static int blksort __P((const void *, const void *));
|
||||
static int pass2check __P((struct inodesc *));
|
||||
static int blksort(const void *, const void *);
|
||||
static int pass2check(struct inodesc *);
|
||||
|
||||
void
|
||||
pass2()
|
||||
pass2(void)
|
||||
{
|
||||
struct dinode *dp;
|
||||
struct inoinfo **inpp, *inp;
|
||||
@ -213,8 +213,7 @@ pass2()
|
||||
}
|
||||
|
||||
static int
|
||||
pass2check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass2check(struct inodesc *idesc)
|
||||
{
|
||||
struct direct *dirp = idesc->id_dirp;
|
||||
struct inoinfo *inp;
|
||||
@ -477,8 +476,7 @@ pass2check(idesc)
|
||||
* Routine to sort disk blocks.
|
||||
*/
|
||||
static int
|
||||
blksort(arg1, arg2)
|
||||
const void *arg1, *arg2;
|
||||
blksort(const void *arg1, const void *arg2)
|
||||
{
|
||||
|
||||
return ((*(struct inoinfo **)arg1)->i_blks[0] -
|
||||
|
@ -50,7 +50,7 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
void
|
||||
pass3()
|
||||
pass3(void)
|
||||
{
|
||||
struct inoinfo *inp;
|
||||
int loopcnt, inpindex, state;
|
||||
|
@ -50,7 +50,7 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
void
|
||||
pass4()
|
||||
pass4(void)
|
||||
{
|
||||
ino_t inumber;
|
||||
struct zlncnt *zlnp;
|
||||
@ -118,8 +118,7 @@ pass4()
|
||||
}
|
||||
|
||||
int
|
||||
pass4check(idesc)
|
||||
struct inodesc *idesc;
|
||||
pass4check(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
int nfrags, res = KEEPON;
|
||||
|
@ -50,7 +50,7 @@ static const char rcsid[] =
|
||||
#include "fsck.h"
|
||||
|
||||
void
|
||||
pass5()
|
||||
pass5(void)
|
||||
{
|
||||
int c, blk, frags, basesize, sumsize, mapsize, savednrpos = 0;
|
||||
int inomapsize, blkmapsize, astart, aend, ustart, uend;
|
||||
|
@ -68,17 +68,13 @@ struct disk {
|
||||
|
||||
int nrun, ndisks;
|
||||
|
||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||
static struct disk *finddisk __P((char *name));
|
||||
static int startdisk __P((struct disk *dk,
|
||||
int (*checkit)(char *, char *, long, int)));
|
||||
static void addpart(char *name, char *fsname, long auxdata);
|
||||
static struct disk *finddisk(char *name);
|
||||
static int startdisk(struct disk *dk, int (*checkit)(char *, char *, long, int));
|
||||
|
||||
int
|
||||
checkfstab(preen, maxrun, docheck, chkit)
|
||||
int preen;
|
||||
int maxrun;
|
||||
int (*docheck)(struct fstab *);
|
||||
int (*chkit)(char *, char *, long, int);
|
||||
checkfstab(int preen, int maxrun, int (*docheck)(struct fstab *),
|
||||
int (*chkit)(char *, char *, long, int))
|
||||
{
|
||||
struct fstab *fsp;
|
||||
struct disk *dk, *nextdisk;
|
||||
@ -201,8 +197,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
||||
}
|
||||
|
||||
static struct disk *
|
||||
finddisk(name)
|
||||
char *name;
|
||||
finddisk(char *name)
|
||||
{
|
||||
struct disk *dk, **dkp;
|
||||
char *p;
|
||||
@ -239,9 +234,7 @@ finddisk(name)
|
||||
}
|
||||
|
||||
static void
|
||||
addpart(name, fsname, auxdata)
|
||||
char *name, *fsname;
|
||||
long auxdata;
|
||||
addpart(char *name, char *fsname, long auxdata)
|
||||
{
|
||||
struct disk *dk = finddisk(name);
|
||||
struct part *pt, **ppt = &dk->part;
|
||||
@ -271,9 +264,7 @@ addpart(name, fsname, auxdata)
|
||||
}
|
||||
|
||||
static int
|
||||
startdisk(dk, checkit)
|
||||
struct disk *dk;
|
||||
int (*checkit)(char *, char *, long, int);
|
||||
startdisk(struct disk *dk, int (*checkit)(char *, char *, long, int))
|
||||
{
|
||||
struct part *pt = dk->part;
|
||||
|
||||
|
@ -59,10 +59,10 @@ struct bufarea asblk;
|
||||
#define altsblock (*asblk.b_un.b_fs)
|
||||
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
|
||||
|
||||
static void badsb __P((int listerr, char *s));
|
||||
static int calcsb __P((char *dev, int devfd, struct fs *fs));
|
||||
static struct disklabel *getdisklabel __P((char *s, int fd));
|
||||
static int readsb __P((int listerr));
|
||||
static void badsb(int listerr, char *s);
|
||||
static int calcsb(char *dev, int devfd, struct fs *fs);
|
||||
static struct disklabel *getdisklabel(char *s, int fd);
|
||||
static int readsb(int listerr);
|
||||
|
||||
/*
|
||||
* Read in a superblock finding an alternate if necessary.
|
||||
@ -70,8 +70,7 @@ static int readsb __P((int listerr));
|
||||
* is already clean (preen mode only).
|
||||
*/
|
||||
int
|
||||
setup(dev)
|
||||
char *dev;
|
||||
setup(char *dev)
|
||||
{
|
||||
long cg, size, asked, i, j;
|
||||
long skipclean, bmapsize;
|
||||
@ -325,8 +324,7 @@ setup(dev)
|
||||
* Read in the super block and its summary info.
|
||||
*/
|
||||
static int
|
||||
readsb(listerr)
|
||||
int listerr;
|
||||
readsb(int listerr)
|
||||
{
|
||||
ufs_daddr_t super = bflag ? bflag : SBOFF / dev_bsize;
|
||||
|
||||
@ -427,9 +425,7 @@ readsb(listerr)
|
||||
}
|
||||
|
||||
static void
|
||||
badsb(listerr, s)
|
||||
int listerr;
|
||||
char *s;
|
||||
badsb(int listerr, char *s)
|
||||
{
|
||||
|
||||
if (!listerr)
|
||||
@ -446,10 +442,7 @@ badsb(listerr, s)
|
||||
* their needed information is available!
|
||||
*/
|
||||
static int
|
||||
calcsb(dev, devfd, fs)
|
||||
char *dev;
|
||||
int devfd;
|
||||
struct fs *fs;
|
||||
calcsb(char *dev, int devfd, struct fs *fs)
|
||||
{
|
||||
struct disklabel *lp;
|
||||
struct partition *pp;
|
||||
@ -507,9 +500,7 @@ calcsb(dev, devfd, fs)
|
||||
}
|
||||
|
||||
static struct disklabel *
|
||||
getdisklabel(s, fd)
|
||||
char *s;
|
||||
int fd;
|
||||
getdisklabel(char *s, int fd)
|
||||
{
|
||||
static struct disklabel lab;
|
||||
|
||||
|
@ -60,8 +60,7 @@ static const char rcsid[] =
|
||||
|
||||
|
||||
char *
|
||||
blockcheck(origname)
|
||||
char *origname;
|
||||
blockcheck(char *origname)
|
||||
{
|
||||
struct stat stslash, stblock, stchar;
|
||||
char *newname, *raw;
|
||||
|
@ -93,20 +93,20 @@ static const char rcsid[] =
|
||||
|
||||
|
||||
/* dir.c */
|
||||
static struct dosDirEntry *newDosDirEntry __P((void));
|
||||
static void freeDosDirEntry __P((struct dosDirEntry *));
|
||||
static struct dirTodoNode *newDirTodo __P((void));
|
||||
static void freeDirTodo __P((struct dirTodoNode *));
|
||||
static char *fullpath __P((struct dosDirEntry *));
|
||||
static u_char calcShortSum __P((u_char *));
|
||||
static int delete __P((int, struct bootblock *, struct fatEntry *, cl_t, int,
|
||||
cl_t, int, int));
|
||||
static int removede __P((int, struct bootblock *, struct fatEntry *, u_char *,
|
||||
u_char *, cl_t, cl_t, cl_t, char *, int));
|
||||
static int checksize __P((struct bootblock *, struct fatEntry *, u_char *,
|
||||
struct dosDirEntry *));
|
||||
static int readDosDirSection __P((int, struct bootblock *, struct fatEntry *,
|
||||
struct dosDirEntry *));
|
||||
static struct dosDirEntry *newDosDirEntry(void);
|
||||
static void freeDosDirEntry(struct dosDirEntry *);
|
||||
static struct dirTodoNode *newDirTodo(void);
|
||||
static void freeDirTodo(struct dirTodoNode *);
|
||||
static char *fullpath(struct dosDirEntry *);
|
||||
static u_char calcShortSum(u_char *);
|
||||
static int delete(int, struct bootblock *, struct fatEntry *, cl_t, int,
|
||||
cl_t, int, int);
|
||||
static int removede(int, struct bootblock *, struct fatEntry *, u_char *,
|
||||
u_char *, cl_t, cl_t, cl_t, char *, int);
|
||||
static int checksize(struct bootblock *, struct fatEntry *, u_char *,
|
||||
struct dosDirEntry *);
|
||||
static int readDosDirSection(int, struct bootblock *, struct fatEntry *,
|
||||
struct dosDirEntry *);
|
||||
|
||||
/*
|
||||
* Manage free dosDirEntry structures.
|
||||
@ -114,7 +114,7 @@ static int readDosDirSection __P((int, struct bootblock *, struct fatEntry *,
|
||||
static struct dosDirEntry *freede;
|
||||
|
||||
static struct dosDirEntry *
|
||||
newDosDirEntry()
|
||||
newDosDirEntry(void)
|
||||
{
|
||||
struct dosDirEntry *de;
|
||||
|
||||
@ -127,8 +127,7 @@ newDosDirEntry()
|
||||
}
|
||||
|
||||
static void
|
||||
freeDosDirEntry(de)
|
||||
struct dosDirEntry *de;
|
||||
freeDosDirEntry(struct dosDirEntry *de)
|
||||
{
|
||||
de->next = freede;
|
||||
freede = de;
|
||||
@ -140,7 +139,7 @@ freeDosDirEntry(de)
|
||||
static struct dirTodoNode *freedt;
|
||||
|
||||
static struct dirTodoNode *
|
||||
newDirTodo()
|
||||
newDirTodo(void)
|
||||
{
|
||||
struct dirTodoNode *dt;
|
||||
|
||||
@ -153,8 +152,7 @@ newDirTodo()
|
||||
}
|
||||
|
||||
static void
|
||||
freeDirTodo(dt)
|
||||
struct dirTodoNode *dt;
|
||||
freeDirTodo(struct dirTodoNode *dt)
|
||||
{
|
||||
dt->next = freedt;
|
||||
freedt = dt;
|
||||
@ -169,8 +167,7 @@ struct dirTodoNode *pendingDirectories = NULL;
|
||||
* Return the full pathname for a directory entry.
|
||||
*/
|
||||
static char *
|
||||
fullpath(dir)
|
||||
struct dosDirEntry *dir;
|
||||
fullpath(struct dosDirEntry *dir)
|
||||
{
|
||||
static char namebuf[MAXPATHLEN + 1];
|
||||
char *cp, *np;
|
||||
@ -197,8 +194,7 @@ fullpath(dir)
|
||||
* Calculate a checksum over an 8.3 alias name
|
||||
*/
|
||||
static u_char
|
||||
calcShortSum(p)
|
||||
u_char *p;
|
||||
calcShortSum(u_char *p)
|
||||
{
|
||||
u_char sum = 0;
|
||||
int i;
|
||||
@ -225,9 +221,7 @@ static struct dosDirEntry *lostDir;
|
||||
* Init internal state for a new directory scan.
|
||||
*/
|
||||
int
|
||||
resetDosDirSection(boot, fat)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
|
||||
{
|
||||
int b1, b2;
|
||||
cl_t cl;
|
||||
@ -280,7 +274,7 @@ resetDosDirSection(boot, fat)
|
||||
* Cleanup after a directory scan
|
||||
*/
|
||||
void
|
||||
finishDosDirSection()
|
||||
finishDosDirSection(void)
|
||||
{
|
||||
struct dirTodoNode *p, *np;
|
||||
struct dosDirEntry *d, *nd;
|
||||
@ -310,15 +304,8 @@ finishDosDirSection()
|
||||
* Delete directory entries between startcl, startoff and endcl, endoff.
|
||||
*/
|
||||
static int
|
||||
delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast)
|
||||
int f;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
cl_t startcl;
|
||||
int startoff;
|
||||
cl_t endcl;
|
||||
int endoff;
|
||||
int notlast;
|
||||
delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
|
||||
int startoff, cl_t endcl, int endoff, int notlast)
|
||||
{
|
||||
u_char *s, *e;
|
||||
off_t off;
|
||||
@ -357,17 +344,8 @@ delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast)
|
||||
}
|
||||
|
||||
static int
|
||||
removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type)
|
||||
int f;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
u_char *start;
|
||||
u_char *end;
|
||||
cl_t startcl;
|
||||
cl_t endcl;
|
||||
cl_t curcl;
|
||||
char *path;
|
||||
int type;
|
||||
removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start,
|
||||
u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type)
|
||||
{
|
||||
switch (type) {
|
||||
case 0:
|
||||
@ -401,11 +379,8 @@ removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type)
|
||||
* Check an in-memory file entry
|
||||
*/
|
||||
static int
|
||||
checksize(boot, fat, p, dir)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
u_char *p;
|
||||
struct dosDirEntry *dir;
|
||||
checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p,
|
||||
struct dosDirEntry *dir)
|
||||
{
|
||||
/*
|
||||
* Check size on ordinary files
|
||||
@ -456,11 +431,8 @@ checksize(boot, fat, p, dir)
|
||||
* - push directories onto the todo-stack
|
||||
*/
|
||||
static int
|
||||
readDosDirSection(f, boot, fat, dir)
|
||||
int f;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
struct dosDirEntry *dir;
|
||||
readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
|
||||
struct dosDirEntry *dir)
|
||||
{
|
||||
struct dosDirEntry dirent, *d;
|
||||
u_char *p, *vallfn, *invlfn, *empty;
|
||||
@ -879,10 +851,7 @@ readDosDirSection(f, boot, fat, dir)
|
||||
}
|
||||
|
||||
int
|
||||
handleDirTree(dosfs, boot, fat)
|
||||
int dosfs;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat)
|
||||
{
|
||||
int mod;
|
||||
|
||||
@ -923,11 +892,7 @@ static cl_t lfcl;
|
||||
static off_t lfoff;
|
||||
|
||||
int
|
||||
reconnect(dosfs, boot, fat, head)
|
||||
int dosfs;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
cl_t head;
|
||||
reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||
{
|
||||
struct dosDirEntry d;
|
||||
u_char *p;
|
||||
@ -1009,7 +974,7 @@ reconnect(dosfs, boot, fat, head)
|
||||
}
|
||||
|
||||
void
|
||||
finishlf()
|
||||
finishlf(void)
|
||||
{
|
||||
if (lfbuf)
|
||||
free(lfbuf);
|
||||
|
@ -56,12 +56,12 @@ extern struct dosDirEntry *rootDir;
|
||||
/*
|
||||
* function declarations
|
||||
*/
|
||||
int ask __P((int, const char *, ...)) __attribute__((__format__(__printf__,2,3)));
|
||||
int ask(int, const char *, ...) __attribute__((__format__(__printf__,2,3)));
|
||||
|
||||
/*
|
||||
* Check filesystem given as arg
|
||||
*/
|
||||
int checkfilesys __P((const char *));
|
||||
int checkfilesys(const char *);
|
||||
|
||||
/*
|
||||
* Return values of various functions
|
||||
@ -79,41 +79,41 @@ int checkfilesys __P((const char *));
|
||||
* read a boot block in a machine independend fashion and translate
|
||||
* it into our struct bootblock.
|
||||
*/
|
||||
int readboot __P((int, struct bootblock *));
|
||||
int readboot(int, struct bootblock *);
|
||||
|
||||
/*
|
||||
* Correct the FSInfo block.
|
||||
*/
|
||||
int writefsinfo __P((int, struct bootblock *));
|
||||
int writefsinfo(int, struct bootblock *);
|
||||
|
||||
/*
|
||||
* Read one of the FAT copies and return a pointer to the new
|
||||
* allocated array holding our description of it.
|
||||
*/
|
||||
int readfat __P((int, struct bootblock *, int, struct fatEntry **));
|
||||
int readfat(int, struct bootblock *, int, struct fatEntry **);
|
||||
|
||||
/*
|
||||
* Check two FAT copies for consistency and merge changes into the
|
||||
* first if neccessary.
|
||||
*/
|
||||
int comparefat __P((struct bootblock *, struct fatEntry *, struct fatEntry *, int));
|
||||
int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, int);
|
||||
|
||||
/*
|
||||
* Check a FAT
|
||||
*/
|
||||
int checkfat __P((struct bootblock *, struct fatEntry *));
|
||||
int checkfat(struct bootblock *, struct fatEntry *);
|
||||
|
||||
/*
|
||||
* Write back FAT entries
|
||||
*/
|
||||
int writefat __P((int, struct bootblock *, struct fatEntry *, int));
|
||||
int writefat(int, struct bootblock *, struct fatEntry *, int);
|
||||
|
||||
/*
|
||||
* Read a directory
|
||||
*/
|
||||
int resetDosDirSection __P((struct bootblock *, struct fatEntry *));
|
||||
void finishDosDirSection __P((void));
|
||||
int handleDirTree __P((int, struct bootblock *, struct fatEntry *));
|
||||
int resetDosDirSection(struct bootblock *, struct fatEntry *);
|
||||
void finishDosDirSection(void);
|
||||
int handleDirTree(int, struct bootblock *, struct fatEntry *);
|
||||
|
||||
/*
|
||||
* Cross-check routines run after everything is completely in memory
|
||||
@ -121,12 +121,12 @@ int handleDirTree __P((int, struct bootblock *, struct fatEntry *));
|
||||
/*
|
||||
* Check for lost cluster chains
|
||||
*/
|
||||
int checklost __P((int, struct bootblock *, struct fatEntry *));
|
||||
int checklost(int, struct bootblock *, struct fatEntry *);
|
||||
/*
|
||||
* Try to reconnect a lost cluster chain
|
||||
*/
|
||||
int reconnect __P((int, struct bootblock *, struct fatEntry *, cl_t));
|
||||
void finishlf __P((void));
|
||||
int reconnect(int, struct bootblock *, struct fatEntry *, cl_t);
|
||||
void finishlf(void);
|
||||
|
||||
/*
|
||||
* Small helper functions
|
||||
@ -134,11 +134,11 @@ void finishlf __P((void));
|
||||
/*
|
||||
* Return the type of a reserved cluster as text
|
||||
*/
|
||||
char *rsrvdcltype __P((cl_t));
|
||||
char *rsrvdcltype(cl_t);
|
||||
|
||||
/*
|
||||
* Clear a cluster chain in a FAT
|
||||
*/
|
||||
void clearchain __P((struct bootblock *, struct fatEntry *, cl_t));
|
||||
void clearchain(struct bootblock *, struct fatEntry *, cl_t);
|
||||
|
||||
#endif
|
||||
|
@ -47,20 +47,16 @@ static const char rcsid[] =
|
||||
#include "ext.h"
|
||||
#include "fsutil.h"
|
||||
|
||||
static int checkclnum __P((struct bootblock *, int, cl_t, cl_t *));
|
||||
static int clustdiffer __P((cl_t, cl_t *, cl_t *, int));
|
||||
static int tryclear __P((struct bootblock *, struct fatEntry *, cl_t, cl_t *));
|
||||
static int _readfat __P((int, struct bootblock *, int, u_char **));
|
||||
static int checkclnum(struct bootblock *, int, cl_t, cl_t *);
|
||||
static int clustdiffer(cl_t, cl_t *, cl_t *, int);
|
||||
static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *);
|
||||
static int _readfat(int, struct bootblock *, int, u_char **);
|
||||
|
||||
/*
|
||||
* Check a cluster number for valid value
|
||||
*/
|
||||
static int
|
||||
checkclnum(boot, fat, cl, next)
|
||||
struct bootblock *boot;
|
||||
int fat;
|
||||
cl_t cl;
|
||||
cl_t *next;
|
||||
checkclnum(struct bootblock *boot, int fat, cl_t cl, cl_t *next)
|
||||
{
|
||||
if (*next >= (CLUST_RSRVD&boot->ClustMask))
|
||||
*next |= ~boot->ClustMask;
|
||||
@ -91,11 +87,7 @@ checkclnum(boot, fat, cl, next)
|
||||
* Read a FAT from disk. Returns 1 if successful, 0 otherwise.
|
||||
*/
|
||||
static int
|
||||
_readfat(fs, boot, no, buffer)
|
||||
int fs;
|
||||
struct bootblock *boot;
|
||||
int no;
|
||||
u_char **buffer;
|
||||
_readfat(int fs, struct bootblock *boot, int no, u_char **buffer)
|
||||
{
|
||||
off_t off;
|
||||
|
||||
@ -130,11 +122,7 @@ _readfat(fs, boot, no, buffer)
|
||||
* Read a FAT and decode it into internal format
|
||||
*/
|
||||
int
|
||||
readfat(fs, boot, no, fp)
|
||||
int fs;
|
||||
struct bootblock *boot;
|
||||
int no;
|
||||
struct fatEntry **fp;
|
||||
readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp)
|
||||
{
|
||||
struct fatEntry *fat;
|
||||
u_char *buffer, *p;
|
||||
@ -252,8 +240,7 @@ readfat(fs, boot, no, fp)
|
||||
* Get type of reserved cluster
|
||||
*/
|
||||
char *
|
||||
rsrvdcltype(cl)
|
||||
cl_t cl;
|
||||
rsrvdcltype(cl_t cl)
|
||||
{
|
||||
if (cl == CLUST_FREE)
|
||||
return "free";
|
||||
@ -265,11 +252,7 @@ rsrvdcltype(cl)
|
||||
}
|
||||
|
||||
static int
|
||||
clustdiffer(cl, cp1, cp2, fatnum)
|
||||
cl_t cl;
|
||||
cl_t *cp1;
|
||||
cl_t *cp2;
|
||||
int fatnum;
|
||||
clustdiffer(cl_t cl, cl_t *cp1, cl_t *cp2, int fatnum)
|
||||
{
|
||||
if (*cp1 == CLUST_FREE || *cp1 >= CLUST_RSRVD) {
|
||||
if (*cp2 == CLUST_FREE || *cp2 >= CLUST_RSRVD) {
|
||||
@ -339,11 +322,8 @@ clustdiffer(cl, cp1, cp2, fatnum)
|
||||
* into the first one.
|
||||
*/
|
||||
int
|
||||
comparefat(boot, first, second, fatnum)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *first;
|
||||
struct fatEntry *second;
|
||||
int fatnum;
|
||||
comparefat(struct bootblock *boot, struct fatEntry *first,
|
||||
struct fatEntry *second, int fatnum)
|
||||
{
|
||||
cl_t cl;
|
||||
int ret = FSOK;
|
||||
@ -355,10 +335,7 @@ comparefat(boot, first, second, fatnum)
|
||||
}
|
||||
|
||||
void
|
||||
clearchain(boot, fat, head)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
cl_t head;
|
||||
clearchain(struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||
{
|
||||
cl_t p, q;
|
||||
|
||||
@ -372,11 +349,7 @@ clearchain(boot, fat, head)
|
||||
}
|
||||
|
||||
int
|
||||
tryclear(boot, fat, head, trunc)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
cl_t head;
|
||||
cl_t *trunc;
|
||||
tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *trunc)
|
||||
{
|
||||
if (ask(0, "Clear chain starting at %u", head)) {
|
||||
clearchain(boot, fat, head);
|
||||
@ -392,9 +365,7 @@ tryclear(boot, fat, head, trunc)
|
||||
* Check a complete FAT in-memory for crosslinks
|
||||
*/
|
||||
int
|
||||
checkfat(boot, fat)
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
checkfat(struct bootblock *boot, struct fatEntry *fat)
|
||||
{
|
||||
cl_t head, p, h, n;
|
||||
u_int len;
|
||||
@ -488,11 +459,7 @@ checkfat(boot, fat)
|
||||
* Write out FATs encoding them from the internal format
|
||||
*/
|
||||
int
|
||||
writefat(fs, boot, fat, correct_fat)
|
||||
int fs;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
int correct_fat;
|
||||
writefat(int fs, struct bootblock *boot, struct fatEntry *fat, int correct_fat)
|
||||
{
|
||||
u_char *buffer, *p;
|
||||
cl_t cl;
|
||||
@ -600,10 +567,7 @@ writefat(fs, boot, fat, correct_fat)
|
||||
* Check a complete in-memory FAT for lost cluster chains
|
||||
*/
|
||||
int
|
||||
checklost(dosfs, boot, fat)
|
||||
int dosfs;
|
||||
struct bootblock *boot;
|
||||
struct fatEntry *fat;
|
||||
checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
|
||||
{
|
||||
cl_t head;
|
||||
int mod = FSOK;
|
||||
|
@ -44,11 +44,7 @@ static const char rcsid[] =
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "fsutil.h"
|
||||
#include "ext.h"
|
||||
@ -58,8 +54,7 @@ int alwaysyes; /* assume "yes" for all questions */
|
||||
int preen; /* set when preening */
|
||||
int rdonly; /* device is opened read only (supersedes above) */
|
||||
|
||||
static void usage __P((void));
|
||||
int main __P((int, char **));
|
||||
static void usage(void) __dead2;
|
||||
|
||||
static void
|
||||
usage()
|
||||
@ -68,9 +63,7 @@ usage()
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ret = 0, erg;
|
||||
int ch;
|
||||
@ -125,14 +118,7 @@ main(argc, argv)
|
||||
|
||||
/*VARARGS*/
|
||||
int
|
||||
#if __STDC__
|
||||
ask(int def, const char *fmt, ...)
|
||||
#else
|
||||
ask(def, fmt, va_alist)
|
||||
int def;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -147,11 +133,7 @@ ask(def, fmt, va_alist)
|
||||
return def;
|
||||
}
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
vsnprintf(prompt, sizeof(prompt), fmt, ap);
|
||||
if (alwaysyes || rdonly) {
|
||||
printf("%s? %s\n", prompt, rdonly ? "no" : "yes");
|
||||
|
@ -69,17 +69,13 @@ struct disk {
|
||||
|
||||
int nrun, ndisks;
|
||||
|
||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||
static struct disk *finddisk __P((char *name));
|
||||
static int startdisk __P((struct disk *dk,
|
||||
int (*checkit)(char *, char *, long, int)));
|
||||
static void addpart(char *name, char *fsname, long auxdata);
|
||||
static struct disk *finddisk(char *name);
|
||||
static int startdisk(struct disk *dk,int (*checkit)(char *, char *, long, int));
|
||||
|
||||
int
|
||||
checkfstab(preen, maxrun, docheck, chkit)
|
||||
int preen;
|
||||
int maxrun;
|
||||
int (*docheck)(struct fstab *);
|
||||
int (*chkit)(char *, char *, long, int);
|
||||
checkfstab(int preen, int maxrun, int (*docheck)(struct fstab *),
|
||||
int (*chkit)(char *, char *, long, int))
|
||||
{
|
||||
struct fstab *fsp;
|
||||
struct disk *dk, *nextdisk;
|
||||
@ -202,8 +198,7 @@ checkfstab(preen, maxrun, docheck, chkit)
|
||||
}
|
||||
|
||||
static struct disk *
|
||||
finddisk(name)
|
||||
char *name;
|
||||
finddisk(char *name)
|
||||
{
|
||||
struct disk *dk, **dkp;
|
||||
char *p;
|
||||
@ -240,9 +235,7 @@ finddisk(name)
|
||||
}
|
||||
|
||||
static void
|
||||
addpart(name, fsname, auxdata)
|
||||
char *name, *fsname;
|
||||
long auxdata;
|
||||
addpart(char *name, char *fsname, long auxdata)
|
||||
{
|
||||
struct disk *dk = finddisk(name);
|
||||
struct part *pt, **ppt = &dk->part;
|
||||
@ -272,9 +265,7 @@ addpart(name, fsname, auxdata)
|
||||
}
|
||||
|
||||
static int
|
||||
startdisk(dk, checkit)
|
||||
struct disk *dk;
|
||||
int (*checkit)(char *, char *, long, int);
|
||||
startdisk(struct disk *dk, int (*checkit)(char *, char *, long, int))
|
||||
{
|
||||
struct part *pt = dk->part;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user