diff options
author | Alexis211 <alexis211@gmail.com> | 2009-09-19 20:37:05 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-09-19 20:37:05 +0200 |
commit | 0d5f4201217272f93d608be86e644d58f181725a (patch) | |
tree | ac4ac7f6b411cecc024866a26cf7fe158ba75f78 /Source/Kernel/VFS | |
parent | 64fc3862f602750733b7dc0447d22ae5d4146821 (diff) | |
download | Melon-0d5f4201217272f93d608be86e644d58f181725a.tar.gz Melon-0d5f4201217272f93d608be86e644d58f181725a.zip |
Lot of changes. Log now go to /System/Logs/*.log
Diffstat (limited to 'Source/Kernel/VFS')
-rw-r--r-- | Source/Kernel/VFS/File.class.cpp | 4 | ||||
-rw-r--r-- | Source/Kernel/VFS/File.class.h | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Source/Kernel/VFS/File.class.cpp b/Source/Kernel/VFS/File.class.cpp index f3c7d54..69b08de 100644 --- a/Source/Kernel/VFS/File.class.cpp +++ b/Source/Kernel/VFS/File.class.cpp @@ -121,6 +121,10 @@ bool File::seek(u64int count, u8int mode) { return false; } +bool File::eof() { + return m_position == m_file->getLength(); +} + void File::close(bool unregisterFD) { if (!m_valid) return; if (m_writable) diff --git a/Source/Kernel/VFS/File.class.h b/Source/Kernel/VFS/File.class.h index 460036c..ef82a70 100644 --- a/Source/Kernel/VFS/File.class.h +++ b/Source/Kernel/VFS/File.class.h @@ -19,7 +19,7 @@ enum { }; class File { - private: + protected: FileNode* m_file; bool m_valid; //Is a file opened and valid ? bool m_writable; //Is file opened for write ? @@ -28,19 +28,20 @@ class File { public: File(); File(String filename, u8int mode = FM_READ, FSNode* start = 0); - ~File(); + virtual ~File(); bool open(String filename, u8int mode = FM_READ, FSNode* start = 0); void close(bool unregisterFD = true); //unregisterFD = whether or not we must unregister the file descriptor from process u32int read(u32int max_length, u8int *data); bool write(u32int length, u8int *data); - u32int read(ByteArray &data); //Fills ByteArray at its current length or shrinks it if necessary + u32int read(ByteArray &data); //Fills ByteArray at its current length or shrinks it if we can't read enough bool write(ByteArray &data); bool seek(u64int count, u8int mode); u64int position() { return m_position; } u64int length() { return m_file->getLength(); } + bool eof(); bool valid() { return m_valid; } }; |