mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 18:23:39 +00:00
33 lines
645 B
C++
33 lines
645 B
C++
#pragma once
|
|
|
|
#include "VirtualFileSystem.h"
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
class FileHandle {
|
|
public:
|
|
explicit FileHandle(RetainPtr<VirtualFileSystem::Node>&&);
|
|
~FileHandle();
|
|
|
|
Unix::off_t seek(Unix::off_t, int whence);
|
|
Unix::ssize_t read(byte* buffer, Unix::size_t count);
|
|
int stat(Unix::stat*);
|
|
|
|
ByteBuffer readEntireFile();
|
|
|
|
#ifdef SERENITY_KERNEL
|
|
int fd() const { return m_fd; }
|
|
void setFD(int fd) { m_fd = fd; }
|
|
#endif
|
|
|
|
private:
|
|
friend class VirtualFileSystem;
|
|
|
|
RetainPtr<VirtualFileSystem::Node> m_vnode;
|
|
|
|
Unix::off_t m_currentOffset { 0 };
|
|
|
|
#ifdef SERENITY_KERNEL
|
|
int m_fd { -1 };
|
|
#endif
|
|
};
|
|
|