Index | Thread | Search

From:
Philip Guenther <guenther@gmail.com>
Subject:
Re: delete broken support for antique FFS images
To:
Tech-OpenBSD <tech@openbsd.org>
Date:
Sun, 7 Jan 2024 22:56:53 -0800

Download raw body.

Thread
On Mon, 1 Jan 2024, Philip Guenther wrote:
> The original 4.2(?)BSD FFS always put the 'value' of a symlink in a data 
> block.  It was realized that 99+% of symlinks could be fit inside the 
> symlink's inode if you reusing the area where the direct and indirect 
> block addresses would normally be stored, so Kirk taught ffs to do that.  
> We had partial support for filesystems that used that old format, but I 
> unintentionally broke it in the 64bit time_t work in early 2014, such that 
> since OpenBSD 5.5, we haven't handled fs with that old layout, at least on 
> little-endian systems.
> 
> So, since no one actually putting such filesystems to use noticed, it's 
> clearly time to completely disable support for them.

It was suggested off-list that since I'm already deleting the OFSFMT(), I 
could eliminate the first arg to DIRSIZ() too.

So, this is the bigger diff:
 * drop that DIRSIZ() argument as well as the OLDDIRFMT and NEWDIRFMT 
   macros
 * fs_maxsymlinklen is never zero, so delete tests of that in userland 
   code
 * FS_44INODEFMT is always #defined; delete #ifdef tests of it
 * in newfs, reject passing the -O option with a version of 0 and remove
   support for that.

Regarding that last one: the only actual uses of "newfs -O 0" I could find 
in cvs history were in
	sys/arch/i386/stand/Makefile
	distrib/vax/common/Makefile.inc

The use in the first was removed in 2014; the latter went away in 2016 
when vax support was retired.


This version has passed a full make build and make release on amd64.


Philip Guenther

Index: sys/ufs/ufs/dir.h
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ufs/dir.h,v
diff -u -p -r1.12 dir.h
--- sys/ufs/ufs/dir.h	4 May 2019 15:38:12 -0000	1.12
+++ sys/ufs/ufs/dir.h	7 Jan 2024 07:01:15 -0000
@@ -61,9 +61,9 @@
  * with null bytes.  All names are guaranteed null terminated.
  * The maximum length of a name in a directory is MAXNAMLEN.
  *
- * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
+ * The macro DIRSIZ(dp) gives the amount of space required to represent
  * a directory entry.  Free space in a directory is represented by
- * entries which have dp->d_reclen > DIRSIZ(fmt, dp).  All DIRBLKSIZ bytes
+ * entries which have dp->d_reclen > DIRSIZ(dp).  All DIRBLKSIZ bytes
  * in a directory block are claimed by the directory entries.  This
  * usually results in the last entry in a directory having a large
  * dp->d_reclen.  When entries are deleted from a directory, the
@@ -112,17 +112,8 @@ struct	direct {
 #define DIRECTSIZ(namlen)						\
 	((offsetof(struct direct, d_name) +				\
 	  ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3)
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-#define DIRSIZ(oldfmt, dp) \
-    ((oldfmt) ? \
-    ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_type+1 + 3) &~ 3)) : \
-    ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)))
-#else
-#define DIRSIZ(oldfmt, dp) \
+#define DIRSIZ(dp) \
     ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
-#endif
-#define OLDDIRFMT	1
-#define NEWDIRFMT	0
 
 /*
  * Template for manipulating directories.  Should use struct direct's,
@@ -138,20 +129,6 @@ struct dirtemplate {
 	int16_t		dotdot_reclen;
 	u_int8_t	dotdot_type;
 	u_int8_t	dotdot_namlen;
-	char		dotdot_name[4];	/* ditto */
-};
-
-/*
- * This is the old format of directories, sanz type element.
- */
-struct odirtemplate {
-	u_int32_t	dot_ino;
-	int16_t		dot_reclen;
-	u_int16_t	dot_namlen;
-	char		dot_name[4];	/* must be multiple of 4 */
-	u_int32_t	dotdot_ino;
-	int16_t		dotdot_reclen;
-	u_int16_t	dotdot_namlen;
 	char		dotdot_name[4];	/* ditto */
 };
 #endif /* !_DIR_H_ */
Index: sys/ufs/ufs/ufs_dirhash.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ufs/ufs_dirhash.c,v
diff -u -p -r1.42 ufs_dirhash.c
--- sys/ufs/ufs/ufs_dirhash.c	15 Mar 2019 05:42:38 -0000	1.42
+++ sys/ufs/ufs/ufs_dirhash.c	7 Jan 2024 07:00:55 -0000
@@ -50,7 +50,6 @@
 
 #define WRAPINCR(val, limit)	(((val) + 1 == (limit)) ? 0 : ((val) + 1))
 #define WRAPDECR(val, limit)	(((val) == 0) ? ((limit) - 1) : ((val) - 1))
-#define OFSFMT(ip)		((ip)->i_ump->um_maxsymlinklen == 0)
 #define BLKFREE2IDX(n)		((n) > DH_NFSTATS ? DH_NFSTATS : (n))
 
 int ufs_mindirhashsize;
