Changeset View
Changeset View
Standalone View
Standalone View
sbin/fsck_ffs/fsck.h
| Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | |||||
| #define BT_CYLGRP 2 /* Buffer holds a cylinder group map */ | #define BT_CYLGRP 2 /* Buffer holds a cylinder group map */ | ||||
| #define BT_LEVEL1 3 /* Buffer holds single level indirect */ | #define BT_LEVEL1 3 /* Buffer holds single level indirect */ | ||||
| #define BT_LEVEL2 4 /* Buffer holds double level indirect */ | #define BT_LEVEL2 4 /* Buffer holds double level indirect */ | ||||
| #define BT_LEVEL3 5 /* Buffer holds triple level indirect */ | #define BT_LEVEL3 5 /* Buffer holds triple level indirect */ | ||||
| #define BT_EXTATTR 6 /* Buffer holds external attribute data */ | #define BT_EXTATTR 6 /* Buffer holds external attribute data */ | ||||
| #define BT_INODES 7 /* Buffer holds inodes */ | #define BT_INODES 7 /* Buffer holds inodes */ | ||||
| #define BT_DIRDATA 8 /* Buffer holds directory data */ | #define BT_DIRDATA 8 /* Buffer holds directory data */ | ||||
| #define BT_DATA 9 /* Buffer holds user data */ | #define BT_DATA 9 /* Buffer holds user data */ | ||||
| #define BT_EMPTY 10 /* Buffer allocated but not filled */ | #define BT_NUMBUFTYPES 10 | ||||
| #define BT_NUMBUFTYPES 11 | |||||
| #define BT_NAMES { \ | #define BT_NAMES { \ | ||||
| "unknown", \ | "unknown", \ | ||||
| "Superblock", \ | "Superblock", \ | ||||
| "Cylinder Group", \ | "Cylinder Group", \ | ||||
| "Single Level Indirect", \ | "Single Level Indirect", \ | ||||
| "Double Level Indirect", \ | "Double Level Indirect", \ | ||||
| "Triple Level Indirect", \ | "Triple Level Indirect", \ | ||||
| "External Attribute", \ | "External Attribute", \ | ||||
| "Inode Block", \ | "Inode Block", \ | ||||
| "Directory Contents", \ | "Directory Contents", \ | ||||
| "User Data", \ | "User Data" } | ||||
| "Allocated but not filled" } | |||||
| extern char *buftype[]; | extern char *buftype[]; | ||||
| #define BT_BUFTYPE(type) \ | #define BT_BUFTYPE(type) \ | ||||
| type < BT_NUMBUFTYPES ? buftype[type] : buftype[BT_UNKNOWN] | type < BT_NUMBUFTYPES ? buftype[type] : buftype[BT_UNKNOWN] | ||||
| extern long readcnt[BT_NUMBUFTYPES]; | extern long readcnt[BT_NUMBUFTYPES]; | ||||
| extern long totalreadcnt[BT_NUMBUFTYPES]; | extern long totalreadcnt[BT_NUMBUFTYPES]; | ||||
| extern struct timespec readtime[BT_NUMBUFTYPES]; | extern struct timespec readtime[BT_NUMBUFTYPES]; | ||||
| extern struct timespec totalreadtime[BT_NUMBUFTYPES]; | extern struct timespec totalreadtime[BT_NUMBUFTYPES]; | ||||
| extern struct timespec startprog; | extern struct timespec startprog; | ||||
| extern struct bufarea *icachebp; /* inode cache buffer */ | extern struct bufarea *icachebp; /* inode cache buffer */ | ||||
| extern struct bufarea sblk; /* file system superblock */ | extern struct bufarea sblk; /* file system superblock */ | ||||
| extern struct bufarea *pdirbp; /* current directory contents */ | extern struct bufarea *pdirbp; /* current directory contents */ | ||||
| #define dirty(bp) do { \ | #define dirty(bp) do { \ | ||||
| if (fswritefd < 0) \ | if (fswritefd < 0) \ | ||||
| pfatal("SETTING DIRTY FLAG IN READ_ONLY MODE\n"); \ | pfatal("SETTING DIRTY FLAG IN READ_ONLY MODE\n"); \ | ||||
| else \ | else \ | ||||
| (bp)->b_flags |= B_DIRTY; \ | (bp)->b_flags |= B_DIRTY; \ | ||||
| } while (0) | } while (0) | ||||
| #define initbarea(bp, type) do { \ | #define initbarea(bp, type) do { \ | ||||
| (bp)->b_bno = (ufs2_daddr_t)-1; \ | (bp)->b_bno = (ufs2_daddr_t)-4; \ | ||||
| (bp)->b_size = 0; \ | (bp)->b_size = 0; \ | ||||
| (bp)->b_errs = 0; \ | (bp)->b_errs = 0; \ | ||||
| (bp)->b_flags = 0; \ | (bp)->b_flags = 0; \ | ||||
| (bp)->b_type = type; \ | (bp)->b_type = type; \ | ||||
| (bp)->b_refcnt = 0; \ | (bp)->b_refcnt = 0; \ | ||||
| (bp)->b_index = 0; \ | (bp)->b_index = 0; \ | ||||
| } while (0) | } while (0) | ||||
| ▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | |||||
| extern int bkgrdsumadj; /* whether the kernel has the ability to adjust | extern int bkgrdsumadj; /* whether the kernel has the ability to adjust | ||||
| the superblock summary fields */ | the superblock summary fields */ | ||||
| extern off_t bflag; /* location of alternate super block */ | extern off_t bflag; /* location of alternate super block */ | ||||
| extern int bkgrdflag; /* use a snapshot to run on an active system */ | extern int bkgrdflag; /* use a snapshot to run on an active system */ | ||||
| extern char *blockmap; /* ptr to primary blk allocation map */ | extern char *blockmap; /* ptr to primary blk allocation map */ | ||||
| extern char *cdevname; /* name of device being checked */ | extern char *cdevname; /* name of device being checked */ | ||||
| extern char ckclean; /* only do work if not cleanly unmounted */ | extern char ckclean; /* only do work if not cleanly unmounted */ | ||||
| extern int ckhashadd; /* check hashes to be added */ | extern int ckhashadd; /* check hashes to be added */ | ||||
| extern char *copybuf; /* buffer to copy snapshot blocks */ | |||||
| extern int cvtlevel; /* convert to newer file system format */ | extern int cvtlevel; /* convert to newer file system format */ | ||||
| extern long dev_bsize; /* computed value of DEV_BSIZE */ | extern long dev_bsize; /* computed value of DEV_BSIZE */ | ||||
| extern u_int real_dev_bsize; /* actual disk sector size, not overridden */ | extern u_int real_dev_bsize; /* actual disk sector size, not overridden */ | ||||
| extern int debug; /* output debugging info */ | extern int debug; /* output debugging info */ | ||||
| extern int Eflag; /* delete empty data blocks */ | extern int Eflag; /* delete empty data blocks */ | ||||
| extern int fsmodified; /* 1 => write done to file system */ | extern int fsmodified; /* 1 => write done to file system */ | ||||
| extern int fsreadfd; /* file descriptor for reading file system */ | extern int fsreadfd; /* file descriptor for reading file system */ | ||||
| extern int fswritefd; /* file descriptor for writing file system */ | extern int fswritefd; /* file descriptor for writing file system */ | ||||
| extern char havesb; /* superblock has been read */ | extern char havesb; /* superblock has been read */ | ||||
| extern int inoopt; /* trim out unused inodes */ | extern int inoopt; /* trim out unused inodes */ | ||||
| extern ino_t lfdir; /* lost & found directory inode number */ | extern ino_t lfdir; /* lost & found directory inode number */ | ||||
| extern int lfmode; /* lost & found directory creation mode */ | extern int lfmode; /* lost & found directory creation mode */ | ||||
| extern const char *lfname; /* lost & found directory name */ | extern const char *lfname; /* lost & found directory name */ | ||||
| extern ufs2_daddr_t maxfsblock; /* number of blocks in the file system */ | extern ufs2_daddr_t maxfsblock; /* number of blocks in the file system */ | ||||
| extern ino_t maxino; /* number of inodes in file system */ | extern ino_t maxino; /* number of inodes in file system */ | ||||
| extern ufs2_daddr_t n_blks; /* number of blocks in use */ | extern ufs2_daddr_t n_blks; /* number of blocks in use */ | ||||
| extern ino_t n_files; /* number of files in use */ | extern ino_t n_files; /* number of files in use */ | ||||
| extern char nflag; /* assume a no response */ | extern char nflag; /* assume a no response */ | ||||
| extern char preen; /* just fix normal inconsistencies */ | extern char preen; /* just fix normal inconsistencies */ | ||||
| extern char rerun; /* rerun fsck. Only used in non-preen mode */ | extern char rerun; /* rerun fsck. Only used in non-preen mode */ | ||||
| extern char resolved; /* cleared if unresolved changes => not clean */ | extern char resolved; /* cleared if unresolved changes => not clean */ | ||||
| extern int returntosingle; /* 1 => return to single user mode on exit */ | extern int returntosingle; /* 1 => return to single user mode on exit */ | ||||
| extern long secsize; /* actual disk sector size */ | extern long secsize; /* actual disk sector size */ | ||||
| extern char skipclean; /* skip clean file systems if preening */ | extern char skipclean; /* skip clean file systems if preening */ | ||||
| extern int snapcnt; /* number of active snapshots */ | |||||
| extern struct inode snaplist[FSMAXSNAP + 1]; /* list of active snapshots */ | |||||
| extern char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ | extern char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ | ||||
| extern int sujrecovery; /* 1 => doing check using the journal */ | extern int sujrecovery; /* 1 => doing check using the journal */ | ||||
| extern int surrender; /* Give up if reads fail */ | extern int surrender; /* Give up if reads fail */ | ||||
| extern char usedsoftdep; /* just fix soft dependency inconsistencies */ | extern char usedsoftdep; /* just fix soft dependency inconsistencies */ | ||||
| extern int wantrestart; /* Restart fsck on early termination */ | extern int wantrestart; /* Restart fsck on early termination */ | ||||
| extern char yflag; /* assume a yes response */ | extern char yflag; /* assume a yes response */ | ||||
| extern int zflag; /* zero unused directory space */ | extern int zflag; /* zero unused directory space */ | ||||
| extern int Zflag; /* zero empty data blocks */ | extern int Zflag; /* zero empty data blocks */ | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | Calloc(size_t cnt, size_t size) | ||||
| return (retval); | return (retval); | ||||
| } | } | ||||
| struct fstab; | struct fstab; | ||||
| void adjust(struct inodesc *, int lcnt); | void adjust(struct inodesc *, int lcnt); | ||||
| void alarmhandler(int sig); | void alarmhandler(int sig); | ||||
| ufs2_daddr_t allocblk(long frags); | ufs2_daddr_t allocblk(long cg, long frags, ufs2_daddr_t (*checkblkavail) | ||||
| (ufs2_daddr_t blkno, long frags)); | |||||
| ino_t allocdir(ino_t parent, ino_t request, int mode); | ino_t allocdir(ino_t parent, ino_t request, int mode); | ||||
| ino_t allocino(ino_t request, int type); | ino_t allocino(ino_t request, int type); | ||||
| void binval(struct bufarea *); | |||||
| void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk); | void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk); | ||||
| char *blockcheck(char *name); | char *blockcheck(char *name); | ||||
| int blread(int fd, char *buf, ufs2_daddr_t blk, long size); | int blread(int fd, char *buf, ufs2_daddr_t blk, long size); | ||||
| void bufinit(void); | void bufinit(void); | ||||
| void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size); | void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size); | ||||
| void blerase(int fd, ufs2_daddr_t blk, long size); | void blerase(int fd, ufs2_daddr_t blk, long size); | ||||
| void blzero(int fd, ufs2_daddr_t blk, long size); | void blzero(int fd, ufs2_daddr_t blk, long size); | ||||
| void brelse(struct bufarea *); | void brelse(struct bufarea *); | ||||
| struct inoinfo *cacheino(union dinode *dp, ino_t inumber); | struct inoinfo *cacheino(union dinode *dp, ino_t inumber); | ||||
| void catch(int); | void catch(int); | ||||
| void catchquit(int); | void catchquit(int); | ||||
| void cgdirty(struct bufarea *); | void cgdirty(struct bufarea *); | ||||
| struct bufarea *cglookup(int cg); | struct bufarea *cglookup(int cg); | ||||
| int changeino(ino_t dir, const char *name, ino_t newnum); | int changeino(ino_t dir, const char *name, ino_t newnum); | ||||
| void check_blkcnt(struct inode *ip); | |||||
| int check_cgmagic(int cg, struct bufarea *cgbp, int requestrebuild); | int check_cgmagic(int cg, struct bufarea *cgbp, int requestrebuild); | ||||
| int chkrange(ufs2_daddr_t blk, int cnt); | int chkrange(ufs2_daddr_t blk, int cnt); | ||||
| void ckfini(int markclean); | void ckfini(int markclean); | ||||
| int ckinode(union dinode *dp, struct inodesc *); | int ckinode(union dinode *dp, struct inodesc *); | ||||
| void clri(struct inodesc *, const char *type, int flag); | void clri(struct inodesc *, const char *type, int flag); | ||||
| int clearentry(struct inodesc *); | int clearentry(struct inodesc *); | ||||
| void copyonwrite(struct fs *, struct bufarea *, | |||||
| ufs2_daddr_t (*checkblkavail)(long, long)); | |||||
| void direrror(ino_t ino, const char *errmesg); | void direrror(ino_t ino, const char *errmesg); | ||||
| int dirscan(struct inodesc *); | int dirscan(struct inodesc *); | ||||
| int dofix(struct inodesc *, const char *msg); | int dofix(struct inodesc *, const char *msg); | ||||
| int eascan(struct inodesc *, struct ufs2_dinode *dp); | int eascan(struct inodesc *, struct ufs2_dinode *dp); | ||||
| void fileerror(ino_t cwd, ino_t ino, const char *errmesg); | void fileerror(ino_t cwd, ino_t ino, const char *errmesg); | ||||
| void finalIOstats(void); | void finalIOstats(void); | ||||
| int findino(struct inodesc *); | int findino(struct inodesc *); | ||||
| int findname(struct inodesc *); | int findname(struct inodesc *); | ||||
| void flush(int fd, struct bufarea *bp); | void flush(int fd, struct bufarea *bp); | ||||
| int freeblock(struct inodesc *); | int freeblock(struct inodesc *); | ||||
| void freeino(ino_t ino); | void freeino(ino_t ino); | ||||
| void freeinodebuf(void); | void freeinodebuf(void); | ||||
| void fsckinit(void); | |||||
| void fsutilinit(void); | void fsutilinit(void); | ||||
| int ftypeok(union dinode *dp); | int ftypeok(union dinode *dp); | ||||
| void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); | void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); | ||||
| struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); | struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); | ||||
| struct inoinfo *getinoinfo(ino_t inumber); | struct inoinfo *getinoinfo(ino_t inumber); | ||||
| union dinode *getnextinode(ino_t inumber, int rebuildcg); | union dinode *getnextinode(ino_t inumber, int rebuildcg); | ||||
| void getpathname(char *namebuf, ino_t curdir, ino_t ino); | void getpathname(char *namebuf, ino_t curdir, ino_t ino); | ||||
| void ginode(ino_t, struct inode *); | void ginode(ino_t, struct inode *); | ||||
| void gjournal_check(const char *filesys); | |||||
| void infohandler(int sig); | void infohandler(int sig); | ||||
| void irelse(struct inode *); | void irelse(struct inode *); | ||||
| ufs2_daddr_t ino_blkatoff(union dinode *, ino_t, ufs_lbn_t, int *, | ufs2_daddr_t ino_blkatoff(union dinode *, ino_t, ufs_lbn_t, int *, | ||||
| struct bufarea **); | struct bufarea **); | ||||
| void inocleanup(void); | void inocleanup(void); | ||||
| void inodirty(struct inode *); | void inodirty(struct inode *); | ||||
| struct inostat *inoinfo(ino_t inum); | struct inostat *inoinfo(ino_t inum); | ||||
| void IOstats(char *what); | void IOstats(char *what); | ||||
| int linkup(ino_t orphan, ino_t parentdir, char *name); | int linkup(ino_t orphan, ino_t parentdir, char *name); | ||||
| int makeentry(ino_t parent, ino_t ino, const char *name); | int makeentry(ino_t parent, ino_t ino, const char *name); | ||||
| int openfilesys(char *dev); | int openfilesys(char *dev); | ||||
| void panic(const char *fmt, ...) __printflike(1, 2); | void panic(const char *fmt, ...) __printflike(1, 2); | ||||
| void pass1(void); | void pass1(void); | ||||
| void pass1b(void); | void pass1b(void); | ||||
| int pass1check(struct inodesc *); | int pass1check(struct inodesc *); | ||||
| void pass2(void); | void pass2(void); | ||||
| void pass3(void); | void pass3(void); | ||||
| void pass4(void); | void pass4(void); | ||||
| void pass5(void); | void pass5(void); | ||||
| void pfatal(const char *fmt, ...) __printflike(1, 2); | void pfatal(const char *fmt, ...) __printflike(1, 2); | ||||
| void propagate(void); | void propagate(void); | ||||
| void prtbuf(struct bufarea *, const char *, ...) __printflike(2, 3); | |||||
| void prtinode(struct inode *); | void prtinode(struct inode *); | ||||
| void pwarn(const char *fmt, ...) __printflike(1, 2); | void pwarn(const char *fmt, ...) __printflike(1, 2); | ||||
| int readsb(void); | int readsb(void); | ||||
| int reply(const char *question); | int reply(const char *question); | ||||
| void rwerror(const char *mesg, ufs2_daddr_t blk); | void rwerror(const char *mesg, ufs2_daddr_t blk); | ||||
| void sblock_init(void); | void sblock_init(void); | ||||
| void setinodebuf(int, ino_t); | void setinodebuf(int, ino_t); | ||||
| int setup(char *dev); | int setup(char *dev); | ||||
| void gjournal_check(const char *filesys); | int snapblkfree(struct fs *, ufs2_daddr_t, long, ino_t, | ||||
| ufs2_daddr_t (*)(ufs2_daddr_t, long)); | |||||
| void snapremove(ino_t); | |||||
| void snapflush(ufs2_daddr_t (*checkblkavail)(long, long)); | |||||
| ufs2_daddr_t std_checkblkavail(ufs2_daddr_t blkno, long frags); | |||||
| ufs2_daddr_t suj_checkblkavail(ufs2_daddr_t, long); | |||||
| int suj_check(const char *filesys); | int suj_check(const char *filesys); | ||||
| void update_maps(struct cg *, struct cg*, int); | void update_maps(struct cg *, struct cg*, int); | ||||
| void fsckinit(void); | |||||
| #endif /* !_FSCK_H_ */ | #endif /* !_FSCK_H_ */ | ||||