1 #include "PhysicalPartition.h" 2 3 #define B_NOT_IMPLEMENTED B_ERROR 4 5 using namespace Udf; 6 7 /*! \brief Creates a new PhysicalPartition object. 8 */ 9 PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length) 10 : fNumber(number) 11 , fStart(start) 12 , fLength(length) 13 { 14 } 15 16 /*! \brief Destroys the PhysicalPartition object. 17 */ 18 PhysicalPartition::~PhysicalPartition() 19 { 20 } 21 22 /*! \brief Maps the given logical block to a physical block on disc. 23 24 The given logical block is simply treated as an offset from the 25 start of the physical partition. 26 */ 27 status_t 28 PhysicalPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock) 29 { 30 DEBUG_INIT_ETC("PhysicalPartition", ("%ld", logicalBlock)); 31 if (logicalBlock >= fLength) { 32 PRINT(("invalid logical block: %ld, length: %ld\n", logicalBlock, fLength)); 33 return B_BAD_ADDRESS; 34 } else { 35 physicalBlock = fStart + logicalBlock; 36 PRINT(("mapped %ld to %Ld\n", logicalBlock, physicalBlock)); 37 return B_OK; 38 } 39 } 40