* 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
This commit is contained in:
Michael Lotz
2010-02-27 23:19:13 +00:00
parent 4891bed4d2
commit 8d3a8691d4
2 changed files with 16 additions and 9 deletions
+13 -7
View File
@@ -19,7 +19,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id)
if (!id || !name || !length) if (!id || !name || !length)
return B_BAD_VALUE; 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, "id = %p, position = %Ld, parent length = %Ld\n", name, *length, id,
fPosition, Parent()->Length())); fPosition, Parent()->Length()));
@@ -31,8 +31,10 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id)
*id = Parent()->Id(); *id = Parent()->Id();
fAtBeginning = false; fAtBeginning = false;
} else { } else {
if (uint64(fPosition) >= Parent()->Length()) if (uint64(fPosition) >= Parent()->Length()) {
TRACE(("DirectoryIterator::GetNextEntry: end of dir\n"));
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
}
uint8 data[kMaxFileIdSize]; uint8 data[kMaxFileIdSize];
file_id_descriptor *entry = (file_id_descriptor *)data; 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) DirectoryIterator::DirectoryIterator(Icb *parent)
@@ -93,6 +95,7 @@ DirectoryIterator::DirectoryIterator(Icb *parent)
{ {
} }
Icb::Icb(Volume *volume, long_address address) Icb::Icb(Volume *volume, long_address address)
: :
fVolume(volume), fVolume(volume),
@@ -241,10 +244,13 @@ Icb::Find(const char *filename, ino_t *id)
bool foundIt = false; bool foundIt = false;
while (i->GetNextEntry(name, &length, &entryId) == B_OK) { while (i->GetNextEntry(name, &length, &entryId) == B_OK) {
if (strcmp(filename, name) == 0) { if (strcmp(filename, name) == 0) {
foundIt = true; foundIt = true;
break; break;
} }
// reset overwritten length
length = B_FILE_NAME_LENGTH;
} }
if (foundIt) if (foundIt)
@@ -131,7 +131,8 @@ udf_get_vnode(fs_volume *_volume, ino_t id, fs_vnode *_node, int *_type,
if (_node) if (_node)
_node->private_node = icb; _node->private_node = icb;
_node->ops = &gUDFVnodeOps; _node->ops = &gUDFVnodeOps;
_flags = 0; *_type = icb->Mode();
*_flags = 0;
} else { } else {
TRACE_ERROR(("udf_get_vnode: InitCheck failed\n")); TRACE_ERROR(("udf_get_vnode: InitCheck failed\n"));
delete icb; delete icb;
@@ -366,8 +367,8 @@ udf_read_dir(fs_volume *_volume, fs_vnode *vnode, void *cookie,
uint32 nameLength = bufferSize - sizeof(struct dirent) + 1; uint32 nameLength = bufferSize - sizeof(struct dirent) + 1;
ino_t id; ino_t id;
status_t status = iterator->GetNextEntry(dirent->d_name, &nameLength, &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) { if (!status) {
TRACE(("udf_read_dir: dirent->d_name = %s, length = %ld\n", dirent->d_name, nameLength));
*_num = 1; *_num = 1;
dirent->d_dev = volume->ID(); dirent->d_dev = volume->ID();
dirent->d_ino = id; dirent->d_ino = id;