@@ -112,7 +111,7 @@ ufsdirhash_build(struct inode *ip)
 
 	/* Check if we can/should use dirhash. */
 	if (ip->i_dirhash == NULL) {
-		if (DIP(ip, size) < ufs_mindirhashsize || OFSFMT(ip))
+		if (DIP(ip, size) < ufs_mindirhashsize)
 			return (-1);
 	} else {
 		/* Hash exists, but sysctls could have changed. */
@@ -224,7 +223,7 @@ ufsdirhash_build(struct inode *ip)
 				slot = WRAPINCR(slot, dh->dh_hlen);
 			dh->dh_hused++;
 			DH_ENTRY(dh, slot) = pos;
-			ufsdirhash_adjfree(dh, pos, -DIRSIZ(0, ep));
+			ufsdirhash_adjfree(dh, pos, -DIRSIZ(ep));
 		}
 		pos += ep->d_reclen;
 	}
@@ -430,7 +429,7 @@ restart:
 			/* Check for sequential access, and update offset. */
 			if (dh->dh_seqopt == 0 && dh->dh_seqoff == offset)
 				dh->dh_seqopt = 1;
-			dh->dh_seqoff = offset + DIRSIZ(0, dp);
+			dh->dh_seqoff = offset + DIRSIZ(dp);
 
 			*bpp = bp;
 			*offp = offset;
@@ -519,7 +518,7 @@ ufsdirhash_findfree(struct inode *ip, in
 			brelse(bp);
 			return (-1);
 		}
-		if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp))
+		if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(dp))
 			break;
 		i += dp->d_reclen;
 		dp = (struct direct *)((char *)dp + dp->d_reclen);
