Subject: Swap beginning with cylinder 0
To: None <mouse@Collatz.McRCIM.McGill.EDU>
From: Ignatios Souvatzis <>
List: tech-kern
Date: 05/23/1996 12:50:03
   Date: Wed, 22 May 1996 20:48:35 -0400
   From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>

   After exchanging some email with Theo (Theo! gasp! :-) on the subject
   of this can of worms about reserving part of a swap area to avoid
   swapping over disk labels and the like, the alternative that seems best
   to me is to define a new ioctl for disk drivers.  If we call this
   ioctl, for the sake of argument, DIOCSWAPSKIP, then the idea is that
   the swap code does a DIOCSWAPSKIP on the swap device to find out how
   much it should skip.

   In my opinion, the only real choice is to push it off into the driver.
   The amount to reserve has to be specific to at least the port, since,
   for example, the Amiga uses a comparatively large amount of space, two
   tracks or something - or so I'm told - while the sun3 port uses a fixed

"Depends". AmigaOS uses (and we parse that to create a fake incore
disklabel) a linked (hm... treed ) list of magic'd, checksummed
blocks called the "RDB".

While HDTOOLBOX, when first setting up a raw disk, shows a default of
2 tracks (err... cylinders?), you can change this default to anything
you like before first writing the RDB out. I think the real values is
stored in the RDB header block.

Only limit is, that:

- the RDB header block has to be inside block 0..15 to be recognized
  (by magic number + checksum)

- you need one block per PART block (describes a partition), and one
  for some other stuff like partial bad block lists etc. PARTs form a
  linked list and are pointed to by the RDB header; 

- you need 1+N for LSEG's, which are (mostly) filesystem code for
  nonstandard filesystems, in case you want to be really sure that a
  partition with a nonstandard filsystem can be mounted after next
  native boot... and 1 block per alien filesystem description, which
  tells which partition types it applies to and which LSEGs to use for
  it in case no filesystem by that name is known yet.

Basically, you have to parse all the RDB structure to find out... I
think the data structure would even allow to alternate LSEG data with
partitions, or similar perversions.

The partitioning program (hdtoolbox) will see that it puts the first
partition beyond used RDB space (normally it just puts RDB stuff
inside the reserved cylinders and partitions out of it).

While we can use sdNc for normal filesystems (I'm not sure this works
for NetBSD-Amiga swap), and trash the RDB stuff while doing so, as
soon as be use more than the c partition, we need a RDB structure,
which normally ensures the 'b' partition (or other) doesn't overlap
the RDB stuff, so you should be save to use zero for real partitions,
or the saved cylinder offset (in case a valid RDB is found) for the C
partition, or just sit around, whine, and use 0 or panic if you use
'c' and no RDB is found.

	Ignatios Souvatzis