mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
Work on POSIX-like read() and lseek() support.
This commit is contained in:
parent
9f9b4a2382
commit
c94044a04a
11 changed files with 201 additions and 36 deletions
|
@ -3,16 +3,27 @@
|
|||
#include "VirtualFileSystem.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
|
||||
enum class SeekType {
|
||||
Absolute, // SEEK_SET
|
||||
RelativeToCurrent, // SEEK_CUR
|
||||
RelativeToEnd, // SEEK_END
|
||||
};
|
||||
|
||||
class FileHandle {
|
||||
public:
|
||||
explicit FileHandle(RetainPtr<VirtualFileSystem::Node>&&);
|
||||
~FileHandle();
|
||||
|
||||
ByteBuffer read();
|
||||
FileOffset lseek(FileOffset, SeekType);
|
||||
ssize_t read(byte* buffer, size_t count);
|
||||
|
||||
ByteBuffer readEntireFile();
|
||||
|
||||
private:
|
||||
friend class VirtualFileSystem;
|
||||
|
||||
RetainPtr<VirtualFileSystem::Node> m_vnode;
|
||||
|
||||
FileOffset m_currentOffset { 0 };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue