From 0d5f4201217272f93d608be86e644d58f181725a Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 19 Sep 2009 20:37:05 +0200 Subject: Lot of changes. Log now go to /System/Logs/*.log --- Source/Kernel/VFS/File.class.cpp | 4 ++++ Source/Kernel/VFS/File.class.h | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Source/Kernel/VFS') 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; } }; -- cgit v1.2.3