mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 00:22:36 +02:00
Fix broken SpinLock.
The SpinLock was all backwards and didn't actually work. Fixing it exposed how wrong most of the locking here is. I need to come up with a better granularity here.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 18:36:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e6284a8774b
@@ -78,11 +78,13 @@ ByteBuffer FileSystem::readEntireInode(InodeIdentifier inode, FileHandle* handle
|
||||
auto contents = ByteBuffer::createUninitialized(initialSize);
|
||||
|
||||
Unix::ssize_t nread;
|
||||
byte buffer[512];
|
||||
byte buffer[4096];
|
||||
byte* out = contents.pointer();
|
||||
Unix::off_t offset = 0;
|
||||
for (;;) {
|
||||
nread = readInodeBytes(inode, offset, sizeof(buffer), buffer, handle);
|
||||
//kprintf("nread: %u, bufsiz: %u, initialSize: %u\n", nread, sizeof(buffer), initialSize);
|
||||
ASSERT(nread <= sizeof(buffer));
|
||||
if (nread <= 0)
|
||||
break;
|
||||
memcpy(out, buffer, nread);
|
||||
@@ -95,6 +97,7 @@ ByteBuffer FileSystem::readEntireInode(InodeIdentifier inode, FileHandle* handle
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
contents.trim(offset);
|
||||
return contents;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user