btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / add-ons / kernel / partitioning_systems / amiga / amiga_rdb.h
blob2d60572dfc5fa35971914add39f3082c35cb809c
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 #ifndef AMIGA_RDB_H
6 #define AMIGA_RDB_H
9 #include "SupportDefs.h"
10 #include "ByteOrder.h"
13 struct rigid_disk_block {
14 uint32 id;
15 uint32 summed_longs;
16 int32 check_sum;
17 uint32 host_id;
18 uint32 block_size;
19 uint32 flags;
21 /* block list heads */
23 uint32 bad_block_list;
24 uint32 partition_list;
25 uint32 fs_header_list;
26 uint32 drive_init;
28 uint32 __reserved1[6];
30 /* physical drive characteristics */
32 uint32 cylinders;
33 uint32 sectors;
34 uint32 heads;
35 uint32 interleave;
36 uint32 park;
37 uint32 __reserved2[3];
38 uint32 write_precompensation;
39 uint32 reduced_write;
40 uint32 step_rate;
41 uint32 __reserved3[5];
43 /* logical drive characteristics */
45 uint32 rdb_blocks_low;
46 uint32 rdb_blocks_high;
47 uint32 low_cylinder;
48 uint32 high_cylinder;
49 uint32 cylinder_blocks;
50 uint32 auto_park_seconds;
52 uint32 __reserved4[2];
54 /* drive identification */
56 char disk_vendor[8];
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
75 enum rdb_flags {
76 RDB_LAST = 0x01,
77 RDB_LAST_LUN = 0x02,
78 RDB_LAST_TID = 0x04,
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 {
100 uint32 id;
101 uint32 summed_longs;
102 int32 check_sum;
103 uint32 host_id;
104 uint32 next;
105 uint32 flags;
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
133 uint32 surfaces;
134 uint32 sectors_per_block;
135 uint32 blocks_per_track;
136 uint32 reserved_blocks_at_start;
137 uint32 reserved_blocks_at_end;
138 uint32 interleave;
139 uint32 first_cylinder;
140 uint32 last_cylinder;
141 uint32 num_buffers;
142 uint32 buffer_mem_type;
143 uint32 max_transfer;
144 uint32 dma_mask;
145 int32 boot_priority;
146 uint32 dos_type;
147 uint32 baud_rate;
148 uint32 control;
149 uint32 boot_blocks;
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; }
158 uint64 Start()
160 return uint64(FirstCylinder()) * BlocksPerTrack() * Surfaces() * BlockSize();
163 uint64 Size()
165 return uint64(LastCylinder() + 1 - FirstCylinder()) * BlocksPerTrack() * Surfaces()
166 * BlockSize();
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 */