Fix two mistakes done in the UFS2 merge:

o Correct the order of arguments to ffs_read_disk_block; the second one
   is blocknumber to read, not the size to be read.  This would affect the
   UFS2 code, and is thus not much excercised at the moment.
 o The offsets in SBLOCKSEARCH are in bytes, but ffs_read_disk_block wants
   its location in terms of DEV_BSIZE blocks.  Fix this bug in ffs_match().
The latter together with the recent magic number fix to <ufs/ffs/fs.h>
fixes a cross build problem seen when doing a i386->sparc build.
This commit is contained in:
he 2003-04-05 11:30:53 +00:00
parent f8cf57f9b0
commit 798d0c8191

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs.c,v 1.10 2003/04/02 23:02:29 he Exp $ */
/* $NetBSD: ffs.c,v 1.11 2003/04/05 11:30:53 he Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: ffs.c,v 1.10 2003/04/02 23:02:29 he Exp $");
__RCSID("$NetBSD: ffs.c,v 1.11 2003/04/05 11:30:53 he Exp $");
#endif /* !__lint */
#include <sys/param.h>
@ -133,7 +133,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
assert(state != NULL);
/* Read the superblock. */
if (!ffs_read_disk_block(params, SBLOCKSIZE, params->fstype->sblockloc,
if (!ffs_read_disk_block(params, params->fstype->sblockloc, SBLOCKSIZE,
sbbuf))
return (0);
fs = (struct fs *)sbbuf;
@ -264,7 +264,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
assert(state != NULL);
/* Read the superblock. */
if (!ffs_read_disk_block(params, SBLOCKSIZE, params->fstype->sblockloc,
if (!ffs_read_disk_block(params, params->fstype->sblockloc, SBLOCKSIZE,
sbbuf))
return (0);
fs = (struct fs *)sbbuf;
@ -458,7 +458,7 @@ ffs_match(ib_params *params)
fs = (struct fs *)sbbuf;
for (i = 0; sblock_try[i] != -1; i++) {
loc = sblock_try[i];
loc = sblock_try[i] / DEV_BSIZE;
if (!ffs_read_disk_block(params, loc, SBLOCKSIZE, sbbuf))
continue;
switch (fs->fs_magic) {