blob: 23c584df259a0f42543e6dbce1b8b63553284d5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#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*);
bool hasDataAvailableForRead();
ssize_t get_dir_entries(byte* buffer, Unix::size_t);
ByteBuffer readEntireFile();
String absolutePath() const;
#ifdef SERENITY
int fd() const { return m_fd; }
void setFD(int fd) { m_fd = fd; }
bool isBlocking() const { return m_isBlocking; }
void setBlocking(bool b) { m_isBlocking = b; }
#endif
private:
friend class VirtualFileSystem;
RetainPtr<VirtualFileSystem::Node> m_vnode;
Unix::off_t m_currentOffset { 0 };
#ifdef SERENITY
int m_fd { -1 };
bool m_isBlocking { true };
#endif
};
|