Initial checkin. Mostly complete implementation of UDF 2.01 physical partitions.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5231 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
#include "PhysicalPartition.h"
|
||||||
|
|
||||||
|
#define B_NOT_IMPLEMENTED B_ERROR
|
||||||
|
|
||||||
|
using namespace Udf;
|
||||||
|
|
||||||
|
/*! \brief Creates a new PhysicalPartition object.
|
||||||
|
*/
|
||||||
|
PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length)
|
||||||
|
: fNumber(number)
|
||||||
|
, fStart(start)
|
||||||
|
, fLength(length)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! \brief Destroys the PhysicalPartition object.
|
||||||
|
*/
|
||||||
|
PhysicalPartition::~PhysicalPartition()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! \brief Maps the given logical block to a physical block on disc.
|
||||||
|
|
||||||
|
The given logical block is simply treated as an offset from the
|
||||||
|
start of the physical partition.
|
||||||
|
*/
|
||||||
|
status_t
|
||||||
|
PhysicalPartition::MapBlock(uint32 logicalBlock, uint32 &physicalBlock)
|
||||||
|
{
|
||||||
|
if (logicalBlock >= fLength)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
else {
|
||||||
|
physicalBlock = fStart + logicalBlock;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
//----------------------------------------------------------------------
|
||||||
|
// This software is part of the OpenBeOS distribution and is covered
|
||||||
|
// by the OpenBeOS license.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Tyler Dauwalder, [email protected]
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
#ifndef _UDF_PHYSICAL_PARTITION_H
|
||||||
|
#define _UDF_PHYSICAL_PARTITION_H
|
||||||
|
|
||||||
|
/*! \file PhysicalPartition.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <kernel_cpp.h>
|
||||||
|
|
||||||
|
#include "Partition.h"
|
||||||
|
#include "UdfDebug.h"
|
||||||
|
|
||||||
|
namespace Udf {
|
||||||
|
|
||||||
|
/*! \brief Standard type 1 physical partition
|
||||||
|
|
||||||
|
PhysicalPartitions map logical block numbers directly to physical
|
||||||
|
block numbers.
|
||||||
|
|
||||||
|
See also: ECMA-167 10.7.2
|
||||||
|
*/
|
||||||
|
class PhysicalPartition : public Partition {
|
||||||
|
public:
|
||||||
|
PhysicalPartition(uint16 number, uint32 start, uint32 length);
|
||||||
|
virtual ~PhysicalPartition();
|
||||||
|
virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock);
|
||||||
|
|
||||||
|
uint16 Number() const { return fNumber; }
|
||||||
|
uint32 Start() const { return fStart; }
|
||||||
|
uint32 Length() const { return fLength; }
|
||||||
|
private:
|
||||||
|
uint16 fNumber;
|
||||||
|
uint32 fStart;
|
||||||
|
uint32 fLength;
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // namespace Udf
|
||||||
|
|
||||||
|
#endif // _UDF_PHYSICAL_PARTITION_H
|
||||||
Reference in New Issue
Block a user