2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
9 #include "SupportDefs.h"
10 #include "ByteOrder.h"
13 enum apple_signature
{
14 kDriverDescriptorSignature
= 'ER',
15 kPartitionMapSignature
= 'PM',
16 kObsoletePartitionMapSignature
= 'TS',
20 struct apple_driver_descriptor
{
24 int16 type
; // reserved
27 int16 descriptor_count
;
30 int16 os_type
; // operating system type
32 int16
BlockSize() { return B_BENDIAN_TO_HOST_INT16(block_size
); }
33 int32
BlockCount() { return B_BENDIAN_TO_HOST_INT32(block_count
); }
35 bool HasValidSignature() { return B_BENDIAN_TO_HOST_INT16(signature
) == kDriverDescriptorSignature
; }
38 struct apple_partition_map
{
41 int32 map_block_count
;
42 int32 start
; // in blocks
46 int32 data_start
; // in blocks
55 int32 boot_code_checksum
;
56 char processor_type
[16];
58 int32
StartBlock() { return B_BENDIAN_TO_HOST_INT32(start
); }
59 int32
BlockCount() { return B_BENDIAN_TO_HOST_INT32(size
); }
60 uint64
Start(apple_driver_descriptor
&descriptor
) { return StartBlock() * descriptor
.BlockSize(); }
61 uint64
Size(apple_driver_descriptor
&descriptor
) { return BlockCount() * descriptor
.BlockSize(); }
63 bool HasValidSignature();
68 apple_partition_map::HasValidSignature()
70 int16 sig
= B_BENDIAN_TO_HOST_INT16(signature
);
72 return sig
== kPartitionMapSignature
73 || sig
== kObsoletePartitionMapSignature
;
77 enum partition_status
{
78 kPartitionIsValid
= 0x00000001,
79 kPartitionIsAllocated
= 0x00000002,
80 kPartitionIsInUse
= 0x00000004,
81 kPartitionIsBootValid
= 0x00000008,
82 kPartitionIsReadable
= 0x00000010,
83 kPartitionAUXIsWriteable
= 0x00000020, // dunno why IsWriteable is here twice...
84 kPartitionIsBootPIC
= 0x00000040,
85 kPartitionIsWriteable
= 0x00000020,
86 kPartitionIsMounted
= 0x40000000,
87 kPartitionIsStartup
= 0x80000000,
88 kPartitionIsChainCompatible
= 0x00000100,
89 kPartitionIsRealDeviceDriver
= 0x00000200,
90 kPartitionCanChainToNext
= 0x00000400,