Subject: Re: bug #1
To: Jake Luck <netbsd@10k.org>
From: Chas Williams <chas@cmf.nrl.navy.mil>
List: port-macppc
Date: 03/15/2000 11:36:32
>TYPE Block0 = 
>PACKED RECORD
>   sbSig:         Integer;    {device signature}
>   sbBlkSize:     Integer;    {block size of the device}
>   sbBlkCount:    LongInt;    {number of blocks on the device}
>   sbDevType:     Integer;    {reserved}
>   sbDevId:       Integer;    {reserved}
>   sbData:        LongInt;    {reserved}
>   sbDrvrCount:   Integer;    {number of driver descriptor entries}
>   ddBlock:       LongInt;    {first driver's starting block}
>   ddSize:        Integer;    {size of the driver, in 512-byte blocks}
>   ddType:        Integer;    {operating system type (MacOS = 1)}
>   ddPad:         ARRAY [0..242] OF Integer; {additional drivers, if any}
>END;
>...
>puts the entire structure size to be 516 bytes rather than 512 bytes,
>larger thank a 512 block, if someone happens to do

well... i guess i disagree with the apple web site, from im, i have
been using the following struct in a little partition mangler i wrote:

struct DriverDescriptorMap
{
        short   sb_magic;               /* 0x4552 -- magic number */
        short   sb_blksiz;              /* size of blocks (in bytes) */
        long    sb_blks;                /* number of blocks on device */
        short   sb_type;                /* device type */
        short   sb_id;                  /* device id */
        long    sb_data;                /* ??? */
        short   sb_drvrs;               /* driver desciptor count */

        struct {
                short   offset; /* first block of driver */
                short   blks;   /* number of blocks in driver */
                short   type;   /* system type, MacOS = 1 */
        } dd[82];

#define dd_offset       dd[0].offset
#define dd_blks         dd[0].blks
#define dd_type         dd[0].type

};

so i think the ddBlock should be a short (meaning the partition must occur
very close to the beginning of the drive) and if i examine my disk
drive, i see:

twister# ./pm
        1. sd0 at scsibus0 targ 0 lun 0: <IBM, DORS-32160, WA6A>
sd0 selected
pm> list
    Name                     Type                        offset/len
 0. Apple                    Apple_partition_map              1/63       ( 0.0)
 1. FWB Disk Driver          Apple_Driver43                  64/1024     ( 0.5)
 2. MacOS                    Apple_HFS                     1088/131070   (64.0)
 3. Root file system         Apple_UNIX_SVR2             132158/131072   (64.0)
 4. Swap                     Apple_UNIX_SVR2             263230/131072   (64.0)
 5. Usr file system          Apple_UNIX_SVR2             394302/786432   (384.0)
 6. Random A/UX fs           Apple_UNIX_SVR2            1180734/131072   (64.0)
 7. Random A/UX fs           Apple_UNIX_SVR2            1311806/2097152  (1024.0
)
 8. Extra                    Apple_Free                 3408958/817767   (399.3)
pm> x
expert/extended mode is on
pm> driver
Signature: 0x4552 (Macintosh SCSI volume)
Blocksize: 512 bytes
Blocks:    4226725
Type:    0x0
ID:      0x0
Drivers: 1
        Offset:  0
        Blocks:  64
        Type:    0x0e

so i think it really should be a short.