Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/newfs Revert "newfs(8): Ensure A divides S before align...



details:   https://anonhg.NetBSD.org/src/rev/42418cb67e66
branches:  trunk
changeset: 377279:42418cb67e66
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 05 10:58:58 2023 +0000

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

C17 lifted this restriction.

diffstat:

 sbin/newfs/mkfs.c  |  6 ++----
 sbin/newfs/newfs.c |  8 +++-----
 2 files changed, 5 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r fed0df1930c2 -r 42418cb67e66 sbin/newfs/mkfs.c
--- a/sbin/newfs/mkfs.c Wed Jul 05 10:58:46 2023 +0000
+++ b/sbin/newfs/mkfs.c Wed Jul 05 10:58:58 2023 +0000
@@ -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));
diff -r fed0df1930c2 -r 42418cb67e66 sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c        Wed Jul 05 10:58:46 2023 +0000
+++ b/sbin/newfs/newfs.c        Wed Jul 05 10:58:58 2023 +0000
@@ -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 @@
 #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);



Home | Main Index | Thread Index | Old Index