@@ -535,7 +534,7 @@ ufsdirhash_findfree(struct inode *ip, in
 	while (i < DIRBLKSIZ && freebytes < slotneeded) {
 		freebytes += dp->d_reclen;
 		if (dp->d_ino != 0)
-			freebytes -= DIRSIZ(0, dp);
+			freebytes -= DIRSIZ(dp);
 		if (dp->d_reclen == 0) {
 			brelse(bp);
 			return (-1);
@@ -627,7 +626,7 @@ ufsdirhash_add(struct inode *ip, struct 
 	DH_ENTRY(dh, slot) = offset;
 
 	/* Update the per-block summary info. */
-	ufsdirhash_adjfree(dh, offset, -DIRSIZ(0, dirp));
+	ufsdirhash_adjfree(dh, offset, -DIRSIZ(dirp));
 	DIRHASH_UNLOCK(dh);
 }
 
@@ -660,7 +659,7 @@ ufsdirhash_remove(struct inode *ip, stru
 	ufsdirhash_delslot(dh, slot);
 
 	/* Update the per-block summary info. */
-	ufsdirhash_adjfree(dh, offset, DIRSIZ(0, dirp));
+	ufsdirhash_adjfree(dh, offset, DIRSIZ(dirp));
 	DIRHASH_UNLOCK(dh);
 }
 
@@ -835,7 +834,7 @@ ufsdirhash_checkblock(struct inode *ip, 
 		/* Check that the entry	exists (will panic if it doesn't). */
 		ufsdirhash_findslot(dh, dp->d_name, dp->d_namlen, offset + i);
 
-		nfree += dp->d_reclen - DIRSIZ(0, dp);
+		nfree += dp->d_reclen - DIRSIZ(dp);
 	}
 	if (i != DIRBLKSIZ)
 		panic("ufsdirhash_checkblock: bad dir end");
Index: sys/ufs/ufs/ufs_lookup.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ufs/ufs_lookup.c,v
diff -u -p -r1.59 ufs_lookup.c
--- sys/ufs/ufs/ufs_lookup.c	11 Jan 2022 03:13:59 -0000	1.59
+++ sys/ufs/ufs/ufs_lookup.c	7 Jan 2024 07:01:34 -0000
@@ -64,8 +64,6 @@ int	dirchk = 1;
 int	dirchk = 0;
 #endif
 
-#define OFSFMT(ip)	((ip)->i_ump->um_maxsymlinklen == 0)
-
 /*
  * Convert a component of a pathname into a pointer to a locked inode.
  * This is a very central and rather complicated routine.
@@ -299,7 +297,7 @@ searchloop:
 			int size = ep->d_reclen;
 
 			if (ep->d_ino != 0)
-				size -= DIRSIZ(OFSFMT(dp), ep);
+				size -= DIRSIZ(ep);
 			if (size > 0) {
 				if (size >= slotneeded) {
 					slotstatus = FOUND;
@@ -322,14 +320,7 @@ searchloop:
 		 * Check for a name match.
 		 */
 		if (ep->d_ino) {
-#			if (BYTE_ORDER == LITTLE_ENDIAN)
-				if (OFSFMT(dp))
-					namlen = ep->d_type;
-				else
-					namlen = ep->d_namlen;
-#			else
-				namlen = ep->d_namlen;
-#			endif
+			namlen = ep->d_namlen;
 			if (namlen == cnp->cn_namelen &&
 			    !memcmp(cnp->cn_nameptr, ep->d_name, namlen)) {
 #ifdef UFS_DIRHASH
@@ -440,9 +431,9 @@ found:
 	 * Check that directory length properly reflects presence
 	 * of this entry.
 	 */
-	if (dp->i_offset + DIRSIZ(OFSFMT(dp), ep) > DIP(dp, size)) {
+	if (dp->i_offset + DIRSIZ(ep) > DIP(dp, size)) {
 		ufs_dirbad(dp, dp->i_offset, "i_ffs_size too small");
-		DIP_ASSIGN(dp, size, dp->i_offset + DIRSIZ(OFSFMT(dp), ep));
+		DIP_ASSIGN(dp, size, dp->i_offset + DIRSIZ(ep));
 		dp->i_flag |= IN_CHANGE | IN_UPDATE;
 	}
 	brelse(bp);
@@ -626,17 +617,10 @@ ufs_dirbadentry(struct vnode *vdp, struc
 
 	dp = VTOI(vdp);
 
-#	if (BYTE_ORDER == LITTLE_ENDIAN)
-		if (OFSFMT(dp))
-			namlen = ep->d_type;
-		else
-			namlen = ep->d_namlen;
-#	else
-		namlen = ep->d_namlen;
-#	endif
+	namlen = ep->d_namlen;
 	if ((ep->d_reclen & 0x3) != 0 ||
 	    ep->d_reclen > DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1)) ||
-	    ep->d_reclen < DIRSIZ(OFSFMT(dp), ep) || namlen > MAXNAMLEN) {
+	    ep->d_reclen < DIRSIZ(ep) || namlen > MAXNAMLEN) {
 		/*return (1); */
 		printf("First bad\n");
 		goto bad;
@@ -674,15 +658,7 @@ ufs_makedirentry(struct inode *ip, struc
 	memset(newdirp->d_name + (cnp->cn_namelen & ~(DIR_ROUNDUP-1)),
 	    0, DIR_ROUNDUP);
 	memcpy(newdirp->d_name, cnp->cn_nameptr, cnp->cn_namelen);
-	if (OFSFMT(ip)) {
-		newdirp->d_type = 0;
-#		if (BYTE_ORDER == LITTLE_ENDIAN)
-			{ u_char tmp = newdirp->d_namlen;
-			newdirp->d_namlen = newdirp->d_type;
-			newdirp->d_type = tmp; }
-#		endif
-	} else
-		newdirp->d_type = IFTODT(DIP(ip, mode));
+	newdirp->d_type = IFTODT(DIP(ip, mode));
 }
   
 /*
@@ -712,7 +688,7 @@ ufs_direnter(struct vnode *dvp, struct v
 	cr = cnp->cn_cred;
 	p = cnp->cn_proc;
 	dp = VTOI(dvp);
-	newentrysize = DIRSIZ(OFSFMT(dp), dirp);
+	newentrysize = DIRSIZ(dirp);
 
 	if (dp->i_count == 0) {
 		/*
@@ -827,7 +803,7 @@ ufs_direnter(struct vnode *dvp, struct v
 	 * dp->i_offset + dp->i_count would yield the space.
 	 */
 	ep = (struct direct *)dirbuf;
-	dsize = ep->d_ino ? DIRSIZ(OFSFMT(dp), ep) : 0;
+	dsize = ep->d_ino ? DIRSIZ(ep) : 0;
 	spacefree = ep->d_reclen - dsize;
 	for (loc = ep->d_reclen; loc < dp->i_count; ) {
 		nep = (struct direct *)(dirbuf + loc);
@@ -852,7 +828,7 @@ ufs_direnter(struct vnode *dvp, struct v
 			dsize = 0;
 			continue;
 		}
-		dsize = DIRSIZ(OFSFMT(dp), nep);
+		dsize = DIRSIZ(nep);
 		spacefree += nep->d_reclen - dsize;
 #ifdef UFS_DIRHASH
 		if (dp->i_dirhash != NULL)
@@ -1030,8 +1006,7 @@ ufs_dirrewrite(struct inode *dp, struct 
 	if (error)
 		return (error);
 	ep->d_ino = newinum;
-	if (!OFSFMT(dp))
-		ep->d_type = newtype;
+	ep->d_type = newtype;
 	oip->i_effnlink--;
 	if (DOINGSOFTDEP(vdp)) {
 		softdep_change_linkcnt(oip, 0);
@@ -1087,14 +1062,7 @@ ufs_dirempty(struct inode *ip, ufsino_t 
 		if (dp->d_ino == 0)
 			continue;
 		/* accept only "." and ".." */
-#		if (BYTE_ORDER == LITTLE_ENDIAN)
-			if (OFSFMT(ip))
-				namlen = dp->d_type;
-			else
-				namlen = dp->d_namlen;
-#		else
-			namlen = dp->d_namlen;
-#		endif
+		namlen = dp->d_namlen;
 		if (namlen > 2)
 			return (0);
 		if (dp->d_name[0] != '.')
@@ -1145,14 +1113,7 @@ ufs_checkpath(struct inode *source, stru
 			IO_NODELOCKED, cred, NULL, curproc);
 		if (error != 0)
 			break;
-#		if (BYTE_ORDER == LITTLE_ENDIAN)
-			if (OFSFMT(VTOI(vp)))
-				namlen = dirbuf.dotdot_type;
-			else
-				namlen = dirbuf.dotdot_namlen;
-#		else
-			namlen = dirbuf.dotdot_namlen;
-#		endif
+		namlen = dirbuf.dotdot_namlen;
 		if (namlen != 2 ||
 		    dirbuf.dotdot_name[0] != '.' ||
 		    dirbuf.dotdot_name[1] != '.') {
Index: sys/ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ufs/ufs_vnops.c,v
diff -u -p -r1.158 ufs_vnops.c
--- sys/ufs/ufs/ufs_vnops.c	8 Sep 2023 20:00:28 -0000	1.158
+++ sys/ufs/ufs/ufs_vnops.c	2 Jan 2024 03:32:02 -0000
@@ -81,14 +81,10 @@ void filt_ufsdetach(struct knote *);
 /*
  * A virgin directory (no blushing please).
  */
-static struct dirtemplate mastertemplate = {
+static const struct dirtemplate mastertemplate = {
 	0, 12, DT_DIR, 1, ".",
 	0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
 };
-static struct odirtemplate omastertemplate = {
-	0, 12, 1, ".",
-	0, DIRBLKSIZ - 12, 2, ".."
-};
 
 /*
  * Update the times in the inode
@@ -1127,7 +1123,7 @@ ufs_mkdir(void *v)
 	struct vnode *tvp;
 	struct buf *bp;
 	struct direct newdir;
-	struct dirtemplate dirtemplate, *dtp;
+	struct dirtemplate dirtemplate;
 	int error, dmode, blkoff;
 
 #ifdef DIAGNOSTIC
@@ -1187,11 +1183,7 @@ ufs_mkdir(void *v)
 	/* 
 	 * Initialize directory with "." and ".." from static template.
 	 */
-	if (dp->i_ump->um_maxsymlinklen > 0)
-		dtp = &mastertemplate;
-	else
-		dtp = (struct dirtemplate *)&omastertemplate;
-	dirtemplate = *dtp;
+	dirtemplate = mastertemplate;
 	dirtemplate.dot_ino = ip->i_number;
 	dirtemplate.dotdot_ino = dp->i_number;
 
@@ -1411,9 +1403,6 @@ ufs_readdir(void *v)
 	caddr_t diskbuf;
 	size_t count, entries;
 	int bufsize, readcnt, error;
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-	int ofmt = VTOI(ap->a_vp)->i_ump->um_maxsymlinklen == 0;
-#endif
 
 	if (uio->uio_rw != UIO_READ)
 		return (EINVAL);
@@ -1468,16 +1457,8 @@ ufs_readdir(void *v)
 		off += dp->d_reclen;
 		u.dn.d_off = off;
 		u.dn.d_fileno = dp->d_ino;
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-		if (ofmt) {
-			u.dn.d_type = dp->d_namlen;
-			u.dn.d_namlen = dp->d_type;
-		} else
-#endif
-		{
-			u.dn.d_type = dp->d_type;
-			u.dn.d_namlen = dp->d_namlen;
-		}
+		u.dn.d_type = dp->d_type;
+		u.dn.d_namlen = dp->d_namlen;
 		memcpy(u.dn.d_name, dp->d_name, u.dn.d_namlen);
 		memset(u.dn.d_name + u.dn.d_namlen, 0, u.dn.d_reclen
 		    - u.dn.d_namlen - offsetof(struct dirent, d_name));
@@ -1513,10 +1494,8 @@ ufs_readlink(void *v)
 	u_int64_t isize;
 
 	isize = DIP(ip, size);
-	if (isize < ip->i_ump->um_maxsymlinklen ||
-	    (ip->i_ump->um_maxsymlinklen == 0 && DIP(ip, blocks) == 0)) {
+	if (isize < ip->i_ump->um_maxsymlinklen)
 		return (uiomove((char *)SHORTLINK(ip), isize, ap->a_uio));
-	}
 	return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
 }
 
Index: sys/ufs/ffs/ffs_inode.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ffs/ffs_inode.c,v
diff -u -p -r1.81 ffs_inode.c
--- sys/ufs/ffs/ffs_inode.c	12 Dec 2021 09:14:59 -0000	1.81
+++ sys/ufs/ffs/ffs_inode.c	2 Jan 2024 03:26:49 -0000
@@ -152,9 +152,7 @@ ffs_truncate(struct inode *oip, off_t le
 		return (0);
 
 	if (ovp->v_type == VLNK &&
-	    (DIP(oip, size) < oip->i_ump->um_maxsymlinklen ||
-	     (oip->i_ump->um_maxsymlinklen == 0 &&
-	      oip->i_din1->di_blocks == 0))) {
+	    DIP(oip, size) < oip->i_ump->um_maxsymlinklen) {
 #ifdef DIAGNOSTIC
 		if (length != 0)
 			panic("ffs_truncate: partial truncate of symlink");
Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ffs/ffs_vfsops.c,v
diff -u -p -r1.195 ffs_vfsops.c
--- sys/ufs/ffs/ffs_vfsops.c	5 Jul 2023 15:13:28 -0000	1.195
+++ sys/ufs/ffs/ffs_vfsops.c	2 Jan 2024 03:25:04 -0000
@@ -675,8 +675,8 @@ ffs_validate(struct fs *fsp)
 		return (0); /* Invalid number of fragments */
 
 	if (fsp->fs_inodefmt == FS_42INODEFMT)
-		fsp->fs_maxsymlinklen = 0;
-	else if (fsp->fs_maxsymlinklen < 0)
+		return (0); /* Obsolete format, support broken in 2014 */
+	if (fsp->fs_maxsymlinklen <= 0)
 		return (0); /* Invalid max size of short symlink */
 
 	return (1); /* Super block is okay */
Index: sys/ufs/ffs/ffs_vnops.c
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ffs/ffs_vnops.c,v
diff -u -p -r1.100 ffs_vnops.c
--- sys/ufs/ffs/ffs_vnops.c	26 Jun 2022 05:20:43 -0000	1.100
+++ sys/ufs/ffs/ffs_vnops.c	2 Jan 2024 03:28:01 -0000
@@ -202,8 +202,7 @@ ffs_read(void *v)
 		panic("ffs_read: mode");
 
 	if (vp->v_type == VLNK) {
-		if (DIP(ip, size) < ip->i_ump->um_maxsymlinklen ||
-		    (ip->i_ump->um_maxsymlinklen == 0 && DIP(ip, blocks) == 0))
+		if (DIP(ip, size) < ip->i_ump->um_maxsymlinklen)
 			panic("ffs_read: short symlink");
 	} else if (vp->v_type != VREG && vp->v_type != VDIR)
 		panic("ffs_read: type %d", vp->v_type);
Index: sys/ufs/ext2fs/ext2fs_dir.h
===================================================================
RCS file: /data/src/openbsd/src/sys/ufs/ext2fs/ext2fs_dir.h,v
diff -u -p -r1.11 ext2fs_dir.h
--- sys/ufs/ext2fs/ext2fs_dir.h	11 Jul 2014 07:59:04 -0000	1.11
+++ sys/ufs/ext2fs/ext2fs_dir.h	7 Jan 2024 07:00:32 -0000
@@ -61,9 +61,9 @@
  * with null bytes.  All names are guaranteed null terminated.
  * The maximum length of a name in a directory is EXT2FS_MAXNAMLEN.
  *
- * The macro EXT2FS_DIRSIZ(fmt, dp) gives the amount of space required to
+ * The macro EXT2FS_DIRSIZ(dp) gives the amount of space required to
  * represent a directory entry.  Free space in a directory is represented by
- * entries which have dp->e2d_reclen > DIRSIZ(fmt, dp).  All d2fs_bsize bytes
+ * entries which have dp->e2d_reclen > DIRSIZ(dp).  All d2fs_bsize bytes
  * in a directory block are claimed by the directory entries.  This
  * usually results in the last entry in a directory having a large
  * dp->e2d_reclen.  When entries are deleted from a directory, the
Index: sbin/dump/main.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/dump/main.c,v
diff -u -p -r1.64 main.c
--- sbin/dump/main.c	18 Dec 2023 13:23:52 -0000	1.64
+++ sbin/dump/main.c	3 Jan 2024 01:13:18 -0000
@@ -455,11 +455,9 @@ main(int argc, char *argv[])
 	tp_bshift = ffs(TP_BSIZE) - 1;
 	if (TP_BSIZE != (1 << tp_bshift))
 		quit("TP_BSIZE (%d) is not a power of 2\n", TP_BSIZE);
-#ifdef FS_44INODEFMT
 	if (sblock->fs_magic == FS_UFS2_MAGIC ||
 	    sblock->fs_inodefmt >= FS_44INODEFMT)
 		spcl.c_flags |= DR_NEWINODEFMT;
-#endif
 	maxino = (ino_t)sblock->fs_ipg * sblock->fs_ncg;
 	mapsize = roundup(howmany(maxino, NBBY), TP_BSIZE);
 	usedinomap = calloc((unsigned) mapsize, sizeof(char));
Index: sbin/dump/traverse.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/dump/traverse.c,v
diff -u -p -r1.40 traverse.c
--- sbin/dump/traverse.c	8 Feb 2023 08:25:44 -0000	1.40
+++ sbin/dump/traverse.c	3 Jan 2024 01:01:40 -0000
@@ -547,13 +547,7 @@ dumpino(union dinode *dp, ino_t ino)
 		 * Check for short symbolic link.
 		 */
 		if (DIP(dp, di_size) > 0 &&
-#ifdef FS_44INODEFMT
-		    (DIP(dp, di_size) < sblock->fs_maxsymlinklen ||
-		     (sblock->fs_maxsymlinklen == 0 &&
-			 DIP(dp, di_blocks) == 0))) {
-#else
-		    DIP(dp, di_blocks) == 0) {
-#endif
+		    DIP(dp, di_size) < sblock->fs_maxsymlinklen) {
 			void *shortlink;
 
 			spcl.c_addr[0] = 1;
Index: sbin/fsck_ffs/dir.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/fsck_ffs/dir.c,v
diff -u -p -r1.33 dir.c
--- sbin/fsck_ffs/dir.c	8 Feb 2023 08:25:44 -0000	1.33
+++ sbin/fsck_ffs/dir.c	7 Jan 2024 06:58:55 -0000
@@ -52,10 +52,6 @@ struct	dirtemplate dirhead = {
 	0, 12, DT_DIR, 1, ".",
 	0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
 };
-struct	odirtemplate odirhead = {
-	0, 12, 1, ".",
-	0, DIRBLKSIZ - 12, 2, ".."
-};
 
 static int expanddir(union dinode *, char *);
 static void freedir(ino_t, ino_t);
@@ -210,7 +206,7 @@ dircheck(struct inodesc *idesc, struct d
 		return (0);
 	if (dp->d_ino == 0)
 		return (1);
-	size = DIRSIZ(0, dp);
+	size = DIRSIZ(dp);
 	namlen = dp->d_namlen;
 	type = dp->d_type;
 	if (dp->d_reclen < size ||
@@ -292,9 +288,9 @@ mkentry(struct inodesc *idesc)
 	int newlen, oldlen;
 
 	newent.d_namlen = strlen(idesc->id_name);
-	newlen = DIRSIZ(0, &newent);
+	newlen = DIRSIZ(&newent);
 	if (dirp->d_ino != 0)
-		oldlen = DIRSIZ(0, dirp);
+		oldlen = DIRSIZ(dirp);
 	else
 		oldlen = 0;
 	if (dirp->d_reclen - oldlen < newlen)
Index: sbin/fsck_ffs/inode.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/fsck_ffs/inode.c,v
diff -u -p -r1.50 inode.c
--- sbin/fsck_ffs/inode.c	13 Jul 2020 06:52:53 -0000	1.50
+++ sbin/fsck_ffs/inode.c	3 Jan 2024 01:02:17 -0000
@@ -71,8 +71,7 @@ ckinode(union dinode *dp, struct inodesc
 	idesc->id_filesize = DIP(dp, di_size);
 	mode = DIP(dp, di_mode) & IFMT;
 	if (mode == IFBLK || mode == IFCHR || (mode == IFLNK &&
-	    (DIP(dp, di_size) < sblock.fs_maxsymlinklen ||
-	     (sblock.fs_maxsymlinklen == 0 && DIP(dp, di_blocks) == 0))))
+	    DIP(dp, di_size) < sblock.fs_maxsymlinklen))
 		return (KEEPON);
 	if (sblock.fs_magic == FS_UFS1_MAGIC)
 		dino.dp1 = dp->dp1;
Index: sbin/fsck_ffs/pass1.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/fsck_ffs/pass1.c,v
diff -u -p -r1.47 pass1.c
--- sbin/fsck_ffs/pass1.c	13 Jul 2020 06:52:53 -0000	1.47
+++ sbin/fsck_ffs/pass1.c	3 Jan 2024 01:02:58 -0000
@@ -266,8 +266,7 @@ checkinode(ino_t inumber, struct inodesc
 		 * Fake ndb value so direct/indirect block checks below
 		 * will detect any garbage after symlink string.
 		 */
-		if (DIP(dp, di_size) < sblock.fs_maxsymlinklen ||
-		    (sblock.fs_maxsymlinklen == 0 && DIP(dp, di_blocks) == 0)) {
+		if (DIP(dp, di_size) < sblock.fs_maxsymlinklen) {
 			if (sblock.fs_magic == FS_UFS1_MAGIC)
 				ndb = howmany(DIP(dp, di_size),
 				    sizeof(int32_t));
Index: sbin/fsck_ffs/pass2.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/fsck_ffs/pass2.c,v
diff -u -p -r1.37 pass2.c
--- sbin/fsck_ffs/pass2.c	20 Jan 2015 18:22:21 -0000	1.37
+++ sbin/fsck_ffs/pass2.c	7 Jan 2024 06:58:59 -0000
@@ -283,7 +283,7 @@ pass2check(struct inodesc *idesc)
 	proto.d_type = DT_DIR;
 	proto.d_namlen = 1;
 	(void)strlcpy(proto.d_name, ".", sizeof proto.d_name);
-	entrysize = DIRSIZ(0, &proto);
+	entrysize = DIRSIZ(&proto);
 	if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) {
 		pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n",
 			dirp->d_name);
@@ -314,9 +314,9 @@ chk1:
 	proto.d_type = DT_DIR;
 	proto.d_namlen = 2;
 	(void)strlcpy(proto.d_name, "..", sizeof proto.d_name);
-	entrysize = DIRSIZ(0, &proto);
+	entrysize = DIRSIZ(&proto);
 	if (idesc->id_entryno == 0) {
-		n = DIRSIZ(0, dirp);
+		n = DIRSIZ(dirp);
 		if (dirp->d_reclen < n + entrysize)
 			goto chk2;
 		proto.d_reclen = dirp->d_reclen - n;
Index: sbin/fsdb/fsdb.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/fsdb/fsdb.c,v
diff -u -p -r1.35 fsdb.c
--- sbin/fsdb/fsdb.c	22 Jul 2022 09:04:44 -0000	1.35
+++ sbin/fsdb/fsdb.c	7 Jan 2024 06:59:23 -0000
@@ -601,7 +601,7 @@ chnamefunc(struct inodesc *idesc)
 	if (slotcount++ == desired) {
 		/* will name fit? */
 		testdir.d_namlen = strlen(idesc->id_name);
-		if (DIRSIZ(NEWDIRFMT, &testdir) <= dirp->d_reclen) {
+		if (DIRSIZ(&testdir) <= dirp->d_reclen) {
 			dirp->d_namlen = testdir.d_namlen;
 			strlcpy(dirp->d_name, idesc->id_name, sizeof dirp->d_name);
 			return STOP|ALTERED|FOUND;
Index: sbin/newfs/mkfs.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/newfs/mkfs.c,v
diff -u -p -r1.101 mkfs.c
--- sbin/newfs/mkfs.c	20 Jun 2020 07:49:04 -0000	1.101
+++ sbin/newfs/mkfs.c	7 Jan 2024 07:11:08 -0000
@@ -279,13 +279,8 @@ mkfs(struct partition *pp, char *fsys, i
 		sblock.fs_sblockloc = SBLOCK_UFS1;
 		sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
 		sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
-		if (Oflag == 0) {
-			sblock.fs_maxsymlinklen = 0;
-			sblock.fs_inodefmt = FS_42INODEFMT;
-		} else {
-			sblock.fs_maxsymlinklen = MAXSYMLINKLEN_UFS1;
-			sblock.fs_inodefmt = FS_44INODEFMT;
-		}
+		sblock.fs_maxsymlinklen = MAXSYMLINKLEN_UFS1;
+		sblock.fs_inodefmt = FS_44INODEFMT;
 		sblock.fs_cgoffset = 0;
 		sblock.fs_cgmask = 0xffffffff;
 		sblock.fs_ffs1_size = sblock.fs_size;
@@ -778,15 +773,6 @@ struct direct root_dir[] = {
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 1, "." },
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
 };
-struct odirect {
-	u_int32_t d_ino;
-	u_int16_t d_reclen;
-	u_int16_t d_namlen;
-	u_char	d_name[MAXNAMLEN + 1];
-} oroot_dir[] = {
-	{ ROOTINO, sizeof(struct direct), 1, "." },
-	{ ROOTINO, sizeof(struct direct), 2, ".." },
-};
 
 int
 fsinit1(time_t utime, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
@@ -814,11 +800,7 @@ fsinit1(time_t utime, mode_t mfsmode, ui
 		node.dp1.di_gid = getegid();
 	}
 	node.dp1.di_nlink = PREDEFDIR;
-	if (Oflag == 0)
-		node.dp1.di_size = makedir((struct direct *)oroot_dir,
-		    PREDEFDIR);
-	else
-		node.dp1.di_size = makedir(root_dir, PREDEFDIR);
+	node.dp1.di_size = makedir(root_dir, PREDEFDIR);
 	node.dp1.di_db[0] = alloc(sblock.fs_fsize, node.dp1.di_mode);
 	if (node.dp1.di_db[0] == 0)
 		return (1);
@@ -919,13 +901,13 @@ makedir(struct direct *protodir, int ent
 
 	spcleft = DIRBLKSIZ;
 	for (cp = iobuf, i = 0; i < entries - 1; i++) {
-		protodir[i].d_reclen = DIRSIZ(0, &protodir[i]);
+		protodir[i].d_reclen = DIRSIZ(&protodir[i]);
 		memcpy(cp, &protodir[i], protodir[i].d_reclen);
 		cp += protodir[i].d_reclen;
 		spcleft -= protodir[i].d_reclen;
 	}
 	protodir[i].d_reclen = spcleft;
-	memcpy(cp, &protodir[i], DIRSIZ(0, &protodir[i]));
+	memcpy(cp, &protodir[i], DIRSIZ(&protodir[i]));
 	return (DIRBLKSIZ);
 }
 
Index: sbin/newfs/newfs.8
===================================================================
RCS file: /data/src/openbsd/src/sbin/newfs/newfs.8,v
diff -u -p -r1.79 newfs.8
--- sbin/newfs/newfs.8	19 Nov 2022 08:02:11 -0000	1.79
+++ sbin/newfs/newfs.8	7 Jan 2024 07:12:28 -0000
@@ -186,11 +186,6 @@ without really creating the file system.
 Select the filesystem format:
 .Pp
 .Bl -tag -width 3n -offset indent -compact
-.It 0
-.Bx 4.3
-format file system.
-This option is primarily used to build root file systems that can
-be understood by older boot ROMs.
 .It 1
 Fast File System (FFS), the default for
 .Nm mount_mfs .
Index: sbin/newfs/newfs.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/newfs/newfs.c,v
diff -u -p -r1.117 newfs.c
--- sbin/newfs/newfs.c	4 Dec 2022 23:50:47 -0000	1.117
+++ sbin/newfs/newfs.c	7 Jan 2024 07:11:43 -0000
@@ -121,7 +121,7 @@ u_short	dkcksum(struct disklabel *);
 
 int	mfs;			/* run as the memory based filesystem */
 int	Nflag;			/* run without writing file system */
-int	Oflag = 2;		/* 0 = 4.3BSD ffs, 1 = 4.4BSD ffs, 2 = ffs2 */
+int	Oflag = 2;		/* 1 = 4.4BSD ffs, 2 = ffs2 */
 daddr_t	fssize;			/* file system size in 512-byte blocks */
 long long	sectorsize;		/* bytes/sector */
 int	fsize = 0;		/* fragment size */
@@ -211,7 +211,7 @@ main(int argc, char *argv[])
 			Nflag = 1;
 			break;
 		case 'O':
-			Oflag = strtonum(optarg, 0, 2, &errstr);
+			Oflag = strtonum(optarg, 1, 2, &errstr);
 			if (errstr)
 				fatal("%s: invalid ffs version", optarg);
 			oflagset = 1;
Index: sbin/restore/dirs.c
===================================================================
RCS file: /data/src/openbsd/src/sbin/restore/dirs.c,v
diff -u -p -r1.42 dirs.c
--- sbin/restore/dirs.c	28 Jun 2019 13:32:46 -0000	1.42
+++ sbin/restore/dirs.c	7 Jan 2024 06:59:45 -0000
@@ -175,7 +175,7 @@ extractdirs(int genmode)
 	nulldir.d_namlen = 1;
 	nulldir.d_name[0] = '/';
 	nulldir.d_name[1] = '\0';
-	nulldir.d_reclen = DIRSIZ(0, &nulldir);
+	nulldir.d_reclen = DIRSIZ(&nulldir);
 	for (;;) {
 		curfile.name = "<directory file - name unknown>";
 		curfile.action = USING;
@@ -364,17 +364,17 @@ putdir(char *buf, size_t size)
 			i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1));
 			if ((dp->d_reclen & 0x3) != 0 ||
 			    dp->d_reclen > i ||
-			    dp->d_reclen < DIRSIZ(0, dp) ||
+			    dp->d_reclen < DIRSIZ(dp) ||
 			    dp->d_namlen > NAME_MAX) {
 				Vprintf(stdout, "Mangled directory: ");
 				if ((dp->d_reclen & 0x3) != 0)
 					Vprintf(stdout,
 					   "reclen not multiple of 4 ");
-				if (dp->d_reclen < DIRSIZ(0, dp))
+				if (dp->d_reclen < DIRSIZ(dp))
 					Vprintf(stdout,
 					   "reclen less than DIRSIZ (%u < %u) ",
 					   (unsigned)dp->d_reclen,
-					   (unsigned)DIRSIZ(0, dp));
+					   (unsigned)DIRSIZ(dp));
 				if (dp->d_namlen > NAME_MAX)
 					Vprintf(stdout,
 					   "reclen name too big (%u > %u) ",
@@ -404,7 +404,7 @@ long prev = 0;
 static void
 putent(struct direct *dp)
 {
-	dp->d_reclen = DIRSIZ(0, dp);
+	dp->d_reclen = DIRSIZ(dp);
 	if (dirloc + dp->d_reclen > DIRBLKSIZ) {
 		((struct direct *)(dirbuf + prev))->d_reclen =
 		    DIRBLKSIZ - prev;
@@ -440,7 +440,7 @@ dcvt(struct odirect *odp, struct direct 
 	ndp->d_type = DT_UNKNOWN;
 	(void)strncpy(ndp->d_name, odp->d_name, ODIRSIZ);
 	ndp->d_namlen = strlen(ndp->d_name);
-	ndp->d_reclen = DIRSIZ(0, ndp);
+	ndp->d_reclen = DIRSIZ(ndp);
 }
 
 /*
Index: usr.sbin/makefs/ffs.c
===================================================================
RCS file: /data/src/openbsd/src/usr.sbin/makefs/ffs.c,v
diff -u -p -r1.38 ffs.c
--- usr.sbin/makefs/ffs.c	8 Aug 2023 04:45:44 -0000	1.38
+++ usr.sbin/makefs/ffs.c	7 Jan 2024 07:01:48 -0000
@@ -550,9 +550,9 @@ ffs_size_dir(fsnode *root, fsinfo_t *fso
 
 #define	ADDDIRENT(e) do {						\
 	tmpdir.d_namlen = strlen((e));					\
-	this = DIRSIZ(NEWDIRFMT, &tmpdir);				\
-	if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ))	\
-		curdirsize = roundup(curdirsize, DIRBLKSIZ);	\
+	this = DIRSIZ(&tmpdir);						\
+	if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ))		\
+		curdirsize = roundup(curdirsize, DIRBLKSIZ);		\
 	curdirsize += this;						\
 } while (0);
 
@@ -887,12 +887,12 @@ ffs_make_dirbuf(dirbuf_t *dbuf, const ch
 	de.d_type = IFTODT(node->type);
 	de.d_namlen = (uint8_t)strlen(name);
 	strlcpy(de.d_name, name, sizeof de.d_name);
-	de.d_reclen = DIRSIZ(NEWDIRFMT, &de);
+	de.d_reclen = DIRSIZ(&de);
 
 	dp = (struct direct *)(dbuf->buf + dbuf->cur);
 	llen = 0;
 	if (dp != NULL)
-		llen = DIRSIZ(NEWDIRFMT, dp);
+		llen = DIRSIZ(dp);
 
 	if (de.d_reclen + dbuf->cur + llen > roundup(dbuf->size, DIRBLKSIZ)) {
 		newbuf = erealloc(dbuf->buf, dbuf->size + DIRBLKSIZ);