|
|
1.1 ! root 1: #include "sys/param.h" ! 2: #include "sys/filsys.h" ! 3: #include "sys/ino.h" ! 4: #include "sys/inode.h" ! 5: #include "sys/dir.h" ! 6: struct filsys sblk; ! 7: long ninode, /* first illegal inode number */ ! 8: fblk, /* first legal data block number */ ! 9: lblk, /* first illegal data block number */ ! 10: pblk, /* first illegal physical block number */ ! 11: inopb; /* dinodes per block */ ! 12: typedef struct { /* one per file system block */ ! 13: char type; ! 14: long ino; ! 15: int bnum; ! 16: } bm; ! 17: enum bm_type {Unk, Sblock, Inode, Free, Data, Ind, Ind2, Ind3, ! 18: First, Other, Bits, Ioerr, Boot, Bad}; ! 19: bm *bmap; ! 20: typedef struct { /* one per inode */ ! 21: unsigned char type, seen; ! 22: unsigned short nrefs; /* how many dirs am i found in? */ ! 23: long last; /* last legal block number */ ! 24: long dotdot; /* .. for dirs */ ! 25: long parent; /* a directory i'm found in */ ! 26: int ptr; /* where dir entries start in dmap, after qsort */ ! 27: } im; ! 28: enum im_type {Unalloc, Dir, Lnk, Chr, Blk, Reg, Weird}; ! 29: im *imap; ! 30: typedef struct { ! 31: long dino, ino; /* directory summary */ ! 32: } dm; ! 33: dm *dmap; ! 34: int dmaplen; /* in case we have to realloc */ ! 35: int dmapptr; ! 36: char flags[128]; ! 37: char *file; /* the name of the file system */ ! 38: int fd; /* fd for reading it */ ! 39: int bsize; /* block size in file system */ ! 40: int exitcode; ! 41: char *freeb; /* bit map blocks for large file systems */ ! 42: int tfree, tinode; /* for the super block */ ! 43: char *itype(), *btype(),*prname(), *prino(); ! 44: char mbuf[4096], xbuf[]; /* to format output messages */ ! 45: char *buf; /* where the inode blocks get read (first 2 are extra bufs) */ ! 46: int buflen; /* how much is allocated */ ! 47: enum e_type {Elinksize = 1, Ebadaddr, Efirst, Ebadread, Efirstio, Edirio, ! 48: Enotdot, Edotino, Enotdotdot, Ebadino, Ebadname, Enullable, ! 49: Elinkcnt, Emulti, Ebadparent, Einvalid, Esuperfree, ! 50: Esuperino, Efreelist, Edup, Eshort, Ehole, Etriple, Eshortdir, ! 51: Eattach, Efakeroot, }; ! 52: typedef struct { ! 53: enum e_type type; ! 54: long a, b; ! 55: char done; ! 56: } er; ! 57: er *erlist; ! 58: int erptr, erlen; ! 59: int errcnts[32]; /* at least all the e_types! */ ! 60: int blkcnts[32]; ! 61: int *iarg, *barg; /* argument I and B */ ! 62: int ilen, iptr, blen, bptr;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.