From 5c1f535500abdb1992a5e43d5d1fccdd3a55612d Mon Sep 17 00:00:00 2001 From: Tyler Dauwalder Date: Mon, 3 Nov 2003 01:46:45 +0000 Subject: [PATCH] - Updated short version of udf_recognize() to return volume name in output parameter. - Forgot to pass out the number of partitions found in udf_walk_vds(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5242 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/udf/Recognition.cpp | 32 +++++++++++++++---- .../kernel/file_systems/udf/Recognition.h | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/file_systems/udf/Recognition.cpp b/src/add-ons/kernel/file_systems/udf/Recognition.cpp index 1d95df6166..2d81530f96 100644 --- a/src/add-ons/kernel/file_systems/udf/Recognition.cpp +++ b/src/add-ons/kernel/file_systems/udf/Recognition.cpp @@ -1,5 +1,6 @@ #include "Recognition.h" +#include "CS0String.h" #include "MemoryChunk.h" using namespace Udf; @@ -35,7 +36,9 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, udf_partition_descriptor partitionDescriptors[], uint8 &partitionDescriptorCount) { - DEBUG_INIT(CF_PRIVATE, NULL); + DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("device: %d, offset: %Ld, length: %Ld, " + "blockSize: %ld, [...descriptors, etc...]", device, offset, + length, blockSize)); // Check the block size uint32 bitCount = 0; @@ -70,14 +73,23 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, status_t Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, - uint32 &blockShift) + char *volumeName) { + DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("device: %d, offset: %Ld, length: %Ld, " + "blockSize: %ld, volumeName: %p", device, offset, length, + blockSize, volumeName)); udf_logical_descriptor logicalVolumeDescriptor; udf_partition_descriptor partitionDescriptors[Udf::kMaxPartitionDescriptors]; uint8 partitionDescriptorCount; - return udf_recognize(device, offset, length, blockSize, blockShift, - logicalVolumeDescriptor, partitionDescriptors, - partitionDescriptorCount); + uint32 blockShift; + status_t error = udf_recognize(device, offset, length, blockSize, blockShift, + logicalVolumeDescriptor, partitionDescriptors, + partitionDescriptorCount); + if (!error && volumeName) { + CS0String name(logicalVolumeDescriptor.logical_volume_identifier()); + strcpy(volumeName, name.String()); + } + RETURN(error); } //------------------------------------------------------------------------------ @@ -399,9 +411,17 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, } } } + + PRINT(("found %d unique partition%s\n", uniquePartitions, + (uniquePartitions == 1 ? "" : "s"))); - if (!err) + if (!err) err = foundLogicalVolumeDescriptor ? B_OK : B_ERROR; + if (!err) + err = uniquePartitions >= 1 ? B_OK : B_ERROR; + if (!err) + partitionDescriptorCount = uniquePartitions; + RETURN(err); } diff --git a/src/add-ons/kernel/file_systems/udf/Recognition.h b/src/add-ons/kernel/file_systems/udf/Recognition.h index 75ff04731e..1d0db34c03 100644 --- a/src/add-ons/kernel/file_systems/udf/Recognition.h +++ b/src/add-ons/kernel/file_systems/udf/Recognition.h @@ -21,7 +21,7 @@ status_t udf_recognize(int device, off_t offset, off_t length, udf_partition_descriptor partitionDescriptors[], uint8 &partitionDescriptorCount); status_t udf_recognize(int device, off_t offset, off_t length, - uint32 blockSize, uint32 &blockShift); + uint32 blockSize, char *volumeName); } // namespace Udf