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.
*/
status_t
MetadataPartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock)
MetadataPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{
return B_NOT_IMPLEMENTED;
}

View File

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

View File

@ -19,7 +19,9 @@ namespace Udf {
class Partition {
public:
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

View File

@ -25,12 +25,14 @@ PhysicalPartition::~PhysicalPartition()
start of the physical partition.
*/
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)
return B_BAD_ADDRESS;
else {
physicalBlock = fStart + logicalBlock;
PRINT(("mapped %ld to %Ld\n", logicalBlock, physicalBlock));
return B_OK;
}
}

View File

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

View File

@ -40,7 +40,7 @@ SparablePartition::~SparablePartition()
the start of the physical partition.
*/
status_t
SparablePartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock)
SparablePartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{
status_t error = InitCheck();
if (!error) {
@ -49,10 +49,10 @@ SparablePartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock)
else {
// Check for the logical block in the sparing tables. If not
// found, map directly to physical space.
//physicalBlock = fStart + logicalBlock;
//return B_OK;
error = B_NOT_IMPLEMENTED;
error = B_ERROR;
}
}
return error;

View File

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

View File

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

View File

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