Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
fd.h
Go to the documentation of this file.
1
#ifndef __SYS_FD_H__
2
#define __SYS_FD_H__
3
4
#include "
vfs/dentry.h
"
5
#include <
type.h
>
6
7
#define INITIAL_MAX_FDS 64
8
9
struct
fdtable
;
10
struct
file_descriptor
{
11
atomic_t
count
;
12
struct
fdtable
*
fdt
;
13
void
*
ops
;
14
uint8_t
mode
;
15
uint64_t
pos
;
16
uint32_t
flags
;
17
vnode_ptr_t
vnode
;
18
}
__attribute__
((aligned(64)));
19
20
struct
fdtable
{
21
uint32_t
max_fds
;
22
struct
file_descriptor
**
fds
;
23
uint32_t
next_fd
;
24
};
25
26
struct
fdtable
*
alloc_fdtable
();
27
void
free_fdtable
(
struct
fdtable
*
fdt
);
28
struct
file_descriptor
*
alloc_fd
();
29
30
// TODO
31
int
realloc_fdtable
(
struct
fdtable
*
fdt
,
uint32_t
max_fds);
32
33
#endif
// __SYS_FD_H__
dentry.h
vnode_ptr_t
struct vnode * vnode_ptr_t
Definition
dentry.h:115
__attribute__
struct fdtable __attribute__
alloc_fd
struct file_descriptor * alloc_fd()
Definition
fd.c:13
fdt
struct fdtable * fdt
Definition
fd.h:1
free_fdtable
void free_fdtable(struct fdtable *fdt)
Definition
fd.c:19
realloc_fdtable
int realloc_fdtable(struct fdtable *fdt, uint32_t max_fds)
alloc_fdtable
struct fdtable * alloc_fdtable()
Definition
fd.c:4
atomic_t
Definition
type.h:79
fdtable
Definition
fd.h:20
fdtable::max_fds
uint32_t max_fds
Definition
fd.h:21
fdtable::next_fd
uint32_t next_fd
Definition
fd.h:23
fdtable::fds
struct file_descriptor ** fds
Definition
fd.h:22
file_descriptor
Definition
fd.h:10
file_descriptor::mode
uint8_t mode
Definition
fd.h:14
file_descriptor::fdt
struct fdtable * fdt
Definition
fd.h:12
file_descriptor::flags
uint32_t flags
Definition
fd.h:16
file_descriptor::vnode
vnode_ptr_t vnode
Definition
fd.h:17
file_descriptor::pos
uint64_t pos
Definition
fd.h:15
file_descriptor::ops
void * ops
Definition
fd.h:13
file_descriptor::count
atomic_t count
Definition
fd.h:11
type.h
uint32_t
unsigned int uint32_t
Definition
type.h:19
uint64_t
unsigned long uint64_t
Definition
type.h:25
uint8_t
unsigned char uint8_t
Definition
type.h:7
kernel
sys
fd.h
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2