From 0a64a7b2817fb56bbc4640e27a484eb479e0bb22 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 17 May 2012 09:48:32 +0200 Subject: Added some documentation about the coming VFS. --- doc/syscalls.txt | 4 ++-- doc/vfs.txt | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 doc/vfs.txt (limited to 'doc') diff --git a/doc/syscalls.txt b/doc/syscalls.txt index 5df2cf6..bb53a45 100644 --- a/doc/syscalls.txt +++ b/doc/syscalls.txt @@ -18,8 +18,8 @@ id=ebx Name Parameters Description 9 sbrk ecx: size Allocates some memory 10 brk ecx: new_end Allocates/frees some memory - 11 mmap (see linux specs) - 12 munmap (see linux specs) + 11 mmap (see linux specs) not implemented + 12 munmap (see linux specs) not implemented If a processes wishes to exit with an error code, it HAS to use process_exit. thread_exit will do nothing. diff --git a/doc/vfs.txt b/doc/vfs.txt new file mode 100644 index 0000000..255ddb0 --- /dev/null +++ b/doc/vfs.txt @@ -0,0 +1,55 @@ +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) + +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 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_APPEND append data +- FM_TRUNC truncate existing file +- FM_CREATE create file if it doesn't exist +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. + +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 -- cgit v1.2.3