Subject: FFS byteswapping
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/24/2001 17:12:26
fsck_ffs coredumped on me today.  On investigating, there appear to be
two bugs (setup.c expects ffs_sb_swap to work when the old and new sb
pointers are equal, and ffs_sb_swap mistakenly uses
ufs_rw32(n->...,ns).)

Now, the files I'm working with are
/*	$NetBSD: setup.c,v 1.37 1999/11/15 19:18:26 fvdl Exp $	*/
/*	$NetBSD: ffs_bswap.c,v 1.7 2000/01/18 18:41:29 bouyer Exp $	*/
and I wouldn't even bother mentioning this except that it looks to me
as though they haven't been fully fixed.

It appears that ffs_sb_swap now tries to work correctly even when both
arguments are the same (the third argument is now gone; ffs_sb_swap
deduces it itself).  But three lines from the end, I see it still doing
ufs_rw32(o->...,needswap), after swapping the field it's trying to
access.

Am I hallucinating, or is there still a bug here?  ISTM that
ufs_sb_swap should be caching pre-swap copies of cpc and nrpos same as
it does postbloff and postblfmt.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B