- * get_fs_info:
- *
- * get all the information available on a file system
- */
-extern int
-get_fs_info __P((struct statfs *lstatfsp, FS_INFO **fspp, int count));
-
-extern void
-free_fs_info __P((FS_INFO *fsp, int count));
-
-/*
- * get_superblock:
- * gets the superblock from disk (possibly in face of errors)
- */
-extern int
-get_superblock __P((FS_INFO *fsp, struct lfs *sbp));
-
-
-/*
- * get_ifile:
- * This function will map the ifile into memory. It returns
- * NULL on failure.
- */
-extern int
-get_ifile __P((FS_INFO *fsp));
-
-/*
- * segmapv:
- *
- * This function will scan a segment and return a list of
- * <inode, blocknum> pairs which indicate which blocks were
- * contained as live data within the segment at some point
- * (it may have "died" since then). Any given pair will be
- * listed at most once.
- */
-extern int
-lfs_segmapv __P((FS_INFO *fsp, int seg, caddr_t seg_buf,
- BLOCK_INFO **blocks, int *bcount,
- INODE_INFO **inodes, int *icount));
-
-/*
- * this will parse a partial segment and create a vector of block_info's
- * for live data blocks for live inodes. It will not include blocks or
- * inodes from files with new version numbers.
- */
-extern void
-pseg_blocks __P((FS_INFO *fsp, int seg, SEGSUM *s, caddr_t seg_buf,
- BLOCK_INFO **blocks, int *count));
-
-/*
- * this will parse a partial segment and create a vector of inode_info's
- * for live inodes. It will not include blocks or inodes from files
- * with new version numbers.
- */
-extern void
-pseg_inodes __P((FS_INFO *fsp, int seg, SEGSUM *s, caddr_t seg_buf,
- INODE_INFO **inodes, int *count));
-
-/*
- * return the size of the partial segment in bytes.
- */
-extern u_long
-pseg_size __P((FS_INFO *fsp, SEGSUM *s));
-
-
-/*
- * join block list b with list a (eliminating duplicates), leaving result
- * in list a.
- */
-extern void
-pseg_bjoin __P((FS_INFO *fsp, BLOCK_INFO **ablocks, int *acount,
- BLOCK_INFO *bblocks, int bcount));
-
-
-/*
- * join inode list b with list a (eliminating duplicates), leaving result
- * in list a.
- */
-extern void
-pseg_ijoin __P((FS_INFO *fsp, INODE_INFO **ainodes, int *acount,
- INODE_INFO *binodes, int bcount));
-
-
-/* is the segsum block valid? return TRUE if it is, FALSE otherwise */
-extern int
-segsum_valid __P((FS_INFO *fsp, SEGSUM *ssp));
-
-
-/*
- * pseg_valid:
- *
- * returns 1 if the partial segment is valid, and 0 if it is invalid.
- * it uses the checksums to verify validity.
- */
-extern int
-pseg_valid __P((FS_INFO *fsp, SEGSUM *ssp));
-
-
-/*
- * pseg_finfos:
- *
- * get array of FINFO pointers for partial segment
- * return the array in finfos, and the size of the array in count
- */
-extern void
-pseg_finfos __P((FS_INFO *fsp, SEGSUM *ssp, FINFO ***finfos, int *count));
-
-/*
- * blocksize:
- *
- * returns the size (in bytes) of a (logical) block.
- * this is used because lfs uses different block sizes, depending
- * on the logical # of the block. Lfs uses various sizes so
- * it doesn't need fragments.
- */
-extern u_long
-blocksize __P((FS_INFO *fsp, int index));
-
-/*
- * finfo_size:
- *
- * returns the size in bytes of an FINFO structure
- */
-extern u_long
-finfo_size __P((FINFO *finfop));
-
-/*
- * Simple, general purpose, fast checksum. Data must be short-aligned.
- * Returns a u_long in case we ever want to do something more rigorous.
- *
- * XXX
- * Use the TCP/IP checksum instead.
- */
-extern u_long
-cksum __P((register void *str, register size_t len));
-
-/*
- * read a segment into a memory buffer
- */
-extern int
-mmap_segment __P((FS_INFO *fsp, int segment, caddr_t *seg_buf));
-
-extern void
-munmap_segment __P((FS_INFO *fsp, caddr_t seg_buf));
-
-
-/*
- * USEFUL DEBUGGING TOOLS:
- */
-
-extern void
-print_IFILE __P((IFILE *p));
-
-extern void
-print_SEGUSE __P((SEGUSE *p));
-
-extern void
-print_CLEANERINFO __P((CLEANERINFO *p));
-
-extern void
-print_SEGSUM __P((SEGSUM *p));
-
-extern void
-print_time_t __P((time_t t));
-
-extern void
-print_BLOCK_INFO __P((BLOCK_INFO *p));
-
-extern void
-print_INODE_INFO __P((INODE_INFO *p));
-
-extern void
-print_FINFO __P((FINFO *p));
-
-extern void
-print_lfs __P((struct lfs *p));
+ * USEFUL DEBUGGING FUNCTIONS:
+ */
+#ifdef VERBOSE
+#define PRINT_FINFO(fp, ip) { \
+ (void)printf(" %s %s%d version %d nblocks %d\n", \
+ (ip)->if_version > (fp)->fi_version ? "TOSSING" : "KEEPING", \
+ "FINFO for inode: ", (fp)->fi_ino, \
+ (fp)->fi_version, (fp)->fi_nblocks); \
+ fflush(stdout); \
+}
+
+#define PRINT_IINFO(b, iip) { \
+ (void) printf("\t%s inode: %d daddr: 0x%lx create: %s\n", \
+ b ? "KEEPING" : "TOSSING", (iip)->ii_inode, (iip)->ii_daddr, \
+ ctime((time_t *)&(iip)->ii_segcreate)); \
+ fflush(stdout); \
+}
+
+#define PRINT_BINFO(bip) { \
+ (void)printf("\tinode: %d lbn: %d daddr: 0x%lx create: %s\n", \
+ (bip)->bi_inode, (bip)->bi_lbn, (bip)->bi_daddr, \
+ ctime((time_t *)&(bip)->bi_segcreate)); \
+ fflush(stdout); \
+}
+
+#define PRINT_SEGUSE(sup, n) { \
+ (void)printf("Segment %d nbytes=%lu\tflags=%c%c%c ninos=%d nsums=%d lastmod: %s\n", \
+ n, (sup)->su_nbytes, \
+ (sup)->su_flags & SEGUSE_DIRTY ? 'D' : 'C', \
+ (sup)->su_flags & SEGUSE_ACTIVE ? 'A' : ' ', \
+ (sup)->su_flags & SEGUSE_SUPERBLOCK ? 'S' : ' ', \
+ (sup)->su_ninos, (sup)->su_nsums, \
+ ctime((time_t *)&(sup)->su_lastmod)); \
+ fflush(stdout); \
+}
+
+void dump_super __P((struct lfs *));
+void dump_cleaner_info __P((void *));
+void print_SEGSUM __P(( struct lfs *, SEGSUM *));
+void print_CLEANERINFO __P((CLEANERINFO *));
+#else
+#define PRINT_FINFO(fp, ip)
+#define PRINT_IINFO(b, iip)
+#define PRINT_BINFO(bip)
+#define PRINT_SEGUSE(sup, n)
+#define dump_cleaner_info(cip)
+#define dump_super(lfsp)
+#endif