Tomas Kucera. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21697 a95241bf-73f2-0310-859d-f6bbb57e9c96
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
/*
|
|
* Copyright 2003-2006, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Ingo Weinhold, [email protected]
|
|
*/
|
|
|
|
/*!
|
|
\file PartitionMapParser.h
|
|
\brief Implementation of disk parser for "intel" style partitions.
|
|
|
|
Parser reads primary and logical partitions from the disk (according to
|
|
Master Boot and Extended Boot Records) and fills \c PartitionMap structure
|
|
with partition representation.
|
|
*/
|
|
#ifndef PARTITION_MAP_PARSER_H
|
|
#define PARTITION_MAP_PARSER_H
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
class Partition;
|
|
class PartitionMap;
|
|
class PrimaryPartition;
|
|
struct partition_table_sector;
|
|
|
|
class PartitionMapParser {
|
|
public:
|
|
PartitionMapParser(int deviceFD, off_t sessionOffset, off_t sessionSize,
|
|
int32 blockSize);
|
|
~PartitionMapParser();
|
|
|
|
status_t Parse(const uint8 *block, PartitionMap *map);
|
|
|
|
int32 CountPartitions() const;
|
|
const Partition *PartitionAt(int32 index) const;
|
|
|
|
private:
|
|
status_t _ParsePrimary(const partition_table_sector *pts);
|
|
status_t _ParseExtended(PrimaryPartition *primary, off_t offset);
|
|
status_t _ReadPTS(off_t offset, partition_table_sector *pts = NULL);
|
|
|
|
private:
|
|
int fDeviceFD;
|
|
off_t fSessionOffset;
|
|
off_t fSessionSize;
|
|
int32 fBlockSize;
|
|
partition_table_sector *fPTS; // while parsing
|
|
PartitionMap *fMap;
|
|
};
|
|
|
|
#endif // PARTITION_MAP_PARSER_H
|