4.3BSD beta release manual page
[unix-history] / usr / src / sbin / fsck / fsck.h
/* @(#)fsck.h 3.3 (Berkeley) %G% */
#define MAXDUP 10 /* limit on dup blks (per inode) */
#define MAXBAD 10 /* limit on bad blks (per inode) */
#define DUPTBLSIZE 100 /* num of dup blocks to remember */
#define MAXLNCNT 500 /* num zero link cnts to remember */
typedef int (*SIG_TYP)();
#ifndef BUFSIZ
#define BUFSIZ 1024
#endif
#define USTATE 01 /* inode not allocated */
#define FSTATE 02 /* inode is file */
#define DSTATE 03 /* inode is directory */
#define DFOUND 04 /* directory found during descent */
#define DCLEAR 05 /* directory is to be cleared */
#define FCLEAR 06 /* file is to be cleared */
typedef struct dinode DINODE;
typedef struct direct DIRECT;
#define ALLOC(dip) (((dip)->di_mode & IFMT) != 0)
#define DIRCT(dip) (((dip)->di_mode & IFMT) == IFDIR)
#define SPECIAL(dip) \
(((dip)->di_mode & IFMT) == IFBLK || ((dip)->di_mode & IFMT) == IFCHR)
#define MAXNINDIR (MAXBSIZE / sizeof (daddr_t))
#define MAXINOPB (MAXBSIZE / sizeof (struct dinode))
#define SPERB (MAXBSIZE / sizeof(short))
struct bufarea {
struct bufarea *b_next; /* must be first */
daddr_t b_bno;
int b_size;
union {
char b_buf[MAXBSIZE]; /* buffer space */
short b_lnks[SPERB]; /* link counts */
daddr_t b_indir[MAXNINDIR]; /* indirect block */
struct fs b_fs; /* super block */
struct cg b_cg; /* cylinder group */
struct dinode b_dinode[MAXINOPB]; /* inode block */
} b_un;
char b_dirty;
};
typedef struct bufarea BUFAREA;
BUFAREA inoblk; /* inode blocks */
BUFAREA fileblk; /* other blks in filesys */
BUFAREA sblk; /* file system superblock */
BUFAREA cgblk; /* cylinder group blocks */
#define initbarea(x) (x)->b_dirty = 0;(x)->b_bno = (daddr_t)-1
#define dirty(x) (x)->b_dirty = 1
#define inodirty() inoblk.b_dirty = 1
#define sbdirty() sblk.b_dirty = 1
#define cgdirty() cgblk.b_dirty = 1
#define dirblk fileblk.b_un
#define sblock sblk.b_un.b_fs
#define cgrp cgblk.b_un.b_cg
struct filecntl {
int rfdes;
int wfdes;
int mod;
} dfile; /* file descriptors for filesys */
enum fixstate {DONTKNOW, NOFIX, FIX};
struct inodesc {
enum fixstate id_fix; /* policy on fixing errors */
int (*id_func)(); /* function to be applied to blocks of inode */
ino_t id_number; /* inode number described */
ino_t id_parent; /* for DATA nodes, their parent */
daddr_t id_blkno; /* current block number being examined */
int id_numfrags; /* number of frags contained in block */
long id_filesize; /* for DATA nodes, the size of the directory */
int id_loc; /* for DATA nodes, current location in dir */
int id_entryno; /* for DATA nodes, current entry number */
DIRECT *id_dirp; /* for DATA nodes, ptr to current entry */
char *id_name; /* for DATA nodes, name to find or enter */
char id_type; /* type of descriptor, DATA or ADDR */
};
/* file types */
#define DATA 1
#define ADDR 2
daddr_t duplist[DUPTBLSIZE]; /* dup block table */
daddr_t *enddup; /* next entry in dup table */
daddr_t *muldup; /* multiple dups part of table */
ino_t badlncnt[MAXLNCNT]; /* table of inos with zero link cnts */
ino_t *badlnp; /* next entry in table */
char rawflg;
char *devname;
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
int bflag; /* location of alternate super block */
int debug; /* output debugging info */
char preen; /* just fix normal inconsistencies */
char hotroot; /* checking root device */
char *blockmap; /* ptr to primary blk allocation map */
char *statemap; /* ptr to inode state table */
short *lncntp; /* ptr to link count table */
char pathname[BUFSIZ]; /* current pathname */
char *pathp; /* pointer to pathname position */
char *endpathname;
daddr_t fmax; /* number of blocks in the volume */
ino_t imax; /* number of inodes */
ino_t lastino; /* hiwater mark of inodes */
ino_t lfdir; /* lost & found directory inode number */
char *lfname; /* lost & found directory name */
off_t maxblk; /* largest logical blk in file */
off_t bmapsz; /* num chars in blockmap */
daddr_t n_blks; /* number of blocks used */
daddr_t n_files; /* number of files seen */
#define zapino(x) (*(x) = zino)
struct dinode zino;
#define setbmap(x) setbit(blockmap, x)
#define getbmap(x) isset(blockmap, x)
#define clrbmap(x) clrbit(blockmap, x)
#define ALTERED 010
#define KEEPON 04
#define SKIP 02
#define STOP 01
time_t time();
DINODE *ginode();
BUFAREA *getblk();
int findino();