104106297STyler Dauwalder #include "PhysicalPartition.h" 204106297STyler Dauwalder 304106297STyler Dauwalder #define B_NOT_IMPLEMENTED B_ERROR 404106297STyler Dauwalder 504106297STyler Dauwalder using namespace Udf; 604106297STyler Dauwalder 704106297STyler Dauwalder /*! \brief Creates a new PhysicalPartition object. 804106297STyler Dauwalder */ 904106297STyler Dauwalder PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length) 1004106297STyler Dauwalder : fNumber(number) 1104106297STyler Dauwalder , fStart(start) 1204106297STyler Dauwalder , fLength(length) 1304106297STyler Dauwalder { 1404106297STyler Dauwalder } 1504106297STyler Dauwalder 1604106297STyler Dauwalder /*! \brief Destroys the PhysicalPartition object. 1704106297STyler Dauwalder */ 1804106297STyler Dauwalder PhysicalPartition::~PhysicalPartition() 1904106297STyler Dauwalder { 2004106297STyler Dauwalder } 2104106297STyler Dauwalder 2204106297STyler Dauwalder /*! \brief Maps the given logical block to a physical block on disc. 2304106297STyler Dauwalder 2404106297STyler Dauwalder The given logical block is simply treated as an offset from the 2504106297STyler Dauwalder start of the physical partition. 2604106297STyler Dauwalder */ 2704106297STyler Dauwalder status_t 28*a1b5a724STyler Dauwalder PhysicalPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock) 2904106297STyler Dauwalder { 30*a1b5a724STyler Dauwalder DEBUG_INIT_ETC(CF_PUBLIC, "PhysicalPartition", ("%ld", logicalBlock)); 3104106297STyler Dauwalder if (logicalBlock >= fLength) 3204106297STyler Dauwalder return B_BAD_ADDRESS; 3304106297STyler Dauwalder else { 3404106297STyler Dauwalder physicalBlock = fStart + logicalBlock; 35*a1b5a724STyler Dauwalder PRINT(("mapped %ld to %Ld\n", logicalBlock, physicalBlock)); 3604106297STyler Dauwalder return B_OK; 3704106297STyler Dauwalder } 3804106297STyler Dauwalder } 39