Subject: Re: NeXT file systems
To: None <explorer@flame.org, mycroft@domino.org>
From: Charles M. Hannum <mycroft@domino.org>
List: current-users
Date: 02/08/1996 01:40:57
   >Just for the record, if someone wrote changes to byte-swap a FFS file
   >system automatically, and they didn't intrude on performance too much
   >for native byte-order file systems, I'd be quite happy to see them...

   What would be the best way?  Making them uniform across all platforms,
   same order for FFS?  Or perhaps only swap them when needed?  And put
   an option into newfs to create the byte-swapped flavors?

Well, we don't have the option of making the byte-order uniform, and
it would have a noticable performance impact on some machines (e.g.
old 386s), so that's really not an option.

It seems to me that you can do the following:

1) Detect the byte order at mount time.  This is easy.

2) When reading a cg, cgsum, inode, indirect, or directory block, swap
the byte order.

3) When writing the block back out, swap the byte order again.  If the
block is left in core, swap it back to native order after the write.

This certainly isn't an optimal way of doing it, but it has very low
impact on the existing system, and it could be argued that if you're
doing serious work you ought to be running with the native byte order.

Also, an option to newfs(8) to make a byte-swapped file system and an
option to fsck(8) to swap the byte order of an existing file system
would both be cool.  (Although the latter should have a *BIG* warning
to back up the file system first...)