diff --git a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp new file mode 100644 index 0000000000..3179b0e8b1 --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp @@ -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; + } +} diff --git a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.h b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.h new file mode 100644 index 0000000000..5a9d161530 --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.h @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------- +// This software is part of the OpenBeOS distribution and is covered +// by the OpenBeOS license. +// +// Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net +//--------------------------------------------------------------------- +#ifndef _UDF_PHYSICAL_PARTITION_H +#define _UDF_PHYSICAL_PARTITION_H + +/*! \file PhysicalPartition.h +*/ + +#include + +#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