* Clean up, no functional changes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Salvatore Benedetto
2008-08-23 12:58:24 +00:00
parent 3f60937555
commit c5855c9ef4
4 changed files with 71 additions and 58 deletions
@@ -11,14 +11,18 @@ PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length)
fStart(start), fStart(start),
fLength(length) fLength(length)
{ {
TRACE(("PhysicalPartition::PhysicalPartition: number = %d, start = %d,
length = %d\n", number, start, length));
} }
/*! \brief Destroys the PhysicalPartition object. /*! \brief Destroys the PhysicalPartition object.
*/ */
PhysicalPartition::~PhysicalPartition() PhysicalPartition::~PhysicalPartition()
{ {
} }
/*! \brief Maps the given logical block to a physical block on disc. /*! \brief Maps the given logical block to a physical block on disc.
The given logical block is simply treated as an offset from the The given logical block is simply treated as an offset from the
@@ -161,8 +161,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize,
return foundECMA167 || (foundExtended && !foundECMA168) ? B_OK : B_ERROR; return foundECMA167 || (foundExtended && !foundECMA168) ? B_OK : B_ERROR;
} }
static
status_t static status_t
walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length, walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
uint32 blockSize, uint32 blockShift, uint32 blockSize, uint32 blockShift,
logical_volume_descriptor &logicalVolumeDescriptor, logical_volume_descriptor &logicalVolumeDescriptor,
@@ -191,7 +191,7 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
} }
if (!anchorErr) { if (!anchorErr) {
anchor = reinterpret_cast<anchor_volume_descriptor*>(chunk.Data()); anchor = reinterpret_cast<anchor_volume_descriptor*>(chunk.Data());
anchorErr = anchor->tag().init_check(block+offset); anchorErr = anchor->tag().init_check(block + offset);
if (anchorErr) { if (anchorErr) {
PRINT(("block %Ld: invalid anchor\n", block)); PRINT(("block %Ld: invalid anchor\n", block));
} else { } else {
@@ -203,17 +203,14 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
PDUMP(anchor); PDUMP(anchor);
// Found an avds, so try the main sequence first, then // Found an avds, so try the main sequence first, then
// the reserve sequence if the main one fails. // the reserve sequence if the main one fails.
anchorErr = walk_volume_descriptor_sequence(anchor->main_vds(), device, anchorErr = walk_volume_descriptor_sequence(anchor->main_vds(),
blockSize, blockShift, device, blockSize, blockShift, logicalVolumeDescriptor,
logicalVolumeDescriptor, partitionDescriptors, partitionDescriptorCount);
partitionDescriptors,
partitionDescriptorCount);
if (anchorErr) if (anchorErr)
anchorErr = walk_volume_descriptor_sequence(anchor->reserve_vds(), device, anchorErr = walk_volume_descriptor_sequence(anchor->reserve_vds(),
blockSize, blockShift, device, blockSize, blockShift, logicalVolumeDescriptor,
logicalVolumeDescriptor, partitionDescriptors, partitionDescriptorCount);
partitionDescriptors,
partitionDescriptorCount);
} }
if (!anchorErr) { if (!anchorErr) {
PRINT(("block %Ld: found valid vds\n", avds_locations[i])); PRINT(("block %Ld: found valid vds\n", avds_locations[i]));
@@ -1,36 +1,44 @@
/*
* Copyright 2003, Tyler Dauwalder, [email protected].
* Distributed under the terms of the MIT License.
*/
#include "SparablePartition.h" #include "SparablePartition.h"
#define B_NOT_IMPLEMENTED B_ERROR #define B_NOT_IMPLEMENTED B_ERROR
/*! \brief Creates a new SparablePartition object. /*! \brief Creates a new SparablePartition object. */
*/
SparablePartition::SparablePartition(uint16 number, uint32 start, uint32 length, SparablePartition::SparablePartition(uint16 number, uint32 start, uint32 length,
uint16 packetLength, uint8 tableCount, uint16 packetLength, uint8 tableCount, uint32 *tableLocations)
uint32 *tableLocations) :
: fNumber(number) fNumber(number),
, fStart(start) fStart(start),
, fLength(length) fLength(length),
, fPacketLength(packetLength) fPacketLength(packetLength),
, fTableCount(tableCount) fTableCount(tableCount),
, fInitStatus(B_NO_INIT) fInitStatus(B_NO_INIT)
{ {
status_t error = (0 < TableCount() && TableCount() <= kMaxSparingTableCount) TRACE(("SparablePartition::SparablePartition: number = %d, start = %d,
length = %d, packetLength = %d\n", number, start, length, packetLength));
status_t status = (0 < TableCount() && TableCount() <= kMaxSparingTableCount)
? B_OK : B_BAD_VALUE; ? B_OK : B_BAD_VALUE;
if (!error) { if (status != B_OK)
return;
for (uint8 i = 0; i < TableCount(); i++) for (uint8 i = 0; i < TableCount(); i++)
fTableLocations[i] = tableLocations[i]; fTableLocations[i] = tableLocations[i];
}
if (!error)
fInitStatus = B_OK; fInitStatus = B_OK;
} }
/*! \brief Destroys the SparablePartition object.
*/ /*! \brief Destroys the SparablePartition object. */
SparablePartition::~SparablePartition() SparablePartition::~SparablePartition()
{ {
} }
/*! \brief Maps the given logical block to a physical block on disc. /*! \brief Maps the given logical block to a physical block on disc.
The sparing tables are first checked to see if the logical block has The sparing tables are first checked to see if the logical block has
@@ -41,24 +49,26 @@ SparablePartition::~SparablePartition()
status_t status_t
SparablePartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock) SparablePartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
{ {
status_t error = InitCheck(); status_t status = InitCheck();
if (!error) {
if (status != B_OK)
return status;
if (logicalBlock >= fLength) if (logicalBlock >= fLength)
error = B_BAD_ADDRESS; return B_BAD_ADDRESS;
else { else {
// Check for the logical block in the sparing tables. If not // Check for the logical block in the sparing tables. If not
// found, map directly to physical space. // found, map directly to physical space.
//physicalBlock = fStart + logicalBlock; //physicalBlock = fStart + logicalBlock;
//return B_OK; //return B_OK;
error = B_ERROR; status = B_ERROR;
} }
} return status;
return error;
} }
/*! Returns the initialization status of the object.
*/ /*! Returns the initialization status of the object. */
status_t status_t
SparablePartition::InitCheck() SparablePartition::InitCheck()
{ {
@@ -13,15 +13,17 @@
VirtualPartition::VirtualPartition(PhysicalPartition &physicalPartition) VirtualPartition::VirtualPartition(PhysicalPartition &physicalPartition)
: fPhysicalPartition(physicalPartition) : fPhysicalPartition(physicalPartition)
{ {
TRACE_ERROR(("VirtualPartition::VirtualPartition: not implemented!\n"));
// Find VAT // Find VAT
} }
/*! \brief Destroys the VirtualPartition object.
*/ /*! \brief Destroys the VirtualPartition object. */
VirtualPartition::~VirtualPartition() VirtualPartition::~VirtualPartition()
{ {
} }
/*! \brief Maps the given logical block to a physical block on disc. /*! \brief Maps the given logical block to a physical block on disc.
The given logical block is indexed into the VAT. If a corresponding The given logical block is indexed into the VAT. If a corresponding
@@ -34,8 +36,8 @@ VirtualPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
return B_NOT_IMPLEMENTED; return B_NOT_IMPLEMENTED;
} }
/*! Returns the initialization status of the object.
*/ /*! Returns the initialization status of the object. */
status_t status_t
VirtualPartition::InitCheck() VirtualPartition::InitCheck()
{ {