Subject: Re: Item of future thought: disklabels
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 07/26/1996 13:40:31
On Fri, 26 Jul 1996, John F. Woods wrote:
: However, there's scarcely any point in mandating one byte order; the same
: code has to be written one way or the other, so you might as well handle the
: native/non-native case for all three common byte orders (how is the PDP-11
: port coming along, anyway? :-). The FFS file system has a magic number, which
: makes non-native byte order trival to detect.
Wow, since I've opened a Pandora's-box by starting this thread, I suppose I
should try to give some suggestions for the details of implementation.
* There's not just 'big-endian' and 'little-endian' out there. In the local
(yes, local, not in <machine/*.h> or <sys/*.h>) includes in, say,
src/sys/diskcompat, there should be byte-order macros for each endian
type, i.e.:
htoLl(x)
Ltohs(x)
Btohl(x)
htoMs(x) [middle-endian--PDP? :]
etc.
* Disklabels should be readable and writable in portable code, too, just
not necessarily *creatable*. There are some implementations (Amiga RDB,
for example) where the code is inherently read-only right now anyway,
because separate programs are needed to manipulate them. (i386 fdisk is
another good example, but there is an fdisk that runs under NetBSD.)
* ffs shouldn't become more incarnations of itself. The vfs system provides
us with a wonderful way of using alternate, not-so-radically-different
semantics inside the filesystem code. Just a '-o byteorder=little' handed
to mount_ffs should be sufficient to use the proper macros. And, of
course, autodetection in the mount vfsop for ffs to set this option for
the user if it isn't specified. (Possibly a warning message to syslog,
too, if the endianism isn't the same as native?)
* Of course, the common response: "If msdosfs can do byte-order swapping,
why not ffs too?" Well, not really swapping, but you get the picture.
=====
== Todd Vierling (Personal tv@pobox.com; Business tv@iag.net) Amiga lives! ==
== System administrator/technician, Internet Access Group, Orlando Florida ==
== Dialups in Orange, Volusia, Lake, Osceola counties - http://www.iag.net ==