* 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:
parent
c454897103
commit
f7218c2187
@ -206,8 +206,8 @@ DirectoryIterator::Next()
|
||||
TRACE("DirectoryIterator::Next() skipping entry %d %ld\n", entry->Length(), entry->InodeID());
|
||||
} while (entry->Length() == 0 || entry->InodeID() == 0);
|
||||
|
||||
TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %s\n",
|
||||
entry->Length(), entry->name);
|
||||
TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %*s\n",
|
||||
entry->Length(), entry->NameLength(), entry->name);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -313,7 +313,7 @@ DirectoryIterator::FindEntry(const char* name, ino_t* _id)
|
||||
size_t nameLength = EXT2_NAME_LENGTH;
|
||||
status = Get(buffer, &nameLength, &id);
|
||||
if (status == B_OK) {
|
||||
if (strcmp(name, buffer) == 0) {
|
||||
if (strncmp(name, buffer, nameLength) == 0) {
|
||||
if (_id != NULL)
|
||||
*_id = id;
|
||||
return B_OK;
|
||||
|
@ -110,7 +110,7 @@ HTree::Lookup(const char* name, DirectoryIterator** iterator)
|
||||
{
|
||||
TRACE("HTree::Lookup()\n");
|
||||
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
|
||||
return _FallbackToLinearIteration(iterator);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#else
|
||||
# define TRACE(x...) ;
|
||||
#endif
|
||||
#define ERROR(x...) dprintf("\33[34mext2:\33[0m " x)
|
||||
|
||||
|
||||
#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);
|
||||
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;
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -211,7 +212,8 @@ ext2_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type,
|
||||
_node->ops = &gExt2VnodeOps;
|
||||
*_type = inode->Mode();
|
||||
*_flags = 0;
|
||||
}
|
||||
} else
|
||||
ERROR("get_vnode: InitCheck() failed. Error: %s\n", strerror(status));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user