Module Name:    src
Committed By:   riastradh
Date:           Wed Jul  5 10:58:58 UTC 2023

Modified Files:
        src/sbin/newfs: mkfs.c newfs.c

Log Message:
Revert "newfs(8): Ensure A divides S before aligned_alloc(A, S)."

C17 lifted this restriction.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sbin/newfs/mkfs.c
cvs rdiff -u -r1.119 -r1.120 src/sbin/newfs/newfs.c

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

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.134 src/sbin/newfs/mkfs.c:1.135
--- src/sbin/newfs/mkfs.c:1.134	Tue Jul  4 20:40:34 2023
+++ src/sbin/newfs/mkfs.c	Wed Jul  5 10:58:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -201,11 +201,9 @@ mkfs(const char *fsys, int fi, int fo,
 			exit(12);
 	}
 #endif
-	__CTASSERT((sizeof(*fsun) % DEV_BSIZE) == 0);
 	if ((fsun = aligned_alloc(DEV_BSIZE, sizeof(*fsun))) == NULL)
 		exit(12);
 	memset(fsun, 0, sizeof(*fsun));
-	__CTASSERT((sizeof(*cgun) % DEV_BSIZE) == 0);
 	if ((cgun = aligned_alloc(DEV_BSIZE, sizeof(*cgun))) == NULL)
 		exit(12);
 	memset(cgun, 0, sizeof(*cgun));

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.119 src/sbin/newfs/newfs.c:1.120
--- src/sbin/newfs/newfs.c:1.119	Tue Jul  4 20:40:34 2023
+++ src/sbin/newfs/newfs.c	Wed Jul  5 10:58:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $	*/
+/*	$NetBSD: newfs.c,v 1.120 2023/07/05 10:58:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.120 2023/07/05 10:58:58 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -624,9 +624,7 @@ main(int argc, char *argv[])
 		} else
 			bufsize = sfs.f_iosize;
 
-		__CTASSERT(powerof2(DEV_BSIZE));
-		if ((buf = aligned_alloc(DEV_BSIZE,
-			    roundup2(bufsize, DEV_BSIZE))) == NULL)
+		if ((buf = aligned_alloc(DEV_BSIZE, bufsize)) == NULL)
 			err(1, "can't malloc buffer of %d",
 			bufsize);
 		memset(buf, 0, bufsize);

Reply via email to