2 * Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Tomas Kucera, kucerat@centrum.cz
7 * Bryce Groff, brycegroff@gmail.com
11 \file PartitionMapWriter.h
13 \brief Implementation of disk writer for "intel" style partitions.
15 Writer can write \b Master \b Boot \b Record or \b Extended \b Boot
16 \b Records to the disk according to partitions defined in \c PartitionMap
21 #ifndef PARTITION_MAP_WRITER_H
22 #define PARTITION_MAP_WRITER_H
25 #include <SupportDefs.h>
29 class LogicalPartition
;
30 class PrimaryPartition
;
31 struct partition_table
;
33 bool check_logical_location(const LogicalPartition
* logical
,
34 const PrimaryPartition
* primary
);
37 \brief Writer for "Intel" style partitions.
39 This class serves for writing \a primary and \a logical \a partitions to disk.
41 class PartitionMapWriter
{
43 PartitionMapWriter(int deviceFD
,
45 ~PartitionMapWriter();
47 status_t
WriteMBR(const PartitionMap
* map
,
49 status_t
WriteLogical(const LogicalPartition
* logical
,
50 const PrimaryPartition
* primary
,
52 status_t
WriteExtendedHead(
53 const LogicalPartition
* logical
,
54 const PrimaryPartition
* primary
,
57 status_t
ClearExtendedHead(
58 const PrimaryPartition
* primary
);
61 status_t
_ReadBlock(off_t offset
,
62 partition_table
& partitionTable
);
63 status_t
_WriteBlock(off_t offset
,
64 const partition_table
& partitionTable
);
72 #endif // PARTITION_MAP_WRITER_H