The VFS in T/CE : File are objects that implement an abstract file class in the kernel. Its methods are : - int open(process *pr, int mode) - void close(process *pr) - int read(size_t offset, size_t len, char *buffer) - int write(size_t offset, size_t len, char *buffer) - int stat(struct file_info *info) - file* get_child(char* name) - int add_child(char* name, file *child) - int get_size() The following syscall interface is given to the process (fd_t is a file descriptor, an int) : - fd_t open(char* filename, int mode) - fd_t open_relative(fd_t root, char* filename, int mode) - int stat(char* filename, struct file_info *info) - int stat_relative(fd_t root, char* filename, struct file_info *info) - int statf(fd_t file, struct file_info *info) - void close(fd_t file) - int read(fd_t file, size_t offset, size_t len, char *buffer) - int write(fd_t file, size_t offset, size_t len, char *buffer) - int link(char *from, char *to, int mode) struct file_info { int type int dev_type int mode int uid, gid int size } File open modes flags : - FM_READ open for reading - FM_WRITE open for writing - FM_TRUNC truncate existing file - FM_CREATE create file if it doesn't exist - FM_DELETE delete the file - incompatible with everything else note : if mode contains neither FM_READ nor FM_WRITE, then the file will be created/truncated according to the flags given, but will not be actually oppenned, so the return value of open will be 0. Important remark : The kernel does NOT keep track of what your current position in the file is. And it's a bit hard, too, because terminals behave differently than files, and so do directories, etc. So that's why there is no FM_APPEND : when you open a file, you can do whatever you want. Link modes : - LM_SYMLINK - LM_HARDLINK (don't count on that really being implemented) - LM_MOUNT - LM_OUTPUT_TO (keyboard outputs to virtual terminal, virtual terminal outputs to display, that kind of stuff.) File type flags : - FT_FILE - FT_DIR // block devices that contain a partition table will have this flag - FT_SYMLINK - FT_DEV // any kind of device with special properties (keyboard, hdd, disk partition, ...) - FT_TERMINAL // virtual terminal Device types : - DT_BLOCK - DT_KEYBOARD - DT_DISPLAY