13b9617bcSTyler Dauwalder //---------------------------------------------------------------------- 2*2ca13760SColdfirex // This software is part of the Haiku distribution and is covered 3b6f76ebeSAugustin Cavalier // by the MIT License. 43b9617bcSTyler Dauwalder // 53b9617bcSTyler Dauwalder // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net 63b9617bcSTyler Dauwalder //--------------------------------------------------------------------- 73b9617bcSTyler Dauwalder #ifndef _UDF_SPARABLE_PARTITION_H 83b9617bcSTyler Dauwalder #define _UDF_SPARABLE_PARTITION_H 93b9617bcSTyler Dauwalder 103b9617bcSTyler Dauwalder /*! \file SparablePartition.h 113b9617bcSTyler Dauwalder */ 123b9617bcSTyler Dauwalder 13deac135dSSalvatore Benedetto #include <util/kernel_cpp.h> 143b9617bcSTyler Dauwalder 159c6a0588STyler Dauwalder #include "UdfStructures.h" 163b9617bcSTyler Dauwalder #include "Partition.h" 173b9617bcSTyler Dauwalder #include "UdfDebug.h" 183b9617bcSTyler Dauwalder 193b9617bcSTyler Dauwalder /*! \brief Type 2 sparable partition 203b9617bcSTyler Dauwalder 213b9617bcSTyler Dauwalder Sparable partitions provide a defect-managed partition 223b9617bcSTyler Dauwalder space for media that does not implicitly provide defect management, 233b9617bcSTyler Dauwalder such as CD-RW. Arbitrary packets of blocks in the sparable partition 243b9617bcSTyler Dauwalder may be transparently remapped to other locations on disc should the 253b9617bcSTyler Dauwalder original locations become defective. 263b9617bcSTyler Dauwalder 273b9617bcSTyler Dauwalder Per UDF-2.01 2.2.11, sparable partitions shall be recorded only on 283b9617bcSTyler Dauwalder disk/drive systems that do not perform defect management. 293b9617bcSTyler Dauwalder 303b9617bcSTyler Dauwalder See also UDF-2.01 2.2.9, UDF-2.01 2.2.11 313b9617bcSTyler Dauwalder */ 323b9617bcSTyler Dauwalder class SparablePartition : public Partition { 333b9617bcSTyler Dauwalder public: 343b9617bcSTyler Dauwalder SparablePartition(uint16 number, uint32 start, uint32 length, uint16 packetLength, 353b9617bcSTyler Dauwalder uint8 tableCount, uint32 *tableLocations); 363b9617bcSTyler Dauwalder virtual ~SparablePartition(); 37a1b5a724STyler Dauwalder virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock); 383b9617bcSTyler Dauwalder 393b9617bcSTyler Dauwalder status_t InitCheck(); 403b9617bcSTyler Dauwalder 413b9617bcSTyler Dauwalder uint16 Number() const { return fNumber; } 423b9617bcSTyler Dauwalder uint32 Start() const { return fStart; } 433b9617bcSTyler Dauwalder uint32 Length() const { return fLength; } 443b9617bcSTyler Dauwalder uint32 PacketLength() const { return fPacketLength; } 453b9617bcSTyler Dauwalder uint8 TableCount() const { return fTableCount; } 463b9617bcSTyler Dauwalder 473b9617bcSTyler Dauwalder //! Maximum number of redundant sparing tables per SparablePartition 48a1b5a724STyler Dauwalder static const uint8 kMaxSparingTableCount = UDF_MAX_SPARING_TABLE_COUNT; 493b9617bcSTyler Dauwalder private: 503b9617bcSTyler Dauwalder uint16 fNumber; 513b9617bcSTyler Dauwalder uint32 fStart; 523b9617bcSTyler Dauwalder uint32 fLength; 533b9617bcSTyler Dauwalder uint32 fPacketLength; 543b9617bcSTyler Dauwalder uint8 fTableCount; 553b9617bcSTyler Dauwalder uint32 fTableLocations[kMaxSparingTableCount]; 563b9617bcSTyler Dauwalder status_t fInitStatus; 573b9617bcSTyler Dauwalder }; 583b9617bcSTyler Dauwalder 593b9617bcSTyler Dauwalder #endif // _UDF_SPARABLE_PARTITION_H 60