Luna/kernel/include/fs/FileDescriptor.h

35 lines
516 B
C
Raw Normal View History

2022-10-10 17:00:24 +00:00
#pragma once
#include "fs/VFS.h"
#include <stdint.h>
struct Descriptor
{
bool is_open()
{
return m_is_open;
}
bool can_read()
{
return m_can_read && m_is_open;
}
void close()
{
m_is_open = false;
}
ssize_t read(size_t size, char* buffer);
void open(VFS::Node* node, bool can_read);
Descriptor(const Descriptor& other);
Descriptor();
private:
uint64_t m_offset;
VFS::Node* m_node;
bool m_can_read;
bool m_is_open;
}