file: change fd_new and flag converter

This commit is contained in:
Matheus
2023-05-09 23:07:29 -03:00
parent e785da6cb3
commit 32772a7a9b
2 changed files with 18 additions and 4 deletions
+17 -1
View File
@@ -20,8 +20,24 @@ typedef struct fd_t {
file_t *fd_get(int fd);
void fd_release(file_t *file);
int fd_new(vnode_t *node, int flags, file_t **file, int *fd);
int fd_new(int flags, file_t **file, int *fd);
int fd_close(int fd);
int fd_dup(int oldfd, int newfd, bool exact, int flags, int *ret);
#define FILE_READ 1
#define FILE_WRITE 2
#define FILE_KNOWN_FLAGS 3
static inline int fileflagstovnodeflags(int flags) {
int vnflags = 0;
if (flags & FILE_READ)
vnflags |= V_FFLAGS_READ;
if (flags & FILE_WRITE)
vnflags |= V_FFLAGS_WRITE;
return vnflags;
}
#define AT_FDCWD -100
#endif