Physical blocks are off_t's, not uint32's.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5314 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2003-11-11 09:06:53 +00:00
parent 78b6ddea31
commit a1b5a724ed
9 changed files with 17 additions and 12 deletions

View File

@ -30,7 +30,7 @@ MetadataPartition::~MetadataPartition()
/*! \brief Maps the given logical block to a physical block on disc. /*! \brief Maps the given logical block to a physical block on disc.
*/ */
status_t status_t
MetadataPartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock) MetadataPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{ {
return B_NOT_IMPLEMENTED; return B_NOT_IMPLEMENTED;
} }

View File

@ -31,7 +31,7 @@ public:
uint32 allocationUnitSize, uint16 alignmentUnitSize, uint32 allocationUnitSize, uint16 alignmentUnitSize,
bool metadataIsDuplicated); bool metadataIsDuplicated);
virtual ~MetadataPartition(); virtual ~MetadataPartition();
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock); virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock);
status_t InitCheck(); status_t InitCheck();

View File

@ -19,7 +19,9 @@ namespace Udf {
class Partition { class Partition {
public: public:
virtual ~Partition() {} virtual ~Partition() {}
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock) = 0; virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock) = 0;
// virtual status_t MapExtent(uint32 logicalBlock, uint32 logicalLength,
// uint32 &physicalBlock, uint32 &physicalLength) = 0;
}; };
}; // namespace Udf }; // namespace Udf

View File

@ -25,12 +25,14 @@ PhysicalPartition::~PhysicalPartition()
start of the physical partition. start of the physical partition.
*/ */
status_t status_t
PhysicalPartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock) PhysicalPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{ {
DEBUG_INIT_ETC(CF_PUBLIC, "PhysicalPartition", ("%ld", logicalBlock));
if (logicalBlock >= fLength) if (logicalBlock >= fLength)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
else { else {
physicalBlock = fStart + logicalBlock; physicalBlock = fStart + logicalBlock;
PRINT(("mapped %ld to %Ld\n", logicalBlock, physicalBlock));
return B_OK; return B_OK;
} }
} }

View File

@ -28,7 +28,7 @@ class PhysicalPartition : public Partition {
public: public:
PhysicalPartition(uint16 number, uint32 start, uint32 length); PhysicalPartition(uint16 number, uint32 start, uint32 length);
virtual ~PhysicalPartition(); virtual ~PhysicalPartition();
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock); virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock);
uint16 Number() const { return fNumber; } uint16 Number() const { return fNumber; }
uint32 Start() const { return fStart; } uint32 Start() const { return fStart; }

View File

@ -40,7 +40,7 @@ SparablePartition::~SparablePartition()
the start of the physical partition. the start of the physical partition.
*/ */
status_t status_t
SparablePartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock) SparablePartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{ {
status_t error = InitCheck(); status_t error = InitCheck();
if (!error) { if (!error) {
@ -52,7 +52,7 @@ SparablePartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock)
//physicalBlock = fStart + logicalBlock; //physicalBlock = fStart + logicalBlock;
//return B_OK; //return B_OK;
error = B_NOT_IMPLEMENTED; error = B_ERROR;
} }
} }
return error; return error;

View File

@ -12,6 +12,7 @@
#include <kernel_cpp.h> #include <kernel_cpp.h>
#include "DiskStructures.h"
#include "Partition.h" #include "Partition.h"
#include "UdfDebug.h" #include "UdfDebug.h"
@ -35,7 +36,7 @@ public:
SparablePartition(uint16 number, uint32 start, uint32 length, uint16 packetLength, SparablePartition(uint16 number, uint32 start, uint32 length, uint16 packetLength,
uint8 tableCount, uint32 *tableLocations); uint8 tableCount, uint32 *tableLocations);
virtual ~SparablePartition(); virtual ~SparablePartition();
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock); virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock);
status_t InitCheck(); status_t InitCheck();
@ -46,7 +47,7 @@ public:
uint8 TableCount() const { return fTableCount; } uint8 TableCount() const { return fTableCount; }
//! Maximum number of redundant sparing tables per SparablePartition //! Maximum number of redundant sparing tables per SparablePartition
static const uint8 kMaxSparingTableCount = 4; static const uint8 kMaxSparingTableCount = UDF_MAX_SPARING_TABLE_COUNT;
private: private:
uint16 fNumber; uint16 fNumber;
uint32 fStart; uint32 fStart;

View File

@ -30,7 +30,7 @@ VirtualPartition::~VirtualPartition()
VirtualPartition object's physical partition. VirtualPartition object's physical partition.
*/ */
status_t status_t
VirtualPartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock) VirtualPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{ {
return B_NOT_IMPLEMENTED; return B_NOT_IMPLEMENTED;
} }

View File

@ -34,7 +34,7 @@ class VirtualPartition : public Partition {
public: public:
VirtualPartition(PhysicalPartition &physicalPartition); VirtualPartition(PhysicalPartition &physicalPartition);
virtual ~VirtualPartition(); virtual ~VirtualPartition();
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock); virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock);
status_t InitCheck(); status_t InitCheck();
private: private: