2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
9 #include "SupportDefs.h"
10 #include "ByteOrder.h"
13 struct rigid_disk_block
{
21 /* block list heads */
23 uint32 bad_block_list
;
24 uint32 partition_list
;
25 uint32 fs_header_list
;
28 uint32 __reserved1
[6];
30 /* physical drive characteristics */
37 uint32 __reserved2
[3];
38 uint32 write_precompensation
;
41 uint32 __reserved3
[5];
43 /* logical drive characteristics */
45 uint32 rdb_blocks_low
;
46 uint32 rdb_blocks_high
;
49 uint32 cylinder_blocks
;
50 uint32 auto_park_seconds
;
52 uint32 __reserved4
[2];
54 /* drive identification */
57 char disk_product
[16];
58 char disk_revision
[4];
59 char controller_vendor
[8];
60 char controller_product
[16];
61 char controller_revision
[4];
63 uint32 __reserved5
[10];
65 uint32
ID() const { return B_BENDIAN_TO_HOST_INT32(id
); }
66 uint32
SummedLongs() const { return B_BENDIAN_TO_HOST_INT32(summed_longs
); }
67 uint32
BlockSize() const { return B_BENDIAN_TO_HOST_INT32(block_size
); }
68 uint32
FirstPartition() const { return B_BENDIAN_TO_HOST_INT32(partition_list
); }
71 #define RDB_DISK_ID 'RDSK'
73 #define RDB_LOCATION_LIMIT 16
79 RDB_NO_RESELECT
= 0x08,
80 RDB_HAS_DISK_ID
= 0x10,
81 RDB_HAS_CONTROLLER_ID
= 0x20,
82 RDB_SUPPORTS_SYNCHRONOUS
= 0x40,
86 /************* bad blocks *************/
88 struct bad_block_entry
{
91 struct bad_block_block
{
94 #define RDB_BAD_BLOCK_ID 'BADB'
97 /************* partition block *************/
99 struct partition_block
{
106 uint32 __reserved1
[2];
107 uint32 open_device_flags
;
108 uint8 drive_name
[32]; // BSTR form (Pascal like string)
110 uint32 __reserved2
[15];
111 uint32 environment
[17];
112 uint32 __reserved3
[15];
114 uint32
ID() const { return B_BENDIAN_TO_HOST_INT32(id
); }
115 uint32
SummedLongs() const { return B_BENDIAN_TO_HOST_INT32(summed_longs
); }
116 uint32
Next() const { return B_BENDIAN_TO_HOST_INT32(next
); }
119 #define RDB_PARTITION_ID 'PART'
121 enum rdb_partition_flags
{
122 RDB_PARTITION_BOOTABLE
= 0x01,
123 RDB_PARTITION_NO_MOUNT
= 0x02,
127 /************* disk environment *************/
129 struct disk_environment
{
130 uint32 table_size
; // size of this environment
131 uint32 long_block_size
; // block size in longs (128 == 512 byte)
132 uint32 sec_org
; // always 0
134 uint32 sectors_per_block
;
135 uint32 blocks_per_track
;
136 uint32 reserved_blocks_at_start
;
137 uint32 reserved_blocks_at_end
;
139 uint32 first_cylinder
;
140 uint32 last_cylinder
;
142 uint32 buffer_mem_type
;
151 uint32
FirstCylinder() const { return B_BENDIAN_TO_HOST_INT32(first_cylinder
); }
152 uint32
LastCylinder() const { return B_BENDIAN_TO_HOST_INT32(last_cylinder
); }
153 uint32
Surfaces() const { return B_BENDIAN_TO_HOST_INT32(surfaces
); }
154 uint32
BlocksPerTrack() const { return B_BENDIAN_TO_HOST_INT32(blocks_per_track
); }
155 uint32
LongBlockSize() const { return B_BENDIAN_TO_HOST_INT32(long_block_size
); }
156 uint32
BlockSize() const { return LongBlockSize() << 2; }
160 return uint64(FirstCylinder()) * BlocksPerTrack() * Surfaces() * BlockSize();
165 return uint64(LastCylinder() + 1 - FirstCylinder()) * BlocksPerTrack() * Surfaces()
171 /************* file system header block *************/
173 struct fs_header_block
{
176 #define RDB_FS_HEADER_ID 'FSHD'
178 struct load_seg_block
{
181 #define RDB_LOAD_SEG_ID 'LSEG'
183 #endif /* AMIGA_RDB_H */