You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riscv-pke/kernel/proc_file.h

33 lines
902 B

#ifndef _PROC_FILE_H_
#define _PROC_FILE_H_
#include "spike_interface/spike_file.h"
#include "util/types.h"
#include "vfs.h"
//
// file operations
//
int do_open(char *pathname, int flags);
int do_read(int fd, char *buf, uint64 count);
int do_write(int fd, char *buf, uint64 count);
int do_lseek(int fd, int offset, int whence);
int do_stat(int fd, struct istat *istat);
int do_disk_stat(int fd, struct istat *istat);
int do_close(int fd);
void fs_init(void);
// data structure that manages all openned files in a PCB
typedef struct proc_file_management_t {
struct dentry *cwd; // vfs dentry of current working directory
struct file opened_files[MAX_FILES]; // opened files array
int nfiles; // the number of files opened by a process
} proc_file_management;
proc_file_management *init_proc_file_management(void);
void reclaim_proc_file_management(proc_file_management *pfiles);
#endif