diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2024-01-09 03:16:01 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2024-01-09 03:16:01 +0000 |
commit | 49761ad4bb9d44ec05c4ca9ac88cfc297c7e48ce (patch) | |
tree | ce66bc938e5e4f7fac1f0e77db057bc5bcfa2a4c /sbin/newfs | |
parent | 86838aa7e194992d35ddaeb9f3cd7b3388c5e9b3 (diff) |
Delete support for FFS filesystems before the in-inode symlink
optimization. As observed by ali_farzanrad(at)riseup.net, support
for these was broken in the 5.5 release in early 2014 by the time_t
changes. No one noticed before now, so clearly this isn't something
we need to continue to support; rejecting in ffs_validate() is an
improvement.
Also: simplify DIRSIZ(), drop OLDDIRFMT and NEWDIRFMT, tests of
fs_maxsymlinklen against zero, #ifdef tests of FS_44INODEFMT, and
remove support for newfs -O0, last used in 2016.
ok miod@
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/mkfs.c | 30 | ||||
-rw-r--r-- | sbin/newfs/newfs.8 | 9 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 6 |
3 files changed, 11 insertions, 34 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 266ab9538ee..321b83c8557 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.101 2020/06/20 07:49:04 otto Exp $ */ +/* $OpenBSD: mkfs.c,v 1.102 2024/01/09 03:16:00 guenther Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -279,13 +279,8 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode, 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, uid_t mfsuid, gid_t mfsgid) 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 entries) 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); } diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 2bf932ea0cb..2c509f205bd 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: newfs.8,v 1.79 2022/11/19 08:02:11 sthen Exp $ +.\" $OpenBSD: newfs.8,v 1.80 2024/01/09 03:16:00 guenther Exp $ .\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $ .\" .\" Copyright (c) 1983, 1987, 1991, 1993, 1994 @@ -30,7 +30,7 @@ .\" .\" @(#)newfs.8 8.3 (Berkeley) 3/27/94 .\" -.Dd $Mdocdate: November 19 2022 $ +.Dd $Mdocdate: January 9 2024 $ .Dt NEWFS 8 .Os .Sh NAME @@ -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 . diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 7ab691d78f0..4e07e6d790e 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.117 2022/12/04 23:50:47 cheloha Exp $ */ +/* $OpenBSD: newfs.c,v 1.118 2024/01/09 03:16:00 guenther Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -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; |