btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / add-ons / kernel / partitioning_systems / intel / PartitionMapWriter.h
blob6fe040a28d32b852e023f6d6a3f320a8dc497bd6
1 /*
2 * Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Tomas Kucera, kucerat@centrum.cz
7 * Bryce Groff, brycegroff@gmail.com
8 */
10 /*!
11 \file PartitionMapWriter.h
12 \ingroup intel_module
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
17 structure.
21 #ifndef PARTITION_MAP_WRITER_H
22 #define PARTITION_MAP_WRITER_H
25 #include <SupportDefs.h>
28 class PartitionMap;
29 class LogicalPartition;
30 class PrimaryPartition;
31 struct partition_table;
33 bool check_logical_location(const LogicalPartition* logical,
34 const PrimaryPartition* primary);
36 /*!
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 {
42 public:
43 PartitionMapWriter(int deviceFD,
44 uint32 blockSize);
45 ~PartitionMapWriter();
47 status_t WriteMBR(const PartitionMap* map,
48 bool writeBootCode);
49 status_t WriteLogical(const LogicalPartition* logical,
50 const PrimaryPartition* primary,
51 bool clearCode);
52 status_t WriteExtendedHead(
53 const LogicalPartition* logical,
54 const PrimaryPartition* primary,
55 bool clearCode);
57 status_t ClearExtendedHead(
58 const PrimaryPartition* primary);
60 private:
61 status_t _ReadBlock(off_t offset,
62 partition_table& partitionTable);
63 status_t _WriteBlock(off_t offset,
64 const partition_table& partitionTable);
66 private:
67 int fDeviceFD;
68 int32 fBlockSize;
72 #endif // PARTITION_MAP_WRITER_H