Merge pull request #762 from wheremyfoodat/seek
FS: Add missing file seeks
This commit is contained in:
@@ -14,7 +14,6 @@ namespace FileOps {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Kernel::handleFileOperation(u32 messagePointer, Handle file) {
|
void Kernel::handleFileOperation(u32 messagePointer, Handle file) {
|
||||||
const u32 cmd = mem.read32(messagePointer);
|
const u32 cmd = mem.read32(messagePointer);
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
@@ -89,6 +88,7 @@ void Kernel::readFile(u32 messagePointer, Handle fileHandle) {
|
|||||||
if (file->fd) {
|
if (file->fd) {
|
||||||
std::unique_ptr<u8[]> data(new u8[size]);
|
std::unique_ptr<u8[]> data(new u8[size]);
|
||||||
IOFile f(file->fd);
|
IOFile f(file->fd);
|
||||||
|
f.seek(offset);
|
||||||
|
|
||||||
auto [success, bytesRead] = f.readBytes(data.get(), size);
|
auto [success, bytesRead] = f.readBytes(data.get(), size);
|
||||||
|
|
||||||
@@ -146,6 +146,7 @@ void Kernel::writeFile(u32 messagePointer, Handle fileHandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IOFile f(file->fd);
|
IOFile f(file->fd);
|
||||||
|
f.seek(offset);
|
||||||
auto [success, bytesWritten] = f.writeBytes(data.get(), size);
|
auto [success, bytesWritten] = f.writeBytes(data.get(), size);
|
||||||
|
|
||||||
// TODO: Should this check only the byte?
|
// TODO: Should this check only the byte?
|
||||||
|
|||||||
Reference in New Issue
Block a user