diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-10-31 13:14:26 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-10-31 13:14:26 +0100 |
commit | 697261c981fa877b94661d310c07b216ca708f4f (patch) | |
tree | cd24930cf7529657301f8d886dc510bdc594c989 /tools.h | |
parent | 998e3bd2c7d19485d001f1531d93fda2e92edb03 (diff) | |
download | vdr-697261c981fa877b94661d310c07b216ca708f4f.tar.gz vdr-697261c981fa877b94661d310c07b216ca708f4f.tar.bz2 |
The new class cUnbufferedFile is used for the recording files to avoid thrashing the file system cache1.3.35
Diffstat (limited to 'tools.h')
-rw-r--r-- | tools.h | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.80 2005/10/09 11:13:06 kls Exp $ + * $Id: tools.h 1.81 2005/10/31 12:54:36 kls Exp $ */ #ifndef __TOOLS_H @@ -198,6 +198,27 @@ public: bool Close(void); }; +/// cUnbufferedFile is used for large files that are mainly written or read +/// in a streaming manner, and thus should not be cached. + +class cUnbufferedFile { +private: + int fd; + off_t begin; + off_t end; + off_t ahead; + ssize_t written; +public: + cUnbufferedFile(void); + ~cUnbufferedFile(); + int Open(const char *FileName, int Flags, mode_t Mode = DEFFILEMODE); + int Close(void); + off_t Seek(off_t Offset, int Whence); + ssize_t Read(void *Data, size_t Size); + ssize_t Write(const void *Data, size_t Size); + static cUnbufferedFile *Create(const char *FileName, int Flags, mode_t Mode = DEFFILEMODE); + }; + class cLockFile { private: char *fileName; |