summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-17 09:48:32 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-17 09:48:32 +0200
commit0a64a7b2817fb56bbc4640e27a484eb479e0bb22 (patch)
treea8d37a29d622aaf4104e1ef438b9389d4b2275df
parentcc437b9263b51f96484762e91a15c1584ede1e83 (diff)
downloadTCE-0a64a7b2817fb56bbc4640e27a484eb479e0bb22.tar.gz
TCE-0a64a7b2817fb56bbc4640e27a484eb479e0bb22.zip
Added some documentation about the coming VFS.
-rw-r--r--doc/syscalls.txt4
-rw-r--r--doc/vfs.txt55
-rw-r--r--src/kernel/lib/earray.h2
3 files changed, 59 insertions, 2 deletions
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
diff --git a/src/kernel/lib/earray.h b/src/kernel/lib/earray.h
index b6d0a55..d3d7a9b 100644
--- a/src/kernel/lib/earray.h
+++ b/src/kernel/lib/earray.h
@@ -28,6 +28,8 @@ struct earray {
int add(T* ptr); // return element number or -1 if fail
T* at(int num); // returns 0 when nothing
void set(int num, T* ptr);
+
+ int count() { return elements; }
};