1 // PartitionMapParser.h 2 3 #ifndef PARTITION_MAP_PARSER_H 4 #define PARTITION_MAP_PARSER_H 5 6 #include <SupportDefs.h> 7 8 class Partition; 9 class PartitionMap; 10 class PrimaryPartition; 11 struct partition_table_sector; 12 13 class PartitionMapParser { 14 public: 15 PartitionMapParser(int deviceFD, off_t sessionOffset, off_t sessionSize, 16 int32 blockSize); 17 ~PartitionMapParser(); 18 19 status_t Parse(const uint8 *block, PartitionMap *map); 20 21 int32 CountPartitions() const; 22 const Partition *PartitionAt(int32 index) const; 23 24 private: 25 status_t _ParsePrimary(const partition_table_sector *pts); 26 status_t _ParseExtended(PrimaryPartition *primary, off_t offset); 27 status_t _ReadPTS(off_t offset, partition_table_sector *pts = NULL); 28 29 private: 30 int fDeviceFD; 31 off_t fSessionOffset; 32 off_t fSessionSize; 33 int32 fBlockSize; 34 partition_table_sector *fPTS; // while parsing 35 PartitionMap *fMap; // 36 }; 37 38 #endif // PARTITION_MAP_PARSER_H 39