1 //---------------------------------------------------------------------- 2 // This software is part of the Haiku distribution and is covered 3 // by the MIT License. 4 // 5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net 6 //--------------------------------------------------------------------- 7 #ifndef _UDF_SPARABLE_PARTITION_H 8 #define _UDF_SPARABLE_PARTITION_H 9 10 /*! \file SparablePartition.h 11 */ 12 13 #include <util/kernel_cpp.h> 14 15 #include "UdfStructures.h" 16 #include "Partition.h" 17 #include "UdfDebug.h" 18 19 /*! \brief Type 2 sparable partition 20 21 Sparable partitions provide a defect-managed partition 22 space for media that does not implicitly provide defect management, 23 such as CD-RW. Arbitrary packets of blocks in the sparable partition 24 may be transparently remapped to other locations on disc should the 25 original locations become defective. 26 27 Per UDF-2.01 2.2.11, sparable partitions shall be recorded only on 28 disk/drive systems that do not perform defect management. 29 30 See also UDF-2.01 2.2.9, UDF-2.01 2.2.11 31 */ 32 class SparablePartition : public Partition { 33 public: 34 SparablePartition(uint16 number, uint32 start, uint32 length, uint16 packetLength, 35 uint8 tableCount, uint32 *tableLocations); 36 virtual ~SparablePartition(); 37 virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock); 38 39 status_t InitCheck(); 40 Number()41 uint16 Number() const { return fNumber; } Start()42 uint32 Start() const { return fStart; } Length()43 uint32 Length() const { return fLength; } PacketLength()44 uint32 PacketLength() const { return fPacketLength; } TableCount()45 uint8 TableCount() const { return fTableCount; } 46 47 //! Maximum number of redundant sparing tables per SparablePartition 48 static const uint8 kMaxSparingTableCount = UDF_MAX_SPARING_TABLE_COUNT; 49 private: 50 uint16 fNumber; 51 uint32 fStart; 52 uint32 fLength; 53 uint32 fPacketLength; 54 uint8 fTableCount; 55 uint32 fTableLocations[kMaxSparingTableCount]; 56 status_t fInitStatus; 57 }; 58 59 #endif // _UDF_SPARABLE_PARTITION_H 60