- 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
This commit is contained in:
Tyler Dauwalder 2003-11-03 01:46:45 +00:00
parent 896ad7850f
commit 5c1f535500
2 changed files with 27 additions and 7 deletions

View File

@ -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);
}

View File

@ -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