* HTree::Lookup() was trying to find the entry .. through indexed search instead of linear search. Should fix #6305
* DirectoryIterator::FindEntry() now takes name length in account for name comparison. * cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39809 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -206,8 +206,8 @@ DirectoryIterator::Next()
|
|||||||
TRACE("DirectoryIterator::Next() skipping entry %d %ld\n", entry->Length(), entry->InodeID());
|
TRACE("DirectoryIterator::Next() skipping entry %d %ld\n", entry->Length(), entry->InodeID());
|
||||||
} while (entry->Length() == 0 || entry->InodeID() == 0);
|
} while (entry->Length() == 0 || entry->InodeID() == 0);
|
||||||
|
|
||||||
TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %s\n",
|
TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %*s\n",
|
||||||
entry->Length(), entry->name);
|
entry->Length(), entry->NameLength(), entry->name);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ DirectoryIterator::FindEntry(const char* name, ino_t* _id)
|
|||||||
size_t nameLength = EXT2_NAME_LENGTH;
|
size_t nameLength = EXT2_NAME_LENGTH;
|
||||||
status = Get(buffer, &nameLength, &id);
|
status = Get(buffer, &nameLength, &id);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
if (strcmp(name, buffer) == 0) {
|
if (strncmp(name, buffer, nameLength) == 0) {
|
||||||
if (_id != NULL)
|
if (_id != NULL)
|
||||||
*_id = id;
|
*_id = id;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ HTree::Lookup(const char* name, DirectoryIterator** iterator)
|
|||||||
{
|
{
|
||||||
TRACE("HTree::Lookup()\n");
|
TRACE("HTree::Lookup()\n");
|
||||||
if (!fIndexed || (name[0] == '.'
|
if (!fIndexed || (name[0] == '.'
|
||||||
&& (name[1] == '\0' || (name[1] == '.' && name[2] == '0')))) {
|
&& (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))) {
|
||||||
// No HTree support or looking for trivial directories
|
// No HTree support or looking for trivial directories
|
||||||
return _FallbackToLinearIteration(iterator);
|
return _FallbackToLinearIteration(iterator);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#else
|
#else
|
||||||
# define TRACE(x...) ;
|
# define TRACE(x...) ;
|
||||||
#endif
|
#endif
|
||||||
|
#define ERROR(x...) dprintf("\33[34mext2:\33[0m " x)
|
||||||
|
|
||||||
|
|
||||||
#define EXT2_IO_SIZE 65536
|
#define EXT2_IO_SIZE 65536
|
||||||
@@ -131,7 +132,7 @@ ext2_mount(fs_volume* _volume, const char* device, uint32 flags,
|
|||||||
|
|
||||||
status_t status = volume->Mount(device, flags);
|
status_t status = volume->Mount(device, flags);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
TRACE("Failed mounting the volume. Error: %s\n", strerror(status));
|
ERROR("Failed mounting the volume. Error: %s\n", strerror(status));
|
||||||
delete volume;
|
delete volume;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -194,7 +195,7 @@ ext2_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type,
|
|||||||
Volume* volume = (Volume*)_volume->private_volume;
|
Volume* volume = (Volume*)_volume->private_volume;
|
||||||
|
|
||||||
if (id < 2 || id > volume->NumInodes()) {
|
if (id < 2 || id > volume->NumInodes()) {
|
||||||
dprintf("ext2: invalid inode id %lld requested!\n", id);
|
ERROR("invalid inode id %lld requested!\n", id);
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +212,8 @@ ext2_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type,
|
|||||||
_node->ops = &gExt2VnodeOps;
|
_node->ops = &gExt2VnodeOps;
|
||||||
*_type = inode->Mode();
|
*_type = inode->Mode();
|
||||||
*_flags = 0;
|
*_flags = 0;
|
||||||
}
|
} else
|
||||||
|
ERROR("get_vnode: InitCheck() failed. Error: %s\n", strerror(status));
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user