From 04bbb27df6495bec91c49343475ad0c37f01f241 Mon Sep 17 00:00:00 2001 From: Malo Lecomte Date: Sun, 24 Apr 2022 02:17:53 +0200 Subject: [PATCH] feat(iso): modified fd struct and func proto --- k/fd.c | 7 +++---- k/fd.h | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/k/fd.c b/k/fd.c index 63c7396..5aae201 100644 --- a/k/fd.c +++ b/k/fd.c @@ -1,6 +1,6 @@ #include "fd.h" -static struct file_entry fd_table[MAX_FD] = { 0 }; +struct file_entry fd_table[MAX_FD] = { 0 }; static int find_next_fd(void) { @@ -13,14 +13,13 @@ static int find_next_fd(void) return -1; } -int register_fd(u32 lba, u32 file_size) +int register_fd(u32 lba, u32 file_size, u8 is_dir) { int free_fd = find_next_fd(); if (free_fd < 0) return -1; - struct file_entry f = { .open = 0, .lba = lba, .file_offset = 0, - .file_size = file_size }; + struct file_entry f = { 0, lba, 0, file_size, is_dir }; fd_table[free_fd] = f; return free_fd; } diff --git a/k/fd.h b/k/fd.h index be1db1a..cc2d022 100644 --- a/k/fd.h +++ b/k/fd.h @@ -11,9 +11,12 @@ struct file_entry u32 lba; u32 file_offset; u32 file_size; + u8 is_dir; }; -int register_fd(u32 lba, u32 file_size); +extern struct file_entry fd_table[MAX_FD]; + +int register_fd(u32 lba, u32 file_size, u8 is_dir); int destroy_fd(int fd); #endif /* !FD_H */