Prototype some things.

This commit is contained in:
pk 1994-05-02 10:18:21 +00:00
parent 394be046a5
commit 77c9a3fa5b
6 changed files with 110 additions and 22 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)fsck.h 5.17 (Berkeley) 7/27/90 * from: @(#)fsck.h 5.17 (Berkeley) 7/27/90
* $Id: fsck.h,v 1.4 1993/08/01 18:27:27 mycroft Exp $ * $Id: fsck.h,v 1.5 1994/05/02 10:18:21 pk Exp $
*/ */
#define MAXDUP 10 /* limit on dup blks (per inode) */ #define MAXDUP 10 /* limit on dup blks (per inode) */
@ -78,7 +78,6 @@ struct bufarea sblk; /* file system superblock */
struct bufarea cgblk; /* cylinder group blocks */ struct bufarea cgblk; /* cylinder group blocks */
struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */ struct bufarea *pbp; /* current inode block */
struct bufarea *getdatablk();
#define dirty(bp) (bp)->b_dirty = 1 #define dirty(bp) (bp)->b_dirty = 1
#define initbarea(bp) \ #define initbarea(bp) \
@ -204,9 +203,32 @@ struct dinode zino;
#define ALTERED 0x08 #define ALTERED 0x08
#define FOUND 0x10 #define FOUND 0x10
time_t time(); int ckinode __P((struct dinode *, struct inodesc *));
struct dinode *ginode(); int iblock __P((struct inodesc *, long, u_long));
struct inoinfo *getinoinfo(); int chkrange __P((daddr_t, int));
void getblk(); struct dinode *ginode __P((ino_t));
ino_t allocino(); struct dinode *getnextinode __P((ino_t));
int findino(); void cacheino __P((struct dinode *, ino_t));
struct inoinfo *getinoinfo __P((ino_t));
void resetinodebuf __P((void));
void freeinodebuf __P((void));
void inocleanup __P((void));
void inodirty __P((void));
void clri __P((struct inodesc *, char *, int));
int findname __P((struct inodesc *));
int findino __P((struct inodesc *));
void pinode __P((ino_t));
void blkerror __P((ino_t, char *, daddr_t));
ino_t allocino __P((ino_t, int));
void freeino __P((ino_t));
int ftypeok __P((struct dinode *));
struct bufarea *getdatablk __P((daddr_t, long));
void getblk __P((struct bufarea *, daddr_t, long));
void flush __P((int, struct bufarea *));
int bread __P((int, char *, daddr_t, long));
int bwrite __P((int, char *, daddr_t, long));
int allocblk __P((long));
void freeblk __P((daddr_t, long));
void getpathname __P((char *, ino_t, ino_t));

View File

@ -33,7 +33,7 @@
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)inode.c 5.18 (Berkeley) 3/19/91";*/ /*static char sccsid[] = "from: @(#)inode.c 5.18 (Berkeley) 3/19/91";*/
static char rcsid[] = "$Id: inode.c,v 1.7 1994/04/25 18:28:25 cgd Exp $"; static char rcsid[] = "$Id: inode.c,v 1.8 1994/05/02 10:18:23 pk Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -50,6 +50,7 @@ static char rcsid[] = "$Id: inode.c,v 1.7 1994/04/25 18:28:25 cgd Exp $";
static ino_t startinum; static ino_t startinum;
int
ckinode(dp, idesc) ckinode(dp, idesc)
struct dinode *dp; struct dinode *dp;
register struct inodesc *idesc; register struct inodesc *idesc;
@ -96,6 +97,7 @@ ckinode(dp, idesc)
return (KEEPON); return (KEEPON);
} }
int
iblock(idesc, ilevel, isize) iblock(idesc, ilevel, isize)
struct inodesc *idesc; struct inodesc *idesc;
register long ilevel; register long ilevel;
@ -159,6 +161,7 @@ iblock(idesc, ilevel, isize)
* Check that a block in a legal block number. * Check that a block in a legal block number.
* Return 0 if in range, 1 if out of range. * Return 0 if in range, 1 if out of range.
*/ */
int
chkrange(blk, cnt) chkrange(blk, cnt)
daddr_t blk; daddr_t blk;
int cnt; int cnt;
@ -248,6 +251,7 @@ getnextinode(inumber)
return (dp++); return (dp++);
} }
void
resetinodebuf() resetinodebuf()
{ {
@ -273,6 +277,7 @@ resetinodebuf()
(void)getnextinode(nextino); (void)getnextinode(nextino);
} }
void
freeinodebuf() freeinodebuf()
{ {
@ -288,6 +293,7 @@ freeinodebuf()
* *
* Enter inodes into the cache. * Enter inodes into the cache.
*/ */
void
cacheino(dp, inumber) cacheino(dp, inumber)
register struct dinode *dp; register struct dinode *dp;
ino_t inumber; ino_t inumber;
@ -344,6 +350,7 @@ getinoinfo(inumber)
/* /*
* Clean up all the inode cache structure. * Clean up all the inode cache structure.
*/ */
void
inocleanup() inocleanup()
{ {
register struct inoinfo **inpp; register struct inoinfo **inpp;
@ -356,13 +363,15 @@ inocleanup()
free((char *)inpsort); free((char *)inpsort);
inphead = inpsort = NULL; inphead = inpsort = NULL;
} }
void
inodirty() inodirty()
{ {
dirty(pbp); dirty(pbp);
} }
void
clri(idesc, type, flag) clri(idesc, type, flag)
register struct inodesc *idesc; register struct inodesc *idesc;
char *type; char *type;
@ -387,6 +396,7 @@ clri(idesc, type, flag)
} }
} }
int
findname(idesc) findname(idesc)
struct inodesc *idesc; struct inodesc *idesc;
{ {
@ -398,6 +408,7 @@ findname(idesc)
return (STOP|FOUND); return (STOP|FOUND);
} }
int
findino(idesc) findino(idesc)
struct inodesc *idesc; struct inodesc *idesc;
{ {
@ -413,6 +424,7 @@ findino(idesc)
return (KEEPON); return (KEEPON);
} }
void
pinode(ino) pinode(ino)
ino_t ino; ino_t ino;
{ {
@ -440,6 +452,7 @@ pinode(ino)
printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]); printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]);
} }
void
blkerror(ino, type, blk) blkerror(ino, type, blk)
ino_t ino; ino_t ino;
char *type; char *type;
@ -519,6 +532,7 @@ allocino(request, type)
/* /*
* deallocate an inode * deallocate an inode
*/ */
void
freeino(ino) freeino(ino)
ino_t ino; ino_t ino;
{ {

View File

@ -33,7 +33,7 @@
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)utilities.c 5.30 (Berkeley) 7/26/91";*/ /*static char sccsid[] = "from: @(#)utilities.c 5.30 (Berkeley) 7/26/91";*/
static char rcsid[] = "$Id: utilities.c,v 1.7 1994/04/25 18:29:08 cgd Exp $"; static char rcsid[] = "$Id: utilities.c,v 1.8 1994/05/02 10:18:25 pk Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -49,6 +49,7 @@ static char rcsid[] = "$Id: utilities.c,v 1.7 1994/04/25 18:29:08 cgd Exp $";
long diskreads, totalreads; /* Disk cache statistics */ long diskreads, totalreads; /* Disk cache statistics */
int
ftypeok(dp) ftypeok(dp)
struct dinode *dp; struct dinode *dp;
{ {
@ -70,6 +71,7 @@ ftypeok(dp)
} }
} }
int
reply(question) reply(question)
char *question; char *question;
{ {
@ -105,6 +107,7 @@ reply(question)
/* /*
* Malloc buffers and set up cache. * Malloc buffers and set up cache.
*/ */
void
bufinit() bufinit()
{ {
register struct bufarea *bp; register struct bufarea *bp;
@ -189,6 +192,7 @@ getblk(bp, blk, size)
} }
} }
void
flush(fd, bp) flush(fd, bp)
int fd; int fd;
register struct bufarea *bp; register struct bufarea *bp;
@ -214,6 +218,7 @@ flush(fd, bp)
} }
} }
void
rwerror(mesg, blk) rwerror(mesg, blk)
char *mesg; char *mesg;
daddr_t blk; daddr_t blk;
@ -226,6 +231,7 @@ rwerror(mesg, blk)
errexit("Program terminated\n"); errexit("Program terminated\n");
} }
void
ckfini() ckfini()
{ {
register struct bufarea *bp, *nbp; register struct bufarea *bp, *nbp;
@ -355,6 +361,7 @@ allocblk(frags)
/* /*
* Free a previously allocated block * Free a previously allocated block
*/ */
void
freeblk(blkno, frags) freeblk(blkno, frags)
daddr_t blkno; daddr_t blkno;
long frags; long frags;
@ -369,6 +376,7 @@ freeblk(blkno, frags)
/* /*
* Find a pathname * Find a pathname
*/ */
void
getpathname(namebuf, curdir, ino) getpathname(namebuf, curdir, ino)
char *namebuf; char *namebuf;
ino_t curdir, ino; ino_t curdir, ino;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)fsck.h 5.17 (Berkeley) 7/27/90 * from: @(#)fsck.h 5.17 (Berkeley) 7/27/90
* $Id: fsck.h,v 1.4 1993/08/01 18:27:27 mycroft Exp $ * $Id: fsck.h,v 1.5 1994/05/02 10:18:21 pk Exp $
*/ */
#define MAXDUP 10 /* limit on dup blks (per inode) */ #define MAXDUP 10 /* limit on dup blks (per inode) */
@ -78,7 +78,6 @@ struct bufarea sblk; /* file system superblock */
struct bufarea cgblk; /* cylinder group blocks */ struct bufarea cgblk; /* cylinder group blocks */
struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */ struct bufarea *pbp; /* current inode block */
struct bufarea *getdatablk();
#define dirty(bp) (bp)->b_dirty = 1 #define dirty(bp) (bp)->b_dirty = 1
#define initbarea(bp) \ #define initbarea(bp) \
@ -204,9 +203,32 @@ struct dinode zino;
#define ALTERED 0x08 #define ALTERED 0x08
#define FOUND 0x10 #define FOUND 0x10
time_t time(); int ckinode __P((struct dinode *, struct inodesc *));
struct dinode *ginode(); int iblock __P((struct inodesc *, long, u_long));
struct inoinfo *getinoinfo(); int chkrange __P((daddr_t, int));
void getblk(); struct dinode *ginode __P((ino_t));
ino_t allocino(); struct dinode *getnextinode __P((ino_t));
int findino(); void cacheino __P((struct dinode *, ino_t));
struct inoinfo *getinoinfo __P((ino_t));
void resetinodebuf __P((void));
void freeinodebuf __P((void));
void inocleanup __P((void));
void inodirty __P((void));
void clri __P((struct inodesc *, char *, int));
int findname __P((struct inodesc *));
int findino __P((struct inodesc *));
void pinode __P((ino_t));
void blkerror __P((ino_t, char *, daddr_t));
ino_t allocino __P((ino_t, int));
void freeino __P((ino_t));
int ftypeok __P((struct dinode *));
struct bufarea *getdatablk __P((daddr_t, long));
void getblk __P((struct bufarea *, daddr_t, long));
void flush __P((int, struct bufarea *));
int bread __P((int, char *, daddr_t, long));
int bwrite __P((int, char *, daddr_t, long));
int allocblk __P((long));
void freeblk __P((daddr_t, long));
void getpathname __P((char *, ino_t, ino_t));

View File

@ -33,7 +33,7 @@
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)inode.c 5.18 (Berkeley) 3/19/91";*/ /*static char sccsid[] = "from: @(#)inode.c 5.18 (Berkeley) 3/19/91";*/
static char rcsid[] = "$Id: inode.c,v 1.7 1994/04/25 18:28:25 cgd Exp $"; static char rcsid[] = "$Id: inode.c,v 1.8 1994/05/02 10:18:23 pk Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -50,6 +50,7 @@ static char rcsid[] = "$Id: inode.c,v 1.7 1994/04/25 18:28:25 cgd Exp $";
static ino_t startinum; static ino_t startinum;
int
ckinode(dp, idesc) ckinode(dp, idesc)
struct dinode *dp; struct dinode *dp;
register struct inodesc *idesc; register struct inodesc *idesc;
@ -96,6 +97,7 @@ ckinode(dp, idesc)
return (KEEPON); return (KEEPON);
} }
int
iblock(idesc, ilevel, isize) iblock(idesc, ilevel, isize)
struct inodesc *idesc; struct inodesc *idesc;
register long ilevel; register long ilevel;
@ -159,6 +161,7 @@ iblock(idesc, ilevel, isize)
* Check that a block in a legal block number. * Check that a block in a legal block number.
* Return 0 if in range, 1 if out of range. * Return 0 if in range, 1 if out of range.
*/ */
int
chkrange(blk, cnt) chkrange(blk, cnt)
daddr_t blk; daddr_t blk;
int cnt; int cnt;
@ -248,6 +251,7 @@ getnextinode(inumber)
return (dp++); return (dp++);
} }
void
resetinodebuf() resetinodebuf()
{ {
@ -273,6 +277,7 @@ resetinodebuf()
(void)getnextinode(nextino); (void)getnextinode(nextino);
} }
void
freeinodebuf() freeinodebuf()
{ {
@ -288,6 +293,7 @@ freeinodebuf()
* *
* Enter inodes into the cache. * Enter inodes into the cache.
*/ */
void
cacheino(dp, inumber) cacheino(dp, inumber)
register struct dinode *dp; register struct dinode *dp;
ino_t inumber; ino_t inumber;
@ -344,6 +350,7 @@ getinoinfo(inumber)
/* /*
* Clean up all the inode cache structure. * Clean up all the inode cache structure.
*/ */
void
inocleanup() inocleanup()
{ {
register struct inoinfo **inpp; register struct inoinfo **inpp;
@ -356,13 +363,15 @@ inocleanup()
free((char *)inpsort); free((char *)inpsort);
inphead = inpsort = NULL; inphead = inpsort = NULL;
} }
void
inodirty() inodirty()
{ {
dirty(pbp); dirty(pbp);
} }
void
clri(idesc, type, flag) clri(idesc, type, flag)
register struct inodesc *idesc; register struct inodesc *idesc;
char *type; char *type;
@ -387,6 +396,7 @@ clri(idesc, type, flag)
} }
} }
int
findname(idesc) findname(idesc)
struct inodesc *idesc; struct inodesc *idesc;
{ {
@ -398,6 +408,7 @@ findname(idesc)
return (STOP|FOUND); return (STOP|FOUND);
} }
int
findino(idesc) findino(idesc)
struct inodesc *idesc; struct inodesc *idesc;
{ {
@ -413,6 +424,7 @@ findino(idesc)
return (KEEPON); return (KEEPON);
} }
void
pinode(ino) pinode(ino)
ino_t ino; ino_t ino;
{ {
@ -440,6 +452,7 @@ pinode(ino)
printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]); printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]);
} }
void
blkerror(ino, type, blk) blkerror(ino, type, blk)
ino_t ino; ino_t ino;
char *type; char *type;
@ -519,6 +532,7 @@ allocino(request, type)
/* /*
* deallocate an inode * deallocate an inode
*/ */
void
freeino(ino) freeino(ino)
ino_t ino; ino_t ino;
{ {

View File

@ -33,7 +33,7 @@
#ifndef lint #ifndef lint
/*static char sccsid[] = "from: @(#)utilities.c 5.30 (Berkeley) 7/26/91";*/ /*static char sccsid[] = "from: @(#)utilities.c 5.30 (Berkeley) 7/26/91";*/
static char rcsid[] = "$Id: utilities.c,v 1.7 1994/04/25 18:29:08 cgd Exp $"; static char rcsid[] = "$Id: utilities.c,v 1.8 1994/05/02 10:18:25 pk Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -49,6 +49,7 @@ static char rcsid[] = "$Id: utilities.c,v 1.7 1994/04/25 18:29:08 cgd Exp $";
long diskreads, totalreads; /* Disk cache statistics */ long diskreads, totalreads; /* Disk cache statistics */
int
ftypeok(dp) ftypeok(dp)
struct dinode *dp; struct dinode *dp;
{ {
@ -70,6 +71,7 @@ ftypeok(dp)
} }
} }
int
reply(question) reply(question)
char *question; char *question;
{ {
@ -105,6 +107,7 @@ reply(question)
/* /*
* Malloc buffers and set up cache. * Malloc buffers and set up cache.
*/ */
void
bufinit() bufinit()
{ {
register struct bufarea *bp; register struct bufarea *bp;
@ -189,6 +192,7 @@ getblk(bp, blk, size)
} }
} }
void
flush(fd, bp) flush(fd, bp)
int fd; int fd;
register struct bufarea *bp; register struct bufarea *bp;
@ -214,6 +218,7 @@ flush(fd, bp)
} }
} }
void
rwerror(mesg, blk) rwerror(mesg, blk)
char *mesg; char *mesg;
daddr_t blk; daddr_t blk;
@ -226,6 +231,7 @@ rwerror(mesg, blk)
errexit("Program terminated\n"); errexit("Program terminated\n");
} }
void
ckfini() ckfini()
{ {
register struct bufarea *bp, *nbp; register struct bufarea *bp, *nbp;
@ -355,6 +361,7 @@ allocblk(frags)
/* /*
* Free a previously allocated block * Free a previously allocated block
*/ */
void
freeblk(blkno, frags) freeblk(blkno, frags)
daddr_t blkno; daddr_t blkno;
long frags; long frags;
@ -369,6 +376,7 @@ freeblk(blkno, frags)
/* /*
* Find a pathname * Find a pathname
*/ */
void
getpathname(namebuf, curdir, ino) getpathname(namebuf, curdir, ino)
char *namebuf; char *namebuf;
ino_t curdir, ino; ino_t curdir, ino;