fd: new abstraction

This commit is contained in:
Matheus
2022-09-18 16:21:19 -03:00
parent 73a8584a72
commit 41d6e7230e
11 changed files with 216 additions and 151 deletions
+16 -1
View File
@@ -29,14 +29,29 @@
#define O_RSYNC 04010000
#define O_TMPFILE 020000000
#include <stdint.h>
#include <stddef.h>
typedef struct {
uintmax_t refcount;
vnode_t* node;
off_t offset;
int flags;
int lock;
mode_t mode;
} fd_t;
typedef struct {
int lock;
size_t fdcount;
uintmax_t firstfreefd;
fd_t** fd;
} fdtable_t;
int fd_alloc(fdtable_t* fdtable, fd_t** fd, int* ifd);
int fd_free(fdtable_t* fdtable, int ifd);
int fd_access(fdtable_t* fdtable, fd_t** fd, int ifd);
int fd_release(fd_t* fd);
int fd_tableinit(fdtable_t* fdtable);
#endif