Module Name:    src
Committed By:   dholland
Date:           Wed Aug 12 18:25:52 UTC 2015

Modified Files:
        src/libexec/lfs_cleanerd: coalesce.c lfs_cleanerd.c
        src/sbin/dump_lfs: lfs_inode.c
        src/sbin/fsck_lfs: inode.c lfs.c pass0.c pass1.c pass6.c segwrite.c
        src/sbin/newfs_lfs: make_lfs.c
        src/sys/lib/libsa: lfsv1.c lfsv2.c ufs.c
        src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_alloc.c lfs_itimes.c
            lfs_rfw.c lfs_segment.c lfs_syscalls.c lfs_vfsops.c
        src/usr.sbin/dumplfs: dumplfs.c

Log Message:
Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/libexec/lfs_cleanerd/coalesce.c
cvs rdiff -u -r1.46 -r1.47 src/libexec/lfs_cleanerd/lfs_cleanerd.c
cvs rdiff -u -r1.23 -r1.24 src/sbin/dump_lfs/lfs_inode.c
cvs rdiff -u -r1.57 -r1.58 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.52 -r1.53 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.38 -r1.39 src/sbin/fsck_lfs/pass0.c \
    src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.40 -r1.41 src/sbin/fsck_lfs/pass1.c
cvs rdiff -u -r1.37 -r1.38 src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.41 -r1.42 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libsa/lfsv1.c \
    src/sys/lib/libsa/lfsv2.c
cvs rdiff -u -r1.70 -r1.71 src/sys/lib/libsa/ufs.c
cvs rdiff -u -r1.175 -r1.176 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.125 -r1.126 src/sys/ufs/lfs/lfs_alloc.c
cvs rdiff -u -r1.17 -r1.18 src/sys/ufs/lfs/lfs_itimes.c
cvs rdiff -u -r1.25 -r1.26 src/sys/ufs/lfs/lfs_rfw.c
cvs rdiff -u -r1.252 -r1.253 src/sys/ufs/lfs/lfs_segment.c
cvs rdiff -u -r1.167 -r1.168 src/sys/ufs/lfs/lfs_syscalls.c
cvs rdiff -u -r1.336 -r1.337 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/dumplfs/dumplfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/coalesce.c
diff -u src/libexec/lfs_cleanerd/coalesce.c:1.30 src/libexec/lfs_cleanerd/coalesce.c:1.31
--- src/libexec/lfs_cleanerd/coalesce.c:1.30	Wed Aug 12 18:25:03 2015
+++ src/libexec/lfs_cleanerd/coalesce.c	Wed Aug 12 18:25:51 2015
@@ -1,4 +1,4 @@
-/*      $NetBSD: coalesce.c,v 1.30 2015/08/12 18:25:03 dholland Exp $  */
+/*      $NetBSD: coalesce.c,v 1.31 2015/08/12 18:25:51 dholland Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@ get_dinode(struct clfs *fs, ino_t ino)
 	struct ulfs1_dinode *dip, *r;
 
 	lfs_ientry(&ifp, fs, ino, &bp);
-	daddr = ifp->if_daddr;
+	daddr = lfs_if_getdaddr(fs, ifp);
 	brelse(bp, 0);
 
 	if (daddr == 0x0)

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.46 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.47
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.46	Wed Aug 12 18:25:03 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Wed Aug 12 18:25:51 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.46 2015/08/12 18:25:03 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.47 2015/08/12 18:25:51 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -342,10 +342,15 @@ reload_ifile(struct clfs *fs)
  * Get IFILE entry for the given inode, store in ifpp.	The buffer
  * which contains that data is returned in bpp, and must be brelse()d
  * by the caller.
+ *
+ * XXX this is cutpaste of LFS_IENTRY from lfs.h; unify the two.
  */
 void
 lfs_ientry(IFILE **ifpp, struct clfs *fs, ino_t ino, struct ubuf **bpp)
 {
+	IFILE64 *ifp64;
+	IFILE32 *ifp32;
+	IFILE_V1 *ifp_v1;
 	int error;
 
 	error = bread(fs->lfs_ivnode,
@@ -354,7 +359,19 @@ lfs_ientry(IFILE **ifpp, struct clfs *fs
 	if (error)
 		syslog(LOG_ERR, "%s: ientry failed for ino %d",
 			lfs_sb_getfsmnt(fs), (int)ino);
-	*ifpp = (IFILE *)(*bpp)->b_data + ino % lfs_sb_getifpb(fs);
+	if (fs->lfs_is64) {
+		ifp64 = (IFILE64 *)(*bpp)->b_data;
+		ifp64 += ino % lfs_sb_getifpb(fs);
+		*ifpp = (IFILE *)ifp64;
+	} else if (lfs_sb_getversion(fs) > 1) {
+		ifp32 = (IFILE32 *)(*bpp)->b_data;
+		ifp32 += ino % lfs_sb_getifpb(fs);
+		*ifpp = (IFILE *)ifp32;
+	} else {
+		ifp_v1 = (IFILE_V1 *)(*bpp)->b_data;
+		ifp_v1 += ino % lfs_sb_getifpb(fs);
+		*ifpp = (IFILE *)ifp_v1;
+	}
 	return;
 }
 
@@ -480,7 +497,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 				 */
 #ifndef REPAIR_ZERO_FINFO
 				lfs_ientry(&ifp, fs, dip[i].di_inumber, &ifbp);
-				idaddr = ifp->if_daddr;
+				idaddr = lfs_if_getdaddr(fs, ifp);
 				brelse(ifbp, 0);
 				if (idaddr != daddr)
 #endif
@@ -554,7 +571,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 		vers = -1;
 #else
 		lfs_ientry(&ifp, fs, fip->fi_ino, &ifbp);
-		vers = ifp->if_version;
+		vers = lfs_if_getversion(fs, ifp);
 		brelse(ifbp, 0);
 #endif
 		if (vers != fip->fi_version) {
@@ -1416,15 +1433,13 @@ lfs_cleaner_main(int argc, char **argv)
 	char *cp, *pidname;
 #endif
 
-#ifdef RESCUEDIR
+#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ == 8 && \
+    defined(__OPTIMIZE_SIZE__)
 	/*
 	 * XXX: Work around apparent bug with gcc 4.8 and -Os: it
 	 * claims that ci.clean is uninitialized in clean_fs (at one
 	 * of the several uses of it, which is neither the first nor
-	 * last use) -- this is conditionalized on RESCUEDIR because
-	 * it comes up for building the cleaner for /rescue. It
-	 * doesn't happen with plain -O2, and the value is clearly
-	 * always initialized.
+	 * last use) -- this doesn't happen with plain -O2.
 	 *
 	 * Hopefully in the future further rearrangements will allow
 	 * removing this hack.

Index: src/sbin/dump_lfs/lfs_inode.c
diff -u src/sbin/dump_lfs/lfs_inode.c:1.23 src/sbin/dump_lfs/lfs_inode.c:1.24
--- src/sbin/dump_lfs/lfs_inode.c:1.23	Sun Aug  2 18:18:09 2015
+++ src/sbin/dump_lfs/lfs_inode.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*      $NetBSD: lfs_inode.c,v 1.23 2015/08/02 18:18:09 dholland Exp $ */
+/*      $NetBSD: lfs_inode.c,v 1.24 2015/08/12 18:25:52 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c      8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: lfs_inode.c,v 1.23 2015/08/02 18:18:09 dholland Exp $");
+__RCSID("$NetBSD: lfs_inode.c,v 1.24 2015/08/12 18:25:52 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,8 +59,6 @@ __RCSID("$NetBSD: lfs_inode.c,v 1.23 201
 #include "dump.h"
 #undef di_inumber
 
-#define MAXIFPB        (MAXBSIZE / sizeof(IFILE))
-
 #define	HASDUMPEDFILE	0x1
 #define	HASSUBDIRS	0x2
 
@@ -278,15 +276,16 @@ lfs_bmap(struct lfs *fs, struct ulfs1_di
 	return (daddr_t)((int32_t *)bp)[off];
 }
 
-static struct ifile *
+static IFILE *
 lfs_ientry(ino_t ino)
 {
-	static struct ifile ifileblock[MAXIFPB];
+	static char ifileblock[MAXBSIZE];
 	static daddr_t ifblkno;
 	daddr_t lbn;
 	daddr_t blkno;
 	union dinode *dp;
 	struct ulfs1_dinode *ldp;
+	unsigned index;
     
 	lbn = ino/lfs_sb_getifpb(sblock) + lfs_sb_getcleansz(sblock) + lfs_sb_getsegtabsz(sblock);
 	dp = getino(lfs_sb_getifile(sblock));
@@ -294,9 +293,16 @@ lfs_ientry(ino_t ino)
 	ldp = (struct ulfs1_dinode *)dp;
 	blkno = lfs_bmap(sblock, ldp ,lbn);
 	if (blkno != ifblkno)
-		bread(LFS_FSBTODB(sblock, blkno), (char *)ifileblock,
+		bread(LFS_FSBTODB(sblock, blkno), ifileblock,
 		    lfs_sb_getbsize(sblock));
-	return ifileblock + (ino % lfs_sb_getifpb(sblock));
+	index = ino % lfs_sb_getifpb(sblock);
+	if (sblock->lfs_is64) {
+		return (IFILE *) &((IFILE64 *)ifileblock)[index];
+	} else if (lfs_sb_getversion(sblock) > 1) {
+		return (IFILE *) &((IFILE32 *)ifileblock)[index];
+	} else {
+		return (IFILE *) &((IFILE_V1 *)ifileblock)[index];
+	}
 }
 
 /* Search a block for a specific dinode. */
@@ -334,7 +340,7 @@ getino(ino_t inum)
 	}
 
 	curino = inum;
-	blkno = lfs_ientry(inum)->if_daddr;
+	blkno = lfs_if_getdaddr(sblock, lfs_ientry(inum));
 	if(blkno == LFS_UNUSED_DADDR)
 		return &empty_dinode;
 

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.57 src/sbin/fsck_lfs/inode.c:1.58
--- src/sbin/fsck_lfs/inode.c:1.57	Tue Jul 28 05:09:34 2015
+++ src/sbin/fsck_lfs/inode.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.57 2015/07/28 05:09:34 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.58 2015/08/12 18:25:52 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -104,6 +104,8 @@ ginode(ino_t ino)
 	struct uvnode *vp;
 	struct ubuf *bp;
 	IFILE *ifp;
+	daddr_t daddr;
+	unsigned segno;
 
 	vp = vget(fs, ino);
 	if (vp == NULL)
@@ -111,8 +113,10 @@ ginode(ino_t ino)
 
 	if (din_table[ino] == 0x0) {
 		LFS_IENTRY(ifp, fs, ino, bp);
-		din_table[ino] = ifp->if_daddr;
-		seg_table[lfs_dtosn(fs, ifp->if_daddr)].su_nbytes += LFS_DINODE1_SIZE;
+		daddr = lfs_if_getdaddr(fs, ifp);
+		segno = lfs_dtosn(fs, daddr);
+		din_table[ino] = daddr;
+		seg_table[segno].su_nbytes += LFS_DINODE1_SIZE;
 		brelse(bp, 0);
 	}
 	return (VTOI(vp)->i_din.ffs1_din);
@@ -458,13 +462,13 @@ clearinode(ino_t inumber)
 	/* Send cleared inode to the free list */
 
 	LFS_IENTRY(ifp, fs, inumber, bp);
-	daddr = ifp->if_daddr;
+	daddr = lfs_if_getdaddr(fs, ifp);
 	if (daddr == LFS_UNUSED_DADDR) {
 		brelse(bp, 0);
 		return;
 	}
-	ifp->if_daddr = LFS_UNUSED_DADDR;
-	ifp->if_nextfree = lfs_sb_getfreehd(fs);
+	lfs_if_setdaddr(fs, ifp, LFS_UNUSED_DADDR);
+	lfs_if_setnextfree(fs, ifp, lfs_sb_getfreehd(fs));
 	lfs_sb_setfreehd(fs, inumber);
 	sbdirty();
 	VOP_BWRITE(bp);

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.52 src/sbin/fsck_lfs/lfs.c:1.53
--- src/sbin/fsck_lfs/lfs.c:1.52	Sun Aug  2 18:18:09 2015
+++ src/sbin/fsck_lfs/lfs.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.52 2015/08/02 18:18:09 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.53 2015/08/12 18:25:52 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -415,7 +415,7 @@ lfs_vget(void *vfs, ino_t ino)
 	IFILE *ifp;
 
 	LFS_IENTRY(ifp, fs, ino, bp);
-	daddr = ifp->if_daddr;
+	daddr = lfs_if_getdaddr(fs, ifp);
 	brelse(bp, 0);
 	if (daddr <= 0 || lfs_dtosn(fs, daddr) >= lfs_sb_getnseg(fs))
 		return NULL;
@@ -864,7 +864,7 @@ struct uvnode *
 lfs_valloc(struct lfs *fs, ino_t ino)
 {
 	struct ubuf *bp, *cbp;
-	struct ifile *ifp;
+	IFILE *ifp;
 	ino_t new_ino;
 	int error;
 	CLEANERINFO *cip;
@@ -877,9 +877,9 @@ lfs_valloc(struct lfs *fs, ino_t ino)
 	 * of the free list into the superblock.
 	 */
 	LFS_IENTRY(ifp, fs, new_ino, bp);
-	if (ifp->if_daddr != LFS_UNUSED_DADDR)
+	if (lfs_if_getdaddr(fs, ifp) != LFS_UNUSED_DADDR)
 		panic("lfs_valloc: inuse inode %d on the free list", new_ino);
-	LFS_PUT_HEADFREE(fs, cip, cbp, ifp->if_nextfree);
+	LFS_PUT_HEADFREE(fs, cip, cbp, lfs_if_getnextfree(fs, ifp));
 
 	brelse(bp, 0);
 
@@ -910,7 +910,8 @@ extend_ifile(struct lfs *fs)
 {
 	struct uvnode *vp;
 	struct inode *ip;
-	IFILE *ifp;
+	IFILE64 *ifp64;
+	IFILE32 *ifp32;
 	IFILE_V1 *ifp_v1;
 	struct ubuf *bp, *cbp;
 	daddr_t i, blkno, max;
@@ -932,7 +933,23 @@ extend_ifile(struct lfs *fs)
 	max = i + lfs_sb_getifpb(fs);
 	lfs_sb_subbfree(fs, lfs_btofsb(fs, lfs_sb_getbsize(fs)));
 
-	if (lfs_sb_getversion(fs) == 1) {
+	if (fs->lfs_is64) {
+		for (ifp64 = (IFILE64 *)bp->b_data; i < max; ++ifp64) {
+			ifp64->if_version = 1;
+			ifp64->if_daddr = LFS_UNUSED_DADDR;
+			ifp64->if_nextfree = ++i;
+		}
+		ifp64--;
+		ifp64->if_nextfree = oldlast;
+	} else if (lfs_sb_getversion(fs) > 1) {
+		for (ifp32 = (IFILE32 *)bp->b_data; i < max; ++ifp32) {
+			ifp32->if_version = 1;
+			ifp32->if_daddr = LFS_UNUSED_DADDR;
+			ifp32->if_nextfree = ++i;
+		}
+		ifp32--;
+		ifp32->if_nextfree = oldlast;
+	} else {
 		for (ifp_v1 = (IFILE_V1 *)bp->b_data; i < max; ++ifp_v1) {
 			ifp_v1->if_version = 1;
 			ifp_v1->if_daddr = LFS_UNUSED_DADDR;
@@ -940,14 +957,6 @@ extend_ifile(struct lfs *fs)
 		}
 		ifp_v1--;
 		ifp_v1->if_nextfree = oldlast;
-	} else {
-		for (ifp = (IFILE *)bp->b_data; i < max; ++ifp) {
-			ifp->if_version = 1;
-			ifp->if_daddr = LFS_UNUSED_DADDR;
-			ifp->if_nextfree = ++i;
-		}
-		ifp--;
-		ifp->if_nextfree = oldlast;
 	}
 	LFS_PUT_TAILFREE(fs, cip, cbp, max - 1);
 

Index: src/sbin/fsck_lfs/pass0.c
diff -u src/sbin/fsck_lfs/pass0.c:1.38 src/sbin/fsck_lfs/pass0.c:1.39
--- src/sbin/fsck_lfs/pass0.c:1.38	Wed Aug 12 18:25:03 2015
+++ src/sbin/fsck_lfs/pass0.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pass0.c,v 1.38 2015/08/12 18:25:03 dholland Exp $	 */
+/* $NetBSD: pass0.c,v 1.39 2015/08/12 18:25:52 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -133,15 +133,15 @@ pass0(void)
 			if (preen || reply("FIX") == 1) {
 				/* plastino can't be zero */
 				LFS_IENTRY(ifp, fs, plastino, bp);
-				ifp->if_nextfree = 0;
+				lfs_if_setnextfree(fs, ifp, 0);
 				VOP_BWRITE(bp);
 			}
 			break;
 		}
 		visited[ino] = 1;
 		LFS_IENTRY(ifp, fs, ino, bp);
-		nextino = ifp->if_nextfree;
-		daddr = ifp->if_daddr;
+		nextino = lfs_if_getnextfree(fs, ifp);
+		daddr = lfs_if_getdaddr(fs, ifp);
 		brelse(bp, 0);
 		if (daddr) {
 			pwarn("INO %llu WITH DADDR 0x%llx ON FREE LIST\n",
@@ -152,7 +152,7 @@ pass0(void)
 					sbdirty();
 				} else {
 					LFS_IENTRY(ifp, fs, plastino, bp);
-					ifp->if_nextfree = nextino;
+					lfs_if_setnextfree(fs, ifp, nextino);
 					VOP_BWRITE(bp);
 				}
 				ino = nextino;
@@ -172,7 +172,7 @@ pass0(void)
 			continue;
 
 		LFS_IENTRY(ifp, fs, ino, bp);
-		if (ifp->if_daddr) {
+		if (lfs_if_getdaddr(fs, ifp)) {
 			brelse(bp, 0);
 			continue;
 		}
@@ -180,7 +180,7 @@ pass0(void)
 		    (unsigned long long)ino);
 		if (preen || reply("FIX") == 1) {
 			assert(ino != freehd);
-			ifp->if_nextfree = freehd;
+			lfs_if_setnextfree(fs, ifp, freehd);
 			VOP_BWRITE(bp);
 
 			freehd = ino;
Index: src/sbin/fsck_lfs/pass6.c
diff -u src/sbin/fsck_lfs/pass6.c:1.38 src/sbin/fsck_lfs/pass6.c:1.39
--- src/sbin/fsck_lfs/pass6.c:1.38	Sun Aug  2 18:08:12 2015
+++ src/sbin/fsck_lfs/pass6.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pass6.c,v 1.38 2015/08/02 18:08:12 dholland Exp $	 */
+/* $NetBSD: pass6.c,v 1.39 2015/08/12 18:25:52 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -210,6 +210,7 @@ static void
 remove_ino(struct uvnode *vp, ino_t ino)
 {
 	IFILE *ifp;
+	ino_t nextfree;
 	SEGUSE *sup;
 	CLEANERINFO *cip;
 	struct ubuf *bp, *sbp, *cbp;
@@ -220,11 +221,12 @@ remove_ino(struct uvnode *vp, ino_t ino)
 		pwarn("remove ino %d\n", (int)ino);
 
 	LFS_IENTRY(ifp, fs, ino, bp);
-	daddr = ifp->if_daddr;
+	daddr = lfs_if_getdaddr(fs, ifp);
 	if (daddr > 0) {
-		ifp->if_daddr = 0x0;
+		lfs_if_setdaddr(fs, ifp, 0);
 
-		LFS_GET_HEADFREE(fs, cip, cbp, &(ifp->if_nextfree));
+		LFS_GET_HEADFREE(fs, cip, cbp, &nextfree);
+		lfs_if_setnextfree(fs, ifp, nextfree);
 		VOP_BWRITE(bp);
 		LFS_PUT_HEADFREE(fs, cip, cbp, ino);
 		sbdirty();
@@ -431,9 +433,9 @@ readdress_inode(struct ulfs1_dinode *dp,
 
 	/* Move ifile pointer to this location */
 	LFS_IENTRY(ifp, fs, thisino, bp);
-	odaddr = ifp->if_daddr;
+	odaddr = lfs_if_getdaddr(fs, ifp);
 	assert(odaddr != 0);
-	ifp->if_daddr = daddr;
+	lfs_if_setdaddr(fs, ifp, daddr);
 	VOP_BWRITE(bp);
 
 	if (debug)
@@ -481,13 +483,13 @@ alloc_inode(ino_t thisino, ulfs_daddr_t 
 	}
 
 	LFS_IENTRY(ifp, fs, thisino, bp);
-	if (ifp->if_daddr != 0) {
+	if (lfs_if_getdaddr(fs, ifp) != 0) {
 		pwarn("allocated inode %lld already allocated\n",
 			(long long)thisino);
 	}
-	nextfree = ifp->if_nextfree;
-	ifp->if_nextfree = 0;
-	ifp->if_daddr = daddr;
+	nextfree = lfs_if_getnextfree(fs, ifp);
+	lfs_if_setnextfree(fs, ifp, 0);
+	lfs_if_setdaddr(fs, ifp, daddr);
 	VOP_BWRITE(bp);
 
 	LFS_GET_HEADFREE(fs, cip, cbp, &oldhead);
@@ -502,15 +504,15 @@ alloc_inode(ino_t thisino, ulfs_daddr_t 
 		ino = oldhead;
 		while (ino) {
 			LFS_IENTRY(ifp, fs, ino, bp);
-			assert(ifp->if_nextfree != ino);
-			if (ifp->if_nextfree == thisino) {
-				ifp->if_nextfree = nextfree;
+			assert(lfs_if_getnextfree(fs, ifp) != ino);
+			if (lfs_if_getnextfree(fs, ifp) == thisino) {
+				lfs_if_setnextfree(fs, ifp, nextfree);
 				VOP_BWRITE(bp);
 				if (nextfree == 0)
 					LFS_PUT_TAILFREE(fs, cip, cbp, ino);
 				break;
 			} else
-				ino = ifp->if_nextfree;
+				ino = lfs_if_getnextfree(fs, ifp);
 			brelse(bp, 0);
 		}
 	}

Index: src/sbin/fsck_lfs/pass1.c
diff -u src/sbin/fsck_lfs/pass1.c:1.40 src/sbin/fsck_lfs/pass1.c:1.41
--- src/sbin/fsck_lfs/pass1.c:1.40	Tue Jul 28 05:09:34 2015
+++ src/sbin/fsck_lfs/pass1.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pass1.c,v 1.40 2015/07/28 05:09:34 dholland Exp $	 */
+/* $NetBSD: pass1.c,v 1.41 2015/08/12 18:25:52 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -91,7 +91,7 @@ pass1(void)
 	int i;
 	struct inodesc idesc;
 	struct ulfs1_dinode *tinode;
-	struct ifile *ifp;
+	IFILE *ifp;
 	struct ubuf *bp;
 	struct ino_daddr **dins;
 
@@ -116,7 +116,7 @@ pass1(void)
 			dins[i]->daddr = lfs_sb_getidaddr(fs);
 		else {
 			LFS_IENTRY(ifp, fs, i, bp);
-			dins[i]->daddr = ifp->if_daddr;
+			dins[i]->daddr = lfs_if_getdaddr(fs, ifp);
 			brelse(bp, 0);
 		}
 	}
@@ -281,7 +281,7 @@ checkinode(ino_t inumber, struct inodesc
 	 */
 	if (dp->di_nlink <= 0) {
 		LFS_IENTRY(ifp, fs, inumber, bp);
-		if (ifp->if_nextfree == LFS_ORPHAN_NEXTFREE) {
+		if (lfs_if_getnextfree(fs, ifp) == LFS_ORPHAN_NEXTFREE) {
 			statemap[inumber] = (mode == LFS_IFDIR ? DCLEAR : FCLEAR);
 			/* Add this to our list of orphans */
 			zlnp = emalloc(sizeof *zlnp);

Index: src/sbin/fsck_lfs/segwrite.c
diff -u src/sbin/fsck_lfs/segwrite.c:1.37 src/sbin/fsck_lfs/segwrite.c:1.38
--- src/sbin/fsck_lfs/segwrite.c:1.37	Wed Aug 12 18:25:03 2015
+++ src/sbin/fsck_lfs/segwrite.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: segwrite.c,v 1.37 2015/08/12 18:25:03 dholland Exp $ */
+/* $NetBSD: segwrite.c,v 1.38 2015/08/12 18:25:52 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -216,7 +216,7 @@ lfs_writefile(struct lfs * fs, struct se
 	fip->fi_nblocks = 0;
 	fip->fi_ino = ip->i_number;
 	LFS_IENTRY(ifp, fs, fip->fi_ino, bp);
-	fip->fi_version = ifp->if_version;
+	fip->fi_version = lfs_if_getversion(fs, ifp);
 	brelse(bp, 0);
 
 	lfs_gather(fs, sp, vp, lfs_match_data);
@@ -323,7 +323,7 @@ lfs_writeinode(struct lfs * fs, struct s
 
 	/*
 	 * If updating the ifile, update the super-block.  Update the disk
-	 * address and access times for this inode in the ifile.
+	 * address for this inode in the ifile.
 	 */
 	ino = ip->i_number;
 	if (ino == LFS_IFILE_INUM) {
@@ -332,8 +332,8 @@ lfs_writeinode(struct lfs * fs, struct s
 		sbdirty();
 	} else {
 		LFS_IENTRY(ifp, fs, ino, ibp);
-		daddr = ifp->if_daddr;
-		ifp->if_daddr = LFS_DBTOFSB(fs, bp->b_blkno) + fsb;
+		daddr = lfs_if_getdaddr(fs, ifp);
+		lfs_if_setdaddr(fs, ifp, LFS_DBTOFSB(fs, bp->b_blkno) + fsb);
 		(void)LFS_BWRITE_LOG(ibp);	/* Ifile */
 	}
 

Index: src/sbin/newfs_lfs/make_lfs.c
diff -u src/sbin/newfs_lfs/make_lfs.c:1.41 src/sbin/newfs_lfs/make_lfs.c:1.42
--- src/sbin/newfs_lfs/make_lfs.c:1.41	Wed Aug 12 18:25:03 2015
+++ src/sbin/newfs_lfs/make_lfs.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_lfs.c,v 1.41 2015/08/12 18:25:03 dholland Exp $	*/
+/*	$NetBSD: make_lfs.c,v 1.42 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c	8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.41 2015/08/12 18:25:03 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.42 2015/08/12 18:25:52 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,7 +135,7 @@ static const struct dlfs dlfs32_default 
 		.dlfs_maxfilesize =	0,
 		.dlfs_fsbpseg =		0,
 		.dlfs_inopb =		DFL_LFSBLOCK/sizeof(struct ulfs1_dinode),
-		.dlfs_ifpb =		DFL_LFSBLOCK/sizeof(IFILE),
+		.dlfs_ifpb =		DFL_LFSBLOCK/sizeof(IFILE32),
 		.dlfs_sepb =		DFL_LFSBLOCK/sizeof(SEGUSE),
 		/* XXX ondisk32 */
 		.dlfs_nindir =		DFL_LFSBLOCK/sizeof(int32_t),
@@ -201,7 +201,7 @@ static const struct dlfs64 dlfs64_defaul
 		.dlfs_maxfilesize =	0,
 		.dlfs_fsbpseg =		0,
 		.dlfs_inopb =		DFL_LFSBLOCK/sizeof(struct ulfs1_dinode),
-		.dlfs_ifpb =		DFL_LFSBLOCK/sizeof(IFILE),
+		.dlfs_ifpb =		DFL_LFSBLOCK/sizeof(IFILE64),
 		.dlfs_sepb =		DFL_LFSBLOCK/sizeof(SEGUSE),
 		.dlfs_nindir =		DFL_LFSBLOCK/sizeof(int64_t),
 		.dlfs_nseg =		0,
@@ -365,7 +365,9 @@ make_lfs(int devfd, uint secsize, struct
 {
 	struct ulfs1_dinode *dip;	/* Pointer to a disk inode */
 	CLEANERINFO *cip;	/* Segment cleaner information table */
-	IFILE *ip;		/* Pointer to array of ifile structures */
+	IFILE *ipall;		/* Pointer to array of ifile structures */
+	IFILE64 *ip64 = NULL;
+	IFILE32 *ip32 = NULL;
 	IFILE_V1 *ip_v1 = NULL;
 	struct lfs *fs;		/* Superblock */
 	SEGUSE *segp;		/* Segment usage table */
@@ -803,25 +805,52 @@ make_lfs(int devfd, uint secsize, struct
 #endif /* MAKE_LF_DIR */
 
 	/* Set their IFILE entry version numbers to 1 */
-	LFS_IENTRY(ip, fs, 1, bp);
-	if (version == 1) {
-		ip_v1 = (IFILE_V1 *)ip;
+	LFS_IENTRY(ipall, fs, 1, bp);
+	if (is64) {
+		ip64 = &ipall->u_64;
+		for (i = LFS_IFILE_INUM; i <= HIGHEST_USED_INO; i++) {
+			ip64->if_version = 1;
+			ip64->if_daddr = 0x0;
+			ip64->if_nextfree = 0;
+			++ip64;
+		}
+	} else if (version > 1) {
+		ip32 = &ipall->u_32;
+		for (i = LFS_IFILE_INUM; i <= HIGHEST_USED_INO; i++) {
+			ip32->if_version = 1;
+			ip32->if_daddr = 0x0;
+			ip32->if_nextfree = 0;
+			++ip32;
+		}
+	} else {
+		ip_v1 = &ipall->u_v1;
 		for (i = LFS_IFILE_INUM; i <= HIGHEST_USED_INO; i++) {
 			ip_v1->if_version = 1;
 			ip_v1->if_daddr = 0x0;
 			ip_v1->if_nextfree = 0;
 			++ip_v1;
 		}
-	} else {
-		for (i = LFS_IFILE_INUM; i <= HIGHEST_USED_INO; i++) {
-			ip->if_version = 1;
-			ip->if_daddr = 0x0;
-			ip->if_nextfree = 0;
-			++ip;
-		}
 	}
 	/* Link remaining IFILE entries in free list */
-	if (version == 1) {
+	if (is64) {
+		for (;
+		     i < lfs_sb_getifpb(fs); ++ip64) {
+			ip64->if_version = 1;
+			ip64->if_daddr = LFS_UNUSED_DADDR;
+			ip64->if_nextfree = ++i;
+		}
+		--ip64;
+		ip64->if_nextfree = LFS_UNUSED_INUM;
+	} else if (version > 1) {
+		for (;
+		     i < lfs_sb_getifpb(fs); ++ip32) {
+			ip32->if_version = 1;
+			ip32->if_daddr = LFS_UNUSED_DADDR;
+			ip32->if_nextfree = ++i;
+		}
+		--ip32;
+		ip32->if_nextfree = LFS_UNUSED_INUM;
+	} else {
 		for (;
 		     i < lfs_sb_getifpb(fs); ++ip_v1) {
 			ip_v1->if_version = 1;
@@ -830,15 +859,6 @@ make_lfs(int devfd, uint secsize, struct
 		}
 		--ip_v1;
 		ip_v1->if_nextfree = LFS_UNUSED_INUM;
-	} else {
-		for (;
-		     i < lfs_sb_getifpb(fs); ++ip) {
-			ip->if_version = 1;
-			ip->if_daddr = LFS_UNUSED_DADDR;
-			ip->if_nextfree = ++i;
-		}
-		--ip;
-		ip->if_nextfree = LFS_UNUSED_INUM;
 	}
 	VOP_BWRITE(bp);
 

Index: src/sys/lib/libsa/lfsv1.c
diff -u src/sys/lib/libsa/lfsv1.c:1.12 src/sys/lib/libsa/lfsv1.c:1.13
--- src/sys/lib/libsa/lfsv1.c:1.12	Sun Aug  2 18:18:09 2015
+++ src/sys/lib/libsa/lfsv1.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfsv1.c,v 1.12 2015/08/02 18:18:09 dholland Exp $ */
+/* $NetBSD: lfsv1.c,v 1.13 2015/08/12 18:25:52 dholland Exp $ */
 
 #define	LIBSA_LFS
 #define	REQUIRED_LFS_VERSION	1
@@ -16,7 +16,6 @@
 #define ufs_dinode		ulfs1_dinode
 
 #define	fs_bsize		lfs_dlfs_u.u_32.dlfs_ibsize
-#define	IFILE_Vx		IFILE_V1
 
 #define	INOPBx(fs) LFS_INOPB(fs)
 
Index: src/sys/lib/libsa/lfsv2.c
diff -u src/sys/lib/libsa/lfsv2.c:1.12 src/sys/lib/libsa/lfsv2.c:1.13
--- src/sys/lib/libsa/lfsv2.c:1.12	Sun Aug  2 18:18:09 2015
+++ src/sys/lib/libsa/lfsv2.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfsv2.c,v 1.12 2015/08/02 18:18:09 dholland Exp $ */
+/* $NetBSD: lfsv2.c,v 1.13 2015/08/12 18:25:52 dholland Exp $ */
 
 #define	LIBSA_LFS
 #define	REQUIRED_LFS_VERSION	2
@@ -16,7 +16,6 @@
 #define ufs_dinode		ulfs1_dinode
 
 #define	fs_bsize		lfs_dlfs_u.u_32.dlfs_bsize
-#define	IFILE_Vx		IFILE
 
 #ifdef LFS_IFILE_FRAG_ADDRESSING	/* XXX see sys/ufs/lfs/ -- not tested */
 #define	INOPBx(fs) LFS_INOPF(fs)

Index: src/sys/lib/libsa/ufs.c
diff -u src/sys/lib/libsa/ufs.c:1.70 src/sys/lib/libsa/ufs.c:1.71
--- src/sys/lib/libsa/ufs.c:1.70	Sun Aug  2 18:18:09 2015
+++ src/sys/lib/libsa/ufs.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs.c,v 1.70 2015/08/02 18:18:09 dholland Exp $	*/
+/*	$NetBSD: ufs.c,v 1.71 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -212,24 +212,27 @@ find_inode_sector(ino32_t inumber, struc
 	daddr_t ifileent_blkno;
 	char *ent_in_buf;
 	size_t buf_after_ent;
+	size_t entsize;
 	int rc;
 
 	rc = read_inode(lfs_sb_getifile(fs), f);
 	if (rc)
 		return rc;
 
+	entsize = fs->lfs_is64 ? sizeof(IFILE64) :
+		(lfs_sb_getversion(fs) > 1 ? sizeof(IFILE32) : sizeof(IFILE_V1));
 	ifileent_blkno =
 	    (inumber / lfs_sb_getifpb(fs)) + lfs_sb_getcleansz(fs) + lfs_sb_getsegtabsz(fs);
 	fp->f_seekp = (off_t)ifileent_blkno * lfs_sb_getbsize(fs) +
-	    (inumber % lfs_sb_getifpb(fs)) * sizeof (IFILE_Vx);
+	    (inumber % lfs_sb_getifpb(fs)) * entsize;
 	rc = buf_read_file(f, &ent_in_buf, &buf_after_ent);
 	if (rc)
 		return rc;
 	/* make sure something's not badly wrong, but don't panic. */
-	if (buf_after_ent < sizeof (IFILE_Vx))
+	if (buf_after_ent < entsize)
 		return EINVAL;
 
-	*isp = FSBTODB(fs, ((IFILE_Vx *)ent_in_buf)->if_daddr);
+	*isp = FSBTODB(fs, lfs_if_getdaddr(fs, (IFILE *)ent_in_buf));
 	if (*isp == LFS_UNUSED_DADDR)	/* again, something badly wrong */
 		return EINVAL;
 	return 0;

Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.175 src/sys/ufs/lfs/lfs.h:1.176
--- src/sys/ufs/lfs/lfs.h:1.175	Wed Aug 12 18:25:04 2015
+++ src/sys/ufs/lfs/lfs.h	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.175 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.176 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
@@ -486,12 +486,26 @@ struct finfo {
 /*
  * Index file inode entries.
  */
-typedef struct ifile IFILE;
-struct ifile {
-	u_int32_t if_version;		/* inode version number */
+
+/* magic value for daddrs */
 #define	LFS_UNUSED_DADDR	0	/* out-of-band daddr */
-	int32_t	  if_daddr;		/* inode disk address */
+/* magic value for if_nextfree */
 #define LFS_ORPHAN_NEXTFREE	(~(u_int32_t)0) /* indicate orphaned file */
+
+typedef struct ifile64 IFILE64;
+struct ifile64 {
+	u_int32_t if_version;		/* inode version number */
+	u_int32_t if_pad;		/* 64-bit alignment padding */
+	int64_t	  if_daddr;		/* inode disk address */
+	u_int64_t if_nextfree;		/* next-unallocated inode */
+	u_int32_t if_atime_sec;		/* Last access time, seconds */
+	u_int32_t if_atime_nsec;	/* and nanoseconds */
+};
+
+typedef struct ifile32 IFILE32;
+struct ifile32 {
+	u_int32_t if_version;		/* inode version number */
+	int32_t	  if_daddr;		/* inode disk address */
 	u_int32_t if_nextfree;		/* next-unallocated inode */
 	u_int32_t if_atime_sec;		/* Last access time, seconds */
 	u_int32_t if_atime_nsec;	/* and nanoseconds */
@@ -503,11 +517,23 @@ struct ifile_v1 {
 	int32_t	  if_daddr;		/* inode disk address */
 	u_int32_t if_nextfree;		/* next-unallocated inode */
 #if LFS_ATIME_IFILE
+#error "this cannot work"
 	struct timespec if_atime;	/* Last access time */
 #endif
 };
 
 /*
+ * Note: struct ifile_v1 is often handled by accessing the first three
+ * fields of struct ifile32. (XXX: Blah.  This should be cleaned up as
+ * it may in some cases violate the strict-aliasing rules.)
+ */
+typedef union ifile {
+	struct ifile64 u_64;
+	struct ifile32 u_32;
+	struct ifile_v1 u_v1;
+} IFILE;
+
+/*
  * Cleaner information structure.  This resides in the ifile and is used
  * to pass information from the kernel to the cleaner.
  */

Index: src/sys/ufs/lfs/lfs_accessors.h
diff -u src/sys/ufs/lfs/lfs_accessors.h:1.9 src/sys/ufs/lfs/lfs_accessors.h:1.10
--- src/sys/ufs/lfs/lfs_accessors.h:1.9	Wed Aug 12 18:25:04 2015
+++ src/sys/ufs/lfs/lfs_accessors.h	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_accessors.h,v 1.9 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: lfs_accessors.h,v 1.10 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -289,14 +289,49 @@
 	(IN) / lfs_sb_getifpb(F) + lfs_sb_getcleansz(F) + lfs_sb_getsegtabsz(F), \
 	lfs_sb_getbsize(F), 0, &(BP))) != 0)				\
 		panic("lfs: ifile ino %d read %d", (int)(IN), _e);	\
-	if (lfs_sb_getversion(F) == 1)					\
+	if ((F)->lfs_is64) {						\
+		(IP) = (IFILE *)((IFILE64 *)(BP)->b_data +		\
+				 (IN) % lfs_sb_getifpb(F));		\
+	} else if (lfs_sb_getversion(F) > 1) {				\
+		(IP) = (IFILE *)((IFILE32 *)(BP)->b_data +		\
+				(IN) % lfs_sb_getifpb(F)); 		\
+	} else {							\
 		(IP) = (IFILE *)((IFILE_V1 *)(BP)->b_data +		\
 				 (IN) % lfs_sb_getifpb(F));		\
-	else								\
-		(IP) = (IFILE *)(BP)->b_data + (IN) % lfs_sb_getifpb(F); \
+	}								\
 	UNSHARE_IFLOCK(F);						\
 } while (0)
 
+#define LFS_DEF_IF_ACCESSOR(type, type32, field) \
+	static __unused inline type				\
+	lfs_if_get##field(STRUCT_LFS *fs, IFILE *ifp)		\
+	{							\
+		if (fs->lfs_is64) {				\
+			return ifp->u_64.if_##field; 		\
+		} else {					\
+			return ifp->u_32.if_##field; 		\
+		}						\
+	}							\
+	static __unused inline void				\
+	lfs_if_set##field(STRUCT_LFS *fs, IFILE *ifp, type val) \
+	{							\
+		if (fs->lfs_is64) {				\
+			type *p = &ifp->u_64.if_##field;	\
+			(void)p;				\
+			ifp->u_64.if_##field = val;		\
+		} else {					\
+			type32 *p = &ifp->u_32.if_##field;	\
+			(void)p;				\
+			ifp->u_32.if_##field = val;		\
+		}						\
+	}							\
+
+LFS_DEF_IF_ACCESSOR(u_int32_t, u_int32_t, version);
+LFS_DEF_IF_ACCESSOR(int64_t, int32_t, daddr);
+LFS_DEF_IF_ACCESSOR(u_int64_t, u_int32_t, nextfree);
+LFS_DEF_IF_ACCESSOR(u_int32_t, u_int32_t, atime_sec);
+LFS_DEF_IF_ACCESSOR(u_int32_t, u_int32_t, atime_nsec);
+
 /*
  * Cleaner information structure.  This resides in the ifile and is used
  * to pass information from the kernel to the cleaner.

Index: src/sys/ufs/lfs/lfs_alloc.c
diff -u src/sys/ufs/lfs/lfs_alloc.c:1.125 src/sys/ufs/lfs/lfs_alloc.c:1.126
--- src/sys/ufs/lfs/lfs_alloc.c:1.125	Sun Aug  2 18:14:16 2015
+++ src/sys/ufs/lfs/lfs_alloc.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_alloc.c,v 1.125 2015/08/02 18:14:16 dholland Exp $	*/
+/*	$NetBSD: lfs_alloc.c,v 1.126 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.125 2015/08/02 18:14:16 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.126 2015/08/12 18:25:52 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -116,7 +116,8 @@ lfs_extend_ifile(struct lfs *fs, kauth_c
 {
 	struct vnode *vp;
 	struct inode *ip;
-	IFILE *ifp;
+	IFILE64 *ifp64;
+	IFILE32 *ifp32;
 	IFILE_V1 *ifp_v1;
 	struct buf *bp, *cbp;
 	int error;
@@ -161,7 +162,25 @@ lfs_extend_ifile(struct lfs *fs, kauth_c
 #endif /* DIAGNOSTIC */
 	xmax = i + lfs_sb_getifpb(fs);
 
-	if (lfs_sb_getversion(fs) == 1) {
+	if (fs->lfs_is64) {
+		for (ifp64 = (IFILE64 *)bp->b_data; i < xmax; ++ifp64) {
+			SET_BITMAP_FREE(fs, i);
+			ifp64->if_version = 1;
+			ifp64->if_daddr = LFS_UNUSED_DADDR;
+			ifp64->if_nextfree = ++i;
+		}
+		ifp64--;
+		ifp64->if_nextfree = oldlast;
+	} else if (lfs_sb_getversion(fs) > 1) {
+		for (ifp32 = (IFILE32 *)bp->b_data; i < xmax; ++ifp32) {
+			SET_BITMAP_FREE(fs, i);
+			ifp32->if_version = 1;
+			ifp32->if_daddr = LFS_UNUSED_DADDR;
+			ifp32->if_nextfree = ++i;
+		}
+		ifp32--;
+		ifp32->if_nextfree = oldlast;
+	} else {
 		for (ifp_v1 = (IFILE_V1 *)bp->b_data; i < xmax; ++ifp_v1) {
 			SET_BITMAP_FREE(fs, i);
 			ifp_v1->if_version = 1;
@@ -170,15 +189,6 @@ lfs_extend_ifile(struct lfs *fs, kauth_c
 		}
 		ifp_v1--;
 		ifp_v1->if_nextfree = oldlast;
-	} else {
-		for (ifp = (IFILE *)bp->b_data; i < xmax; ++ifp) {
-			SET_BITMAP_FREE(fs, i);
-			ifp->if_version = 1;
-			ifp->if_daddr = LFS_UNUSED_DADDR;
-			ifp->if_nextfree = ++i;
-		}
-		ifp--;
-		ifp->if_nextfree = oldlast;
 	}
 	LFS_PUT_TAILFREE(fs, cip, cbp, xmax - 1);
 
@@ -196,7 +206,7 @@ lfs_valloc(struct vnode *pvp, int mode, 
 {
 	struct lfs *fs;
 	struct buf *bp, *cbp;
-	struct ifile *ifp;
+	IFILE *ifp;
 	int error;
 	CLEANERINFO *cip;
 
@@ -221,14 +231,15 @@ lfs_valloc(struct vnode *pvp, int mode, 
 	 */
 	CLR_BITMAP_FREE(fs, *ino);
 	LFS_IENTRY(ifp, fs, *ino, bp);
-	if (ifp->if_daddr != LFS_UNUSED_DADDR)
+	if (lfs_if_getdaddr(fs, ifp) != LFS_UNUSED_DADDR)
 		panic("lfs_valloc: inuse inode %" PRId64 " on the free list",
 		    *ino);
-	LFS_PUT_HEADFREE(fs, cip, cbp, ifp->if_nextfree);
-	DLOG((DLOG_ALLOC, "lfs_valloc: headfree %" PRId64 " -> %u\n",
-	     *ino, ifp->if_nextfree));
+	LFS_PUT_HEADFREE(fs, cip, cbp, lfs_if_getnextfree(fs, ifp));
+	DLOG((DLOG_ALLOC, "lfs_valloc: headfree %" PRId64 " -> %ju\n",
+	     *ino, (uintmax_t)lfs_if_getnextfree(fs, ifp)));
 
-	*gen = ifp->if_version; /* version was updated by vfree */
+	/* version was updated by vfree */
+	*gen = lfs_if_getversion(fs, ifp);
 	brelse(bp, 0);
 
 	/* Extend IFILE so that the next lfs_valloc will succeed. */
@@ -274,28 +285,31 @@ lfs_valloc_fixed(struct lfs *fs, ino_t i
 	}
 
 	LFS_IENTRY(ifp, fs, ino, bp);
-	oldnext = ifp->if_nextfree;
-	ifp->if_version = vers;
+	oldnext = lfs_if_getnextfree(fs, ifp);
+	lfs_if_setversion(fs, ifp, vers);
 	brelse(bp, 0);
 
 	LFS_GET_HEADFREE(fs, cip, cbp, &ino);
 	if (ino) {
 		LFS_PUT_HEADFREE(fs, cip, cbp, oldnext);
 	} else {
+		ino_t nextfree;
+
 		tino = ino;
 		while (1) {
 			LFS_IENTRY(ifp, fs, tino, bp);
-			if (ifp->if_nextfree == ino ||
-			    ifp->if_nextfree == LFS_UNUSED_INUM)
+			nextfree = lfs_if_getnextfree(fs, ifp);
+			if (nextfree == ino ||
+			    nextfree == LFS_UNUSED_INUM)
 				break;
-			tino = ifp->if_nextfree;
+			tino = nextfree;
 			brelse(bp, 0);
 		}
-		if (ifp->if_nextfree == LFS_UNUSED_INUM) {
+		if (nextfree == LFS_UNUSED_INUM) {
 			brelse(bp, 0);
 			return ENOENT;
 		}
-		ifp->if_nextfree = oldnext;
+		lfs_if_setnextfree(fs, ifp, oldnext);
 		LFS_BWRITE_LOG(bp);
 	}
 
@@ -375,7 +389,7 @@ lfs_vfree(struct vnode *vp, ino_t ino, i
 	SEGUSE *sup;
 	CLEANERINFO *cip;
 	struct buf *cbp, *bp;
-	struct ifile *ifp;
+	IFILE *ifp;
 	struct inode *ip;
 	struct lfs *fs;
 	daddr_t old_iaddr;
@@ -444,27 +458,33 @@ lfs_vfree(struct vnode *vp, ino_t ino, i
 	 */
 	SET_BITMAP_FREE(fs, ino);
 	LFS_IENTRY(ifp, fs, ino, bp);
-	old_iaddr = ifp->if_daddr;
-	ifp->if_daddr = LFS_UNUSED_DADDR;
-	++ifp->if_version;
+	old_iaddr = lfs_if_getdaddr(fs, ifp);
+	lfs_if_setdaddr(fs, ifp, LFS_UNUSED_DADDR);
+	lfs_if_setversion(fs, ifp, lfs_if_getversion(fs, ifp) + 1);
 	if (lfs_sb_getversion(fs) == 1) {
-		LFS_GET_HEADFREE(fs, cip, cbp, &(ifp->if_nextfree));
+		ino_t nextfree;
+
+		LFS_GET_HEADFREE(fs, cip, cbp, &nextfree);
+		lfs_if_setnextfree(fs, ifp, nextfree);
 		LFS_PUT_HEADFREE(fs, cip, cbp, ino);
 		(void) LFS_BWRITE_LOG(bp); /* Ifile */
 	} else {
 		ino_t tino, onf;
 
-		ifp->if_nextfree = LFS_UNUSED_INUM;
+		lfs_if_setnextfree(fs, ifp, LFS_UNUSED_INUM);
 		(void) LFS_BWRITE_LOG(bp); /* Ifile */
 
 		tino = lfs_freelist_prev(fs, ino);
 		if (tino == LFS_UNUSED_INUM) {
+			ino_t nextfree;
+
 			/* Nothing free below us, put us on the head */
 			LFS_IENTRY(ifp, fs, ino, bp);
-			LFS_GET_HEADFREE(fs, cip, cbp, &(ifp->if_nextfree));
+			LFS_GET_HEADFREE(fs, cip, cbp, &nextfree);
+			lfs_if_setnextfree(fs, ifp, nextfree);
 			LFS_PUT_HEADFREE(fs, cip, cbp, ino);
 			DLOG((DLOG_ALLOC, "lfs_vfree: headfree %lld -> %lld\n",
-			     (long long)ifp->if_nextfree, (long long)ino));
+			     (long long)nextfree, (long long)ino));
 			LFS_BWRITE_LOG(bp); /* Ifile */
 
 			/* If the list was empty, set tail too */
@@ -485,12 +505,12 @@ lfs_vfree(struct vnode *vp, ino_t ino, i
 			      " after %lld\n", ino, tino));
 
 			LFS_IENTRY(ifp, fs, tino, bp);
-			onf = ifp->if_nextfree;
-			ifp->if_nextfree = ino;
+			onf = lfs_if_getnextfree(fs, ifp);
+			lfs_if_setnextfree(fs, ifp, ino);
 			LFS_BWRITE_LOG(bp);	/* Ifile */
 
 			LFS_IENTRY(ifp, fs, ino, bp);
-			ifp->if_nextfree = onf;
+			lfs_if_setnextfree(fs, ifp, onf);
 			LFS_BWRITE_LOG(bp);	/* Ifile */
 
 			/* If we're last, put us on the tail */
@@ -574,30 +594,33 @@ lfs_order_freelist(struct lfs *fs)
 
 #ifdef notyet
 		/* Address orphaned files */
-		if (ifp->if_nextfree == LFS_ORPHAN_NEXTFREE &&
+		if (lfs_if_getnextfree(fs, ifp) == LFS_ORPHAN_NEXTFREE &&
 		    VFS_VGET(fs->lfs_ivnode->v_mount, ino, &vp) == 0) {
+			unsigned segno;
+
+			segno = lfs_dtosn(fs, lfs_if_getdaddr(fs, ifp));
 			lfs_truncate(vp, 0, 0, NOCRED);
 			vput(vp);
-			LFS_SEGENTRY(sup, fs, lfs_dtosn(fs, ifp->if_daddr), bp);
-			KASSERT(sup->su_nbytes >= DINODE1_SIZE);
-			sup->su_nbytes -= DINODE1_SIZE;
-			LFS_WRITESEGENTRY(sup, fs, lfs_dtosn(fs, ifp->if_daddr), bp);
+			LFS_SEGENTRY(sup, fs, segno, bp);
+			KASSERT(sup->su_nbytes >= LFS_DINODE1_SIZE);
+			sup->su_nbytes -= LFS_DINODE1_SIZE;
+			LFS_WRITESEGENTRY(sup, fs, segno, bp);
 
 			/* Set up to fall through to next section */
-			ifp->if_daddr = LFS_UNUSED_DADDR;
+			lfs_if_setdaddr(fs, ifp, LFS_UNUSED_DADDR);
 			LFS_BWRITE_LOG(bp);
 			LFS_IENTRY(ifp, fs, ino, bp);
 		}
 #endif
 
-		if (ifp->if_daddr == LFS_UNUSED_DADDR) {
+		if (lfs_if_getdaddr(fs, ifp) == LFS_UNUSED_DADDR) {
 			if (firstino == LFS_UNUSED_INUM)
 				firstino = ino;
 			else {
 				brelse(bp, 0);
 
 				LFS_IENTRY(ifp, fs, lastino, bp);
-				ifp->if_nextfree = ino;
+				lfs_if_setnextfree(fs, ifp, ino);
 				LFS_BWRITE_LOG(bp);
 				
 				LFS_IENTRY(ifp, fs, ino, bp);
@@ -624,6 +647,6 @@ lfs_orphan(struct lfs *fs, ino_t ino)
 	struct buf *bp;
 
 	LFS_IENTRY(ifp, fs, ino, bp);
-	ifp->if_nextfree = LFS_ORPHAN_NEXTFREE;
+	lfs_if_setnextfree(fs, ifp, LFS_ORPHAN_NEXTFREE);
 	LFS_BWRITE_LOG(bp);
 }

Index: src/sys/ufs/lfs/lfs_itimes.c
diff -u src/sys/ufs/lfs/lfs_itimes.c:1.17 src/sys/ufs/lfs/lfs_itimes.c:1.18
--- src/sys/ufs/lfs/lfs_itimes.c:1.17	Sun Aug  2 18:14:16 2015
+++ src/sys/ufs/lfs/lfs_itimes.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_itimes.c,v 1.17 2015/08/02 18:14:16 dholland Exp $	*/
+/*	$NetBSD: lfs_itimes.c,v 1.18 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_itimes.c,v 1.17 2015/08/02 18:14:16 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_itimes.c,v 1.18 2015/08/12 18:25:52 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -72,14 +72,14 @@ lfs_itimes(struct inode *ip, const struc
 #endif
 		ip->i_ffs1_atime = acc->tv_sec;
 		ip->i_ffs1_atimensec = acc->tv_nsec;
-		if (lfs_sb_getversion(ip->i_lfs) > 1) {
+		if (ip->i_lfs->lfs_is64 || lfs_sb_getversion(ip->i_lfs) > 1) {
 			struct lfs *fs = ip->i_lfs;
 			struct buf *ibp;
 			IFILE *ifp;
 
 			LFS_IENTRY(ifp, ip->i_lfs, ip->i_number, ibp);
-			ifp->if_atime_sec = acc->tv_sec;
-			ifp->if_atime_nsec = acc->tv_nsec;
+			lfs_if_setatime_sec(fs, ifp, acc->tv_sec);
+			lfs_if_setatime_nsec(fs, ifp, acc->tv_nsec);
 			LFS_BWRITE_LOG(ibp);
 			mutex_enter(&lfs_lock);
 			fs->lfs_flags |= LFS_IFDIRTY;

Index: src/sys/ufs/lfs/lfs_rfw.c
diff -u src/sys/ufs/lfs/lfs_rfw.c:1.25 src/sys/ufs/lfs/lfs_rfw.c:1.26
--- src/sys/ufs/lfs/lfs_rfw.c:1.25	Sun Aug  2 18:14:16 2015
+++ src/sys/ufs/lfs/lfs_rfw.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_rfw.c,v 1.25 2015/08/02 18:14:16 dholland Exp $	*/
+/*	$NetBSD: lfs_rfw.c,v 1.26 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.25 2015/08/02 18:14:16 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.26 2015/08/12 18:25:52 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -311,8 +311,8 @@ update_inoblk(struct lfs *fs, daddr_t of
 
 			/* Record change in location */
 			LFS_IENTRY(ifp, fs, dip->di_inumber, ibp);
-			daddr = ifp->if_daddr;
-			ifp->if_daddr = LFS_DBTOFSB(fs, dbp->b_blkno);
+			daddr = lfs_if_getdaddr(fs, ifp);
+			lfs_if_setdaddr(fs, ifp, LFS_DBTOFSB(fs, dbp->b_blkno));
 			error = LFS_BWRITE_LOG(ibp); /* Ifile */
 			/* And do segment accounting */
 			if (lfs_dtosn(fs, daddr) != lfs_dtosn(fs, LFS_DBTOFSB(fs, dbp->b_blkno))) {

Index: src/sys/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.252 src/sys/ufs/lfs/lfs_segment.c:1.253
--- src/sys/ufs/lfs/lfs_segment.c:1.252	Wed Aug 12 18:25:04 2015
+++ src/sys/ufs/lfs/lfs_segment.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.252 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.253 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.252 2015/08/12 18:25:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.253 2015/08/12 18:25:52 dholland Exp $");
 
 #define _VFS_VNODE_PRIVATE	/* XXX: check for VI_MARKER, this has to go */
 
@@ -953,8 +953,8 @@ lfs_update_iaddr(struct lfs *fs, struct 
 		lfs_sb_setidaddr(fs, LFS_DBTOFSB(fs, ndaddr));
 	} else {
 		LFS_IENTRY(ifp, fs, ino, bp);
-		daddr = ifp->if_daddr;
-		ifp->if_daddr = LFS_DBTOFSB(fs, ndaddr);
+		daddr = lfs_if_getdaddr(fs, ifp);
+		lfs_if_setdaddr(fs, ifp, LFS_DBTOFSB(fs, ndaddr));
 		(void)LFS_BWRITE_LOG(bp); /* Ifile */
 	}
 

Index: src/sys/ufs/lfs/lfs_syscalls.c
diff -u src/sys/ufs/lfs/lfs_syscalls.c:1.167 src/sys/ufs/lfs/lfs_syscalls.c:1.168
--- src/sys/ufs/lfs/lfs_syscalls.c:1.167	Wed Aug 12 18:25:04 2015
+++ src/sys/ufs/lfs/lfs_syscalls.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_syscalls.c,v 1.167 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: lfs_syscalls.c,v 1.168 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.167 2015/08/12 18:25:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.168 2015/08/12 18:25:52 dholland Exp $");
 
 #ifndef LFS
 # define LFS		/* for prototypes in syscallargs.h */
@@ -355,7 +355,7 @@ lfs_markv(struct lwp *l, fsid_t *fsidp, 
 			/* XXX but only write the inode if it's the right one */
 			if (blkp->bi_inode != LFS_IFILE_INUM) {
 				LFS_IENTRY(ifp, fs, blkp->bi_inode, bp);
-				if (ifp->if_daddr == blkp->bi_daddr) {
+				if (lfs_if_getdaddr(fs, ifp) == blkp->bi_daddr) {
 					mutex_enter(&lfs_lock);
 					LFS_SET_UINO(ip, IN_CLEANING);
 					mutex_exit(&lfs_lock);
@@ -697,7 +697,7 @@ lfs_bmapv(struct lwp *l, fsid_t *fsidp, 
 				v_daddr = lfs_sb_getidaddr(fs);
 			else {
 				LFS_IENTRY(ifp, fs, blkp->bi_inode, bp);
-				v_daddr = ifp->if_daddr;
+				v_daddr = lfs_if_getdaddr(fs, ifp);
 				brelse(bp, 0);
 			}
 			if (v_daddr == LFS_UNUSED_DADDR) {

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.336 src/sys/ufs/lfs/lfs_vfsops.c:1.337
--- src/sys/ufs/lfs/lfs_vfsops.c:1.336	Wed Aug 12 18:25:04 2015
+++ src/sys/ufs/lfs/lfs_vfsops.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.336 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.337 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.336 2015/08/12 18:25:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.337 2015/08/12 18:25:52 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1525,7 +1525,7 @@ lfs_loadvnode(struct mount *mp, struct v
 	struct ulfs1_dinode *dip;
 	struct inode *ip;
 	struct buf *bp;
-	struct ifile *ifp;
+	IFILE *ifp;
 	struct ulfsmount *ump;
 	ino_t ino;
 	daddr_t daddr;
@@ -1556,10 +1556,10 @@ lfs_loadvnode(struct mount *mp, struct v
 	else {
 		/* XXX bounds-check this too */
 		LFS_IENTRY(ifp, fs, ino, bp);
-		daddr = ifp->if_daddr;
+		daddr = lfs_if_getdaddr(fs, ifp);
 		if (lfs_sb_getversion(fs) > 1) {
-			ts.tv_sec = ifp->if_atime_sec;
-			ts.tv_nsec = ifp->if_atime_nsec;
+			ts.tv_sec = lfs_if_getatime_sec(fs, ifp);
+			ts.tv_nsec = lfs_if_getatime_nsec(fs, ifp);
 		}
 
 		brelse(bp, 0);

Index: src/usr.sbin/dumplfs/dumplfs.c
diff -u src/usr.sbin/dumplfs/dumplfs.c:1.50 src/usr.sbin/dumplfs/dumplfs.c:1.51
--- src/usr.sbin/dumplfs/dumplfs.c:1.50	Wed Aug 12 18:25:04 2015
+++ src/usr.sbin/dumplfs/dumplfs.c	Wed Aug 12 18:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumplfs.c,v 1.50 2015/08/12 18:25:04 dholland Exp $	*/
+/*	$NetBSD: dumplfs.c,v 1.51 2015/08/12 18:25:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)dumplfs.c	8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: dumplfs.c,v 1.50 2015/08/12 18:25:04 dholland Exp $");
+__RCSID("$NetBSD: dumplfs.c,v 1.51 2015/08/12 18:25:52 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -115,15 +115,23 @@ print_suentry(int i, SEGUSE *sp, struct 
 	(void)printf("inum\tstatus\tversion\tdaddr\t\tfreeptr\n")
 
 static inline void
-print_ientry(int i, IFILE *ip)
+print_ientry(int i, struct lfs *lfsp, IFILE *ip)
 {
-	if (ip->if_daddr == LFS_UNUSED_DADDR)
-		printf("%d\tFREE\t%d\t \t\t%llu\n", i, ip->if_version,
-		    (unsigned long long)ip->if_nextfree);
+	uint32_t version;
+	daddr_t daddr;
+	ino_t nextfree;
+
+	version = lfs_if_getversion(lfsp, ip);
+	daddr = lfs_if_getdaddr(lfsp, ip);
+	nextfree = lfs_if_getnextfree(lfsp, ip);
+
+	if (daddr == LFS_UNUSED_DADDR)
+		printf("%d\tFREE\t%u\t \t\t%ju\n", i, version,
+		    (uintmax_t)nextfree);
 	else
-		printf("%d\tINUSE\t%d\t%8X\t%s\n",
-		    i, ip->if_version, ip->if_daddr,
-		    (ip->if_nextfree == LFS_ORPHAN_NEXTFREE ? "FFFFFFFF" : "-"));
+		printf("%d\tINUSE\t%u\t%8jX\t%s\n",
+		    i, version, (intmax_t)daddr,
+		    nextfree == LFS_ORPHAN_NEXTFREE ? "FFFFFFFF" : "-");
 }
 
 #define fsbtobyte(fs, b)	lfs_fsbtob((fs), (off_t)((b)))
@@ -410,14 +418,16 @@ dump_ipage_ifile(struct lfs *lfsp, int i
 	char *ip;
 	int cnt, max, entsize;
 
-	if (lfs_sb_getversion(lfsp) == 1) 
-		entsize = sizeof(IFILE_V1);
+	if (lfsp->lfs_is64)
+		entsize = sizeof(IFILE64);
+	if (lfs_sb_getversion(lfsp) > 1) 
+		entsize = sizeof(IFILE32);
 	else 
-		entsize = sizeof(IFILE);
+		entsize = sizeof(IFILE_V1);
 	max = i + tot;
 
 	for (ip = pp, cnt = i; cnt < max; cnt++, ip += entsize)
-		print_ientry(cnt, (IFILE *)ip);
+		print_ientry(cnt, lfsp, (IFILE *)ip);
 	return (max);
 }
 

Reply via email to