diff options
Diffstat (limited to 'Source/Kernel/VFS/File.class.h')
-rw-r--r-- | Source/Kernel/VFS/File.class.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/Source/Kernel/VFS/File.class.h b/Source/Kernel/VFS/File.class.h index f5d0c56..00b92b6 100644 --- a/Source/Kernel/VFS/File.class.h +++ b/Source/Kernel/VFS/File.class.h @@ -3,35 +3,40 @@ #include <VFS/FileNode.class.h> #include <ByteArray.class.h> +#include <File.iface.h> +#include <SyscallManager/Ressource.class.h> +class Process; -enum { - FM_READ = 0, //Open for read, put cursor at beginning - FM_TRUNCATE = 1, //Open for write, truncating file before - FM_APPEND = 2, //Open for write, put cursor at end - FM_REPLACE = 3 //Open for write, put cursor at beginning -}; - -enum { - SM_FORWARD = 0, //Seek from actual position - SM_BACKWARD = 1, //Seek from actual position, backward - SM_BEGINNING = 2, //Seek from start of file - SM_END = 3, //Seek from end of file -}; - -class File { +class File : public Ressource { protected: FileNode* m_file; bool m_valid; //Is a file opened and valid ? bool m_writable; //Is file opened for write ? u64int m_position; + Process* m_process; + + //Syscalls + static call_t m_callTable[]; + u32int closeSC(); + u32int validSC(); + u32int readSC(u32int, u32int); + u32int writeSC(u32int, u32int); + u32int seekSC(u32int, u32int, u32int); + u32int positionSC(); + u32int lengthSC(); + u32int eofSC(); + bool accessible(); public: + static u32int scall(u8int, u32int, u32int, u32int, u32int); + File(); File(String filename, u8int mode = FM_READ, FSNode* start = 0); virtual ~File(); - bool open(String filename, u8int mode = FM_READ, FSNode* start = 0); + bool open(String filename, u8int mode = FM_READ, FSNode* start = 0, bool vrfyperm = false); void close(bool unregisterFD = true); //unregisterFD = whether or not we must unregister the file descriptor from process + bool valid() { return m_valid; } u32int read(u32int max_length, u8int *data); bool write(u32int length, u8int *data); @@ -49,8 +54,6 @@ class File { u64int position() { return m_position; } u64int length() { return m_file->getLength(); } bool eof(); - - bool valid() { return m_valid; } }; #endif |