feat(iso): modified fd struct and func proto
This commit is contained in:
parent
1daa8e6263
commit
04bbb27df6
7
k/fd.c
7
k/fd.c
@ -1,6 +1,6 @@
|
|||||||
#include "fd.h"
|
#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)
|
static int find_next_fd(void)
|
||||||
{
|
{
|
||||||
@ -13,14 +13,13 @@ static int find_next_fd(void)
|
|||||||
return -1;
|
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();
|
int free_fd = find_next_fd();
|
||||||
if (free_fd < 0)
|
if (free_fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
struct file_entry f = { .open = 0, .lba = lba, .file_offset = 0,
|
struct file_entry f = { 0, lba, 0, file_size, is_dir };
|
||||||
.file_size = file_size };
|
|
||||||
fd_table[free_fd] = f;
|
fd_table[free_fd] = f;
|
||||||
return free_fd;
|
return free_fd;
|
||||||
}
|
}
|
||||||
|
5
k/fd.h
5
k/fd.h
@ -11,9 +11,12 @@ struct file_entry
|
|||||||
u32 lba;
|
u32 lba;
|
||||||
u32 file_offset;
|
u32 file_offset;
|
||||||
u32 file_size;
|
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);
|
int destroy_fd(int fd);
|
||||||
|
|
||||||
#endif /* !FD_H */
|
#endif /* !FD_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user