* 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:
@@ -11,14 +11,18 @@ PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length)
|
||||
fStart(start),
|
||||
fLength(length)
|
||||
{
|
||||
TRACE(("PhysicalPartition::PhysicalPartition: number = %d, start = %d,
|
||||
length = %d\n", number, start, 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
|
||||
|
||||
@@ -161,8 +161,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize,
|
||||
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,
|
||||
uint32 blockSize, uint32 blockShift,
|
||||
logical_volume_descriptor &logicalVolumeDescriptor,
|
||||
@@ -191,7 +191,7 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
|
||||
}
|
||||
if (!anchorErr) {
|
||||
anchor = reinterpret_cast<anchor_volume_descriptor*>(chunk.Data());
|
||||
anchorErr = anchor->tag().init_check(block+offset);
|
||||
anchorErr = anchor->tag().init_check(block + offset);
|
||||
if (anchorErr) {
|
||||
PRINT(("block %Ld: invalid anchor\n", block));
|
||||
} else {
|
||||
@@ -203,17 +203,14 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
|
||||
PDUMP(anchor);
|
||||
// Found an avds, so try the main sequence first, then
|
||||
// the reserve sequence if the main one fails.
|
||||
anchorErr = walk_volume_descriptor_sequence(anchor->main_vds(), device,
|
||||
blockSize, blockShift,
|
||||
logicalVolumeDescriptor,
|
||||
partitionDescriptors,
|
||||
partitionDescriptorCount);
|
||||
anchorErr = walk_volume_descriptor_sequence(anchor->main_vds(),
|
||||
device, blockSize, blockShift, logicalVolumeDescriptor,
|
||||
partitionDescriptors, partitionDescriptorCount);
|
||||
|
||||
if (anchorErr)
|
||||
anchorErr = walk_volume_descriptor_sequence(anchor->reserve_vds(), device,
|
||||
blockSize, blockShift,
|
||||
logicalVolumeDescriptor,
|
||||
partitionDescriptors,
|
||||
partitionDescriptorCount);
|
||||
anchorErr = walk_volume_descriptor_sequence(anchor->reserve_vds(),
|
||||
device, blockSize, blockShift, logicalVolumeDescriptor,
|
||||
partitionDescriptors, partitionDescriptorCount);
|
||||
}
|
||||
if (!anchorErr) {
|
||||
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"
|
||||
|
||||
#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,
|
||||
uint16 packetLength, uint8 tableCount,
|
||||
uint32 *tableLocations)
|
||||
: fNumber(number)
|
||||
, fStart(start)
|
||||
, fLength(length)
|
||||
, fPacketLength(packetLength)
|
||||
, fTableCount(tableCount)
|
||||
, fInitStatus(B_NO_INIT)
|
||||
uint16 packetLength, uint8 tableCount, uint32 *tableLocations)
|
||||
:
|
||||
fNumber(number),
|
||||
fStart(start),
|
||||
fLength(length),
|
||||
fPacketLength(packetLength),
|
||||
fTableCount(tableCount),
|
||||
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;
|
||||
if (!error) {
|
||||
if (status != B_OK)
|
||||
return;
|
||||
|
||||
for (uint8 i = 0; i < TableCount(); i++)
|
||||
fTableLocations[i] = tableLocations[i];
|
||||
}
|
||||
if (!error)
|
||||
fInitStatus = B_OK;
|
||||
}
|
||||
|
||||
/*! \brief Destroys the SparablePartition object.
|
||||
*/
|
||||
|
||||
/*! \brief Destroys the SparablePartition object. */
|
||||
SparablePartition::~SparablePartition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! \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
|
||||
@@ -41,24 +49,26 @@ SparablePartition::~SparablePartition()
|
||||
status_t
|
||||
SparablePartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock)
|
||||
{
|
||||
status_t error = InitCheck();
|
||||
if (!error) {
|
||||
status_t status = InitCheck();
|
||||
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
if (logicalBlock >= fLength)
|
||||
error = B_BAD_ADDRESS;
|
||||
return B_BAD_ADDRESS;
|
||||
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_ERROR;
|
||||
status = B_ERROR;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*! Returns the initialization status of the object.
|
||||
*/
|
||||
|
||||
/*! Returns the initialization status of the object. */
|
||||
status_t
|
||||
SparablePartition::InitCheck()
|
||||
{
|
||||
|
||||
@@ -13,15 +13,17 @@
|
||||
VirtualPartition::VirtualPartition(PhysicalPartition &physicalPartition)
|
||||
: fPhysicalPartition(physicalPartition)
|
||||
{
|
||||
TRACE_ERROR(("VirtualPartition::VirtualPartition: not implemented!\n"));
|
||||
// Find VAT
|
||||
}
|
||||
|
||||
/*! \brief Destroys the VirtualPartition object.
|
||||
*/
|
||||
|
||||
/*! \brief Destroys the VirtualPartition object. */
|
||||
VirtualPartition::~VirtualPartition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Maps the given logical block to a physical block on disc.
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*! Returns the initialization status of the object.
|
||||
*/
|
||||
|
||||
/*! Returns the initialization status of the object. */
|
||||
status_t
|
||||
VirtualPartition::InitCheck()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user