diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-17 09:48:32 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-17 09:48:32 +0200 |
commit | 0a64a7b2817fb56bbc4640e27a484eb479e0bb22 (patch) | |
tree | a8d37a29d622aaf4104e1ef438b9389d4b2275df /doc/vfs.txt | |
parent | cc437b9263b51f96484762e91a15c1584ede1e83 (diff) | |
download | TCE-0a64a7b2817fb56bbc4640e27a484eb479e0bb22.tar.gz TCE-0a64a7b2817fb56bbc4640e27a484eb479e0bb22.zip |
Added some documentation about the coming VFS.
Diffstat (limited to 'doc/vfs.txt')
-rw-r--r-- | doc/vfs.txt | 55 |
1 files changed, 55 insertions, 0 deletions
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 |