1 /*
2 util.h -- amiga partition table headers.
3 Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 struct PartitionBlock {
20 uint32_t pb_ID; /* Identifier 32 bit word : 'PART' */
21 uint32_t pb_SummedLongs; /* Size of the structure for checksums */
22 int32_t pb_ChkSum; /* Checksum of the structure */
23 uint32_t pb_HostID; /* SCSI Target ID of host, not really used */
24 uint32_t pb_Next; /* Block number of the next PartitionBlock */
25 uint32_t pb_Flags; /* Part Flags (NOMOUNT and BOOTABLE) */
26 uint32_t pb_Reserved1[2];
27 uint32_t pb_DevFlags; /* Preferred flags for OpenDevice */
28 uint8_t pb_DriveName[32]; /* Preferred DOS device name: BSTR form */
29 uint32_t pb_Reserved2[15];
30 uint32_t de_TableSize; /* Size of Environment vector */
31 uint32_t de_SizeBlock; /* Size of the blocks in 32 bit words, usually 128 */
32 uint32_t de_SecOrg; /* Not used; must be 0 */
33 uint32_t de_Surfaces; /* Number of heads (surfaces) */
34 uint32_t de_SectorPerBlock; /* Disk sectors per block, used with SizeBlock, usually 1 */
35 uint32_t de_BlocksPerTrack; /* Blocks per track. drive specific */
36 uint32_t de_Reserved; /* DOS reserved blocks at start of partition. */
37 uint32_t de_PreAlloc; /* DOS reserved blocks at end of partition */
38 uint32_t de_Interleave; /* Not used, usually 0 */
39 uint32_t de_LowCyl; /* First cylinder of the partition */
40 uint32_t de_HighCyl; /* Last cylinder of the partition */
41 uint32_t de_NumBuffers; /* Initial # DOS of buffers. */
42 uint32_t de_BufMemType; /* Type of mem to allocate for buffers */
43 uint32_t de_MaxTransfer; /* Max number of bytes to transfer at a time */
44 uint32_t de_Mask; /* Address Mask to block out certain memory */
45 int32_t de_BootPri; /* Boot priority for autoboot */
46 uint32_t de_DosType; /* Dostype of the file system */
47 uint32_t de_Baud; /* Baud rate for serial handler */
48 uint32_t de_Control; /* Control word for handler/filesystem */
49 uint32_t de_BootBlocks; /* Number of blocks containing boot code */
50 uint32_t pb_EReserved[12];
51 };
52
53 #define PART(pos) ((struct PartitionBlock *)(pos))
54
55 #define PBFB_BOOTABLE 0 /* this partition is intended to be bootable */
56 #define PBFF_BOOTABLE 1L /* (expected directories and files exist) */
57 #define PBFB_NOMOUNT 1 /* do not mount this partition (e.g. manually */
58 #define PBFF_NOMOUNT 2L /* mounted, but space reserved here) */
59
60 struct PartitionBlock * amiga_find_part (PedGeometry *geom, struct PartitionBlock *part);
61
62 struct AmigaIds {
63 uint32_t ID;
64 struct AmigaIds *next;
65 };
66
67 struct AmigaIds * _amiga_add_id (uint32_t id, struct AmigaIds *ids);
68 void _amiga_free_ids (struct AmigaIds *ids);
69 int _amiga_id_in_list (uint32_t id, struct AmigaIds *ids);
70