From 8d3a8691d4a47bd8de146d044f820557ce28c13b Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 27 Feb 2010 23:19:13 +0000 Subject: [PATCH] * UDF didn't actually initializing _flags to 0 (same as with fat). * Set the _type as well, this gets file listings work. * Some cleanup and debug output moves/fixes/additions. Yet crashes when accessing files though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35647 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/udf/Icb.cpp | 20 ++++++++++++------- .../file_systems/udf/kernel_interface.cpp | 5 +++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/add-ons/kernel/file_systems/udf/Icb.cpp b/src/add-ons/kernel/file_systems/udf/Icb.cpp index 0b4cb447a2..94b6b78966 100644 --- a/src/add-ons/kernel/file_systems/udf/Icb.cpp +++ b/src/add-ons/kernel/file_systems/udf/Icb.cpp @@ -19,7 +19,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id) if (!id || !name || !length) return B_BAD_VALUE; - TRACE(("DirectoryIterator::GetNextEntry: name = %s, length = %ld, " + TRACE(("DirectoryIterator::GetNextEntry: name = %p, length = %ld, " "id = %p, position = %Ld, parent length = %Ld\n", name, *length, id, fPosition, Parent()->Length())); @@ -31,8 +31,10 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id) *id = Parent()->Id(); fAtBeginning = false; } else { - if (uint64(fPosition) >= Parent()->Length()) + if (uint64(fPosition) >= Parent()->Length()) { + TRACE(("DirectoryIterator::GetNextEntry: end of dir\n")); return B_ENTRY_NOT_FOUND; + } uint8 data[kMaxFileIdSize]; file_id_descriptor *entry = (file_id_descriptor *)data; @@ -82,7 +84,7 @@ DirectoryIterator::Rewind() } -// #pragma - Private methods +// #pragma mark - Private methods DirectoryIterator::DirectoryIterator(Icb *parent) @@ -93,6 +95,7 @@ DirectoryIterator::DirectoryIterator(Icb *parent) { } + Icb::Icb(Volume *volume, long_address address) : fVolume(volume), @@ -241,10 +244,13 @@ Icb::Find(const char *filename, ino_t *id) bool foundIt = false; while (i->GetNextEntry(name, &length, &entryId) == B_OK) { - if (strcmp(filename, name) == 0) { - foundIt = true; - break; - } + if (strcmp(filename, name) == 0) { + foundIt = true; + break; + } + + // reset overwritten length + length = B_FILE_NAME_LENGTH; } if (foundIt) diff --git a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp index a42e74180d..2a4964bf89 100644 --- a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp @@ -131,7 +131,8 @@ udf_get_vnode(fs_volume *_volume, ino_t id, fs_vnode *_node, int *_type, if (_node) _node->private_node = icb; _node->ops = &gUDFVnodeOps; - _flags = 0; + *_type = icb->Mode(); + *_flags = 0; } else { TRACE_ERROR(("udf_get_vnode: InitCheck failed\n")); delete icb; @@ -366,8 +367,8 @@ udf_read_dir(fs_volume *_volume, fs_vnode *vnode, void *cookie, uint32 nameLength = bufferSize - sizeof(struct dirent) + 1; ino_t id; status_t status = iterator->GetNextEntry(dirent->d_name, &nameLength, &id); - TRACE(("udf_read_dir: dirent->d_name = %s, length = %ld\n", dirent->d_name, nameLength)); if (!status) { + TRACE(("udf_read_dir: dirent->d_name = %s, length = %ld\n", dirent->d_name, nameLength)); *_num = 1; dirent->d_dev = volume->ID(); dirent->d_ino = id;