* Fixed some coding style violation introduced in my previous commit. Thanks Axel!
The recognition code is actually working, I was just using the wrong dvd. I'm now using an iso file created with mkisofs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27085 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -39,26 +39,25 @@ walk_integrity_sequence(int device, uint32 blockSize, uint32 blockShift,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
||||||
uint32 &blockShift, logical_volume_descriptor &logicalVolumeDescriptor,
|
uint32 &blockShift, logical_volume_descriptor &logicalVolumeDescriptor,
|
||||||
partition_descriptor partitionDescriptors[],
|
partition_descriptor partitionDescriptors[],
|
||||||
uint8 &partitionDescriptorCount)
|
uint8 &partitionDescriptorCount)
|
||||||
{
|
{
|
||||||
TRACE(("udf_recognize: device: = %d, offset = %Ld, length = %Ld, "
|
TRACE(("udf_recognize: device: = %d, offset = %Ld, length = %Ld, "
|
||||||
"blockSize = %ld, [...descriptors, etc...]\n", device, offset,
|
"blockSize = %ld, ", device, offset, length, blockSize));
|
||||||
length, blockSize));
|
|
||||||
|
|
||||||
// Check the block size
|
// Check the block size
|
||||||
status_t status = get_block_shift(blockSize, blockShift);
|
status_t status = get_block_shift(blockSize, blockShift);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE_ERROR(("udf_recognize: Block size must be a positive power of "
|
TRACE_ERROR(("\nudf_recognize: Block size must be a positive power of "
|
||||||
"two! (blockSize = %ld)\n", blockSize));
|
"two! (blockSize = %ld)\n", blockSize));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
TRACE(("udf_recognize: blockShift: %ld\n", blockShift));
|
TRACE(("blockShift: %ld\n", blockShift));
|
||||||
|
|
||||||
// Check for a valid volume recognition sequence
|
// Check for a valid volume recognition sequence
|
||||||
status = walk_volume_recognition_sequence(device, offset, blockSize,
|
status = walk_volume_recognition_sequence(device, offset, blockSize,
|
||||||
blockShift);
|
blockShift);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE_ERROR(("udf_recognize: Invalid sequence. status = %d\n", status));
|
TRACE_ERROR(("udf_recognize: Invalid sequence. status = %d\n", status));
|
||||||
return status;
|
return status;
|
||||||
@@ -66,8 +65,8 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
|||||||
// Now hunt down a volume descriptor sequence from one of
|
// Now hunt down a volume descriptor sequence from one of
|
||||||
// the anchor volume pointers (if there are any).
|
// the anchor volume pointers (if there are any).
|
||||||
status = walk_anchor_volume_descriptor_sequences(device, offset, length,
|
status = walk_anchor_volume_descriptor_sequences(device, offset, length,
|
||||||
blockSize, blockShift, logicalVolumeDescriptor,
|
blockSize, blockShift, logicalVolumeDescriptor,
|
||||||
partitionDescriptors, partitionDescriptorCount);
|
partitionDescriptors, partitionDescriptorCount);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE_ERROR(("udf_recognize: cannot find volume descriptor. status = %d\n",
|
TRACE_ERROR(("udf_recognize: cannot find volume descriptor. status = %d\n",
|
||||||
status));
|
status));
|
||||||
@@ -76,7 +75,7 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
|||||||
// Now walk the integrity sequence and make sure the last integrity
|
// Now walk the integrity sequence and make sure the last integrity
|
||||||
// descriptor is a closed descriptor
|
// descriptor is a closed descriptor
|
||||||
status = walk_integrity_sequence(device, blockSize, blockShift,
|
status = walk_integrity_sequence(device, blockSize, blockShift,
|
||||||
logicalVolumeDescriptor.integrity_sequence_extent());
|
logicalVolumeDescriptor.integrity_sequence_extent());
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE_ERROR(("udf_recognize: last integrity descriptor not closed. "
|
TRACE_ERROR(("udf_recognize: last integrity descriptor not closed. "
|
||||||
"status = %d\n", status));
|
"status = %d\n", status));
|
||||||
@@ -92,8 +91,13 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
|||||||
|
|
||||||
static
|
static
|
||||||
status_t
|
status_t
|
||||||
walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uint32 blockShift)
|
walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize,
|
||||||
|
uint32 blockShift)
|
||||||
{
|
{
|
||||||
|
TRACE(("walk_volume_recognition_sequence: device = %d, offset = %Ld, "
|
||||||
|
"blockSize = %ld, blockShift = %d\n", device, offset, blockSize,
|
||||||
|
blockShift));
|
||||||
|
|
||||||
// vrs starts at block 16. Each volume structure descriptor (vsd)
|
// vrs starts at block 16. Each volume structure descriptor (vsd)
|
||||||
// should be one block long. We're expecting to find 0 or more iso9660
|
// should be one block long. We're expecting to find 0 or more iso9660
|
||||||
// vsd's followed by some ECMA-167 vsd's.
|
// vsd's followed by some ECMA-167 vsd's.
|
||||||
@@ -110,11 +114,11 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uin
|
|||||||
bool foundECMA168 = false;
|
bool foundECMA168 = false;
|
||||||
bool foundBoot = false;
|
bool foundBoot = false;
|
||||||
for (uint32 block = 16; true; block++) {
|
for (uint32 block = 16; true; block++) {
|
||||||
TRACE(("walk_volume_recognition_sequence: block %ld: ", block));
|
|
||||||
off_t address = (offset + block) << blockShift;
|
off_t address = (offset + block) << blockShift;
|
||||||
|
TRACE(("walk_volume_recognition_sequence: block = %ld, "
|
||||||
|
"address = %d, ", block, address));
|
||||||
ssize_t bytesRead = read_pos(device, address, chunk.Data(), blockSize);
|
ssize_t bytesRead = read_pos(device, address, chunk.Data(), blockSize);
|
||||||
if (bytesRead == (ssize_t)blockSize)
|
if (bytesRead == (ssize_t)blockSize) {
|
||||||
{
|
|
||||||
volume_structure_descriptor_header* descriptor
|
volume_structure_descriptor_header* descriptor
|
||||||
= (volume_structure_descriptor_header *)(chunk.Data());
|
= (volume_structure_descriptor_header *)(chunk.Data());
|
||||||
if (descriptor->id_matches(kVSDID_ISO)) {
|
if (descriptor->id_matches(kVSDID_ISO)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user