Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck_ffs Revert "fsck_ffs(8): Ensure A divides S before...
details: https://anonhg.NetBSD.org/src/rev/fa5d7dfd13de
branches: trunk
changeset: 377280:fa5d7dfd13de
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 05 10:59:08 2023 +0000
description:
Revert "fsck_ffs(8): Ensure A divides S before aligned_alloc(A, S)."
C17 lifted this restriction.
diffstat:
sbin/fsck_ffs/inode.c | 8 +++-----
sbin/fsck_ffs/setup.c | 16 +++++-----------
sbin/fsck_ffs/utilities.c | 13 ++++---------
3 files changed, 12 insertions(+), 25 deletions(-)
diffs (135 lines):
diff -r 42418cb67e66 -r fa5d7dfd13de sbin/fsck_ffs/inode.c
--- a/sbin/fsck_ffs/inode.c Wed Jul 05 10:58:58 2023 +0000
+++ b/sbin/fsck_ffs/inode.c Wed Jul 05 10:59:08 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.77 2023/07/04 20:40:53 riastradh Exp $ */
+/* $NetBSD: inode.c,v 1.78 2023/07/05 10:59:08 riastradh Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: inode.c,v 1.77 2023/07/04 20:40:53 riastradh Exp $");
+__RCSID("$NetBSD: inode.c,v 1.78 2023/07/05 10:59:08 riastradh Exp $");
#endif
#endif /* not lint */
@@ -462,10 +462,8 @@ setinodebuf(ino_t inum)
partialcnt = fullcnt;
partialsize = inobufsize;
}
- __CTASSERT(powerof2(DEV_BSIZE));
if (inodebuf == NULL &&
- (inodebuf = aligned_alloc(DEV_BSIZE,
- roundup2((unsigned)inobufsize, DEV_BSIZE))) == NULL)
+ (inodebuf = aligned_alloc(DEV_BSIZE, (unsigned)inobufsize)) == NULL)
errexit("Cannot allocate space for inode buffer");
}
diff -r 42418cb67e66 -r fa5d7dfd13de sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c Wed Jul 05 10:58:58 2023 +0000
+++ b/sbin/fsck_ffs/setup.c Wed Jul 05 10:59:08 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.108 2023/07/04 20:40:53 riastradh Exp $ */
+/* $NetBSD: setup.c,v 1.109 2023/07/05 10:59:08 riastradh Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
#else
-__RCSID("$NetBSD: setup.c,v 1.108 2023/07/04 20:40:53 riastradh Exp $");
+__RCSID("$NetBSD: setup.c,v 1.109 2023/07/05 10:59:08 riastradh Exp $");
#endif
#endif /* not lint */
@@ -127,7 +127,6 @@ setup(const char *dev, const char *origd
lfdir = 0;
initbarea(&sblk);
initbarea(&asblk);
- __CTASSERT((SBLOCKSIZE % DEV_BSIZE) == 0);
sblk.b_un.b_buf = aligned_alloc(DEV_BSIZE, SBLOCKSIZE);
sblock = aligned_alloc(DEV_BSIZE, SBLOCKSIZE);
asblk.b_un.b_buf = aligned_alloc(DEV_BSIZE, SBLOCKSIZE);
@@ -460,9 +459,8 @@ setup(const char *dev, const char *origd
* read in the summary info.
*/
asked = 0;
- __CTASSERT(powerof2(DEV_BSIZE));
sblock->fs_csp = (struct csum *)aligned_alloc(DEV_BSIZE,
- roundup2(sblock->fs_cssize, DEV_BSIZE));
+ sblock->fs_cssize);
if (sblock->fs_csp == NULL) {
pwarn("cannot alloc %u bytes for summary info\n",
sblock->fs_cssize);
@@ -497,9 +495,7 @@ setup(const char *dev, const char *origd
* allocate and initialize the necessary maps
*/
bmapsize = roundup(howmany(maxfsblock, NBBY), sizeof(int16_t));
- __CTASSERT(powerof2(DEV_BSIZE));
- blockmap = aligned_alloc(DEV_BSIZE,
- roundup2((unsigned)bmapsize, DEV_BSIZE));
+ blockmap = aligned_alloc(DEV_BSIZE, (unsigned)bmapsize);
if (blockmap == NULL) {
pwarn("cannot alloc %u bytes for blockmap\n",
(unsigned)bmapsize);
@@ -534,9 +530,7 @@ setup(const char *dev, const char *origd
(unsigned)(numdirs * sizeof(struct inoinfo *)));
goto badsblabel;
}
- __CTASSERT(powerof2(DEV_BSIZE));
- cgrp = aligned_alloc(DEV_BSIZE,
- roundup2(sblock->fs_cgsize, DEV_BSIZE));
+ cgrp = aligned_alloc(DEV_BSIZE, sblock->fs_cgsize);
if (cgrp == NULL) {
pwarn("cannot alloc %u bytes for cylinder group\n",
sblock->fs_cgsize);
diff -r 42418cb67e66 -r fa5d7dfd13de sbin/fsck_ffs/utilities.c
--- a/sbin/fsck_ffs/utilities.c Wed Jul 05 10:58:58 2023 +0000
+++ b/sbin/fsck_ffs/utilities.c Wed Jul 05 10:59:08 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utilities.c,v 1.70 2023/07/04 20:40:53 riastradh Exp $ */
+/* $NetBSD: utilities.c,v 1.71 2023/07/05 10:59:08 riastradh Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
#else
-__RCSID("$NetBSD: utilities.c,v 1.70 2023/07/04 20:40:53 riastradh Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.71 2023/07/05 10:59:08 riastradh Exp $");
#endif
#endif /* not lint */
@@ -135,15 +135,12 @@ bufinit(void)
char *bufp;
pbp = pdirbp = (struct bufarea *)0;
- __CTASSERT(powerof2(DEV_BSIZE));
- bufp = aligned_alloc(DEV_BSIZE,
- roundup2((unsigned int)sblock->fs_bsize, DEV_BSIZE));
+ bufp = aligned_alloc(DEV_BSIZE, (unsigned int)sblock->fs_bsize);
if (bufp == 0)
errexit("cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp;
initbarea(&cgblk);
#ifndef NO_APPLE_UFS
- __CTASSERT((APPLEUFS_LABEL_SIZE % DEV_BSIZE) == 0);
bufp = aligned_alloc(DEV_BSIZE, (unsigned int)APPLEUFS_LABEL_SIZE);
if (bufp == 0)
errexit("cannot allocate buffer pool");
@@ -156,9 +153,7 @@ bufinit(void)
bufcnt = MINBUFS;
for (i = 0; i < bufcnt; i++) {
bp = malloc(sizeof(struct bufarea));
- __CTASSERT(powerof2(DEV_BSIZE));
- bufp = aligned_alloc(DEV_BSIZE,
- roundup2((unsigned int)sblock->fs_bsize, DEV_BSIZE));
+ bufp = aligned_alloc(DEV_BSIZE, (unsigned int)sblock->fs_bsize);
if (bp == NULL || bufp == NULL) {
if (i >= MINBUFS) {
if (bp)
Home |
Main Index |
Thread Index |
Old Index