The Pedigree Project
0.1
src
modules
system
vfs
FileHandle.h
1
/* Copyright (c) 2026, Pedigree Developers. */
2
#ifndef PEDIGREE_VFS_FILEHANDLE_H
3
#define PEDIGREE_VFS_FILEHANDLE_H
4
5
#include "pedigree/kernel/compiler.h"
6
#include "pedigree/kernel/process/TerminationDeferral.h"
7
#include "pedigree/kernel/processor/types.h"
8
9
class
File
;
10
11
struct
FileHandle
{
12
uint32_t length = 0;
13
int32_t type = 0;
14
uint8_t bytes[128] = {};
15
};
16
17
struct
FileSystemId
{
18
uint32_t words[2] = {};
19
};
20
21
enum class
FileHandleStatus { Success, Unsupported, Stale, Invalid, NoMemory, IoError };
22
24
class
EXPORTED_PUBLIC
RetainedFile
{
25
public
:
26
RetainedFile
();
27
RetainedFile
(
RetainedFile
&& other)
noexcept
;
28
~RetainedFile
();
29
RetainedFile
& operator=(
RetainedFile
&& other)
noexcept
;
30
File
* get()
const
{
31
return
m_File;
32
}
33
explicit
operator
bool()
const
{
34
return
m_File !=
nullptr
;
35
}
36
void
adopt(
File
* file);
37
void
reset();
38
39
private
:
40
RetainedFile
(
const
RetainedFile
&) =
delete
;
41
RetainedFile
& operator=(
const
RetainedFile
&) =
delete
;
42
TerminationDeferral
m_Lifetime;
43
File
* m_File =
nullptr
;
44
};
45
46
#endif
File
Definition
File.h:74
RetainedFile
Definition
FileHandle.h:24
TerminationDeferral
Definition
TerminationDeferral.h:27
FileHandle
Definition
FileHandle.h:11
FileSystemId
Definition
FileHandle.h:17
Generated on Tue Sep 22 2026 06:05:49 for The Pedigree Project by
1.9.8