diff --git a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp index eadf9ad122..464adc2fa0 100644 --- a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp +++ b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp @@ -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 diff --git a/src/add-ons/kernel/file_systems/udf/Recognition.cpp b/src/add-ons/kernel/file_systems/udf/Recognition.cpp index 15e397bacf..b65907b8b4 100644 --- a/src/add-ons/kernel/file_systems/udf/Recognition.cpp +++ b/src/add-ons/kernel/file_systems/udf/Recognition.cpp @@ -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, @@ -188,10 +188,10 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length, PRINT(("block %Ld: read_pos(pos:%Ld, len:%ld) failed with error 0x%lx\n", block, address, blockSize, bytesRead)); } - } + } if (!anchorErr) { anchor = reinterpret_cast(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])); @@ -231,10 +228,10 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length, static status_t walk_volume_descriptor_sequence(extent_address descriptorSequence, - int device, uint32 blockSize, uint32 blockShift, - logical_volume_descriptor &logicalVolumeDescriptor, - partition_descriptor partitionDescriptors[], - uint8 &partitionDescriptorCount) + int device, uint32 blockSize, uint32 blockShift, + logical_volume_descriptor &logicalVolumeDescriptor, + partition_descriptor partitionDescriptors[], + uint8 &partitionDescriptorCount) { DEBUG_INIT_ETC(NULL, ("descriptorSequence.loc:%ld, descriptorSequence.len:%ld", descriptorSequence.location(), descriptorSequence.length())); @@ -273,7 +270,7 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence, switch (tag->id()) { case TAGID_UNDEFINED: break; - + case TAGID_PRIMARY_VOLUME_DESCRIPTOR: { primary_volume_descriptor *primary = reinterpret_cast(tag); @@ -281,7 +278,7 @@ walk_volume_descriptor_sequence(extent_address descriptorSequence, (void)primary; // kill the warning break; } - + case TAGID_ANCHOR_VOLUME_DESCRIPTOR_POINTER: break; diff --git a/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp b/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp index 4602464d06..fa55858ae3 100644 --- a/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp +++ b/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp @@ -1,36 +1,44 @@ +/* + * Copyright 2003, Tyler Dauwalder, tyler@dauwalder.net. + * 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) - ? B_OK : B_BAD_VALUE; - if (!error) { - for (uint8 i = 0; i < TableCount(); i++) - fTableLocations[i] = tableLocations[i]; - } - if (!error) - fInitStatus = B_OK; + 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 (status != B_OK) + return; + + for (uint8 i = 0; i < TableCount(); i++) + fTableLocations[i] = tableLocations[i]; + 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) { - if (logicalBlock >= fLength) - error = B_BAD_ADDRESS; - else { - // Check for the logical block in the sparing tables. If not - // found, map directly to physical space. + status_t status = InitCheck(); - //physicalBlock = fStart + logicalBlock; - //return B_OK; - error = B_ERROR; - } + if (status != B_OK) + return status; + + if (logicalBlock >= fLength) + 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; + 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() { diff --git a/src/add-ons/kernel/file_systems/udf/VirtualPartition.cpp b/src/add-ons/kernel/file_systems/udf/VirtualPartition.cpp index 62f45376d4..85d9d3ba37 100644 --- a/src/add-ons/kernel/file_systems/udf/VirtualPartition.cpp +++ b/src/add-ons/kernel/file_systems/udf/VirtualPartition.cpp @@ -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() {