20 #define FILE_RESERVED_NUM (THREAD_MAX + 3)
21 #define THREAD_PIPE_FD(thread_id) (thread_id + 3)
49 typedef void (*drv_init_func_t)(void);
77 struct file *dev_file;
104 uint32_t reserved2[2];
110 char d_name[NAME_MAX];
117 uint32_t reserved[2];
121 struct inode *f_inode;
129 off_t (*lseek)(
struct file *filp, off_t offset,
int whence);
130 ssize_t (*
read)(
struct file *filp,
char *buf,
size_t size, off_t offset);
135 int (*
ioctl)(
struct file *,
unsigned int cmd,
unsigned long arg);
144 void rootfs_init(
void);
146 void link_stdin_dev(
char *path);
147 void link_stdout_dev(
char *path);
148 void link_stderr_dev(
char *path);
154 uint32_t fs_get_block_addr(
struct inode *
inode,
int blk_index);
155 uint32_t fs_file_append_block(
struct inode *
inode);
157 void request_create_file(
int thread_id,
const char *path, uint8_t file_type);
158 void request_open_file(
int thread_id,
const char *path);
159 void request_open_directory(
int reply_fd,
const char *path);
160 void request_mount(
int thread_id,
const char *source,
const char *target);
161 void request_getcwd(
int thread_id,
char *buf,
size_t len);
162 void request_chdir(
int thread_id,
const char *path);
166 void fs_print_inode_bitmap(
void);
167 void fs_print_block_bitmap(
void);
int open(const char *pathname, int flags)
Open the file specified by the pathname.
Definition: file.c:15
int ioctl(int fd, unsigned int request, unsigned long arg)
Perform device-specific control.
Definition: file.c:60
ssize_t write(int fd, const void *buf, size_t count)
Write up to count bytes from the buffer starting at buf to the file referred to by the file descripto...
Definition: file.c:55
ssize_t read(int fd, void *buf, size_t count)
Attempt to read up to count bytes from file descriptor fd into the buffer starting at buf.
Definition: file.c:45