"Fossies" - the Fresh Open Source Software Archive

Member "bonnie++-2.00a/bon_io.h" (13 Sep 2018, 1368 Bytes) of package /linux/privat/bonnie++-2.00a.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "bon_io.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef BON_FILE
    2 #define BON_FILE
    3 
    4 #include "bonnie.h"
    5 #include "thread.h"
    6 class Sync;
    7 class BonTimer;
    8 class Rand;
    9 
   10 class CFileOp : public Thread
   11 {
   12 public:
   13   CFileOp(BonTimer &timer, int file_size, int chunk_bits, bool use_sync
   14 #ifdef O_DIRECT
   15         , bool use_direct_io = false
   16 #endif
   17          );
   18   int Open(CPCCHAR base_name, bool create);
   19   ~CFileOp();
   20   int write_block_byte();
   21   int write_block(PVOID buf);
   22   int read_block_byte(char *buf);
   23   int read_block(PVOID buf);
   24   int seek(int offset, int whence);
   25   int doseek(unsigned int where, bool update);
   26   int seek_test(Rand &r, bool quiet, int Seeks, int SeekProcCount, Sync &s);
   27   void Close();
   28   // reopen a file, bool for whether the file should be unlink()'d and creat()'d
   29   int reopen(bool create);
   30   BonTimer &getTimer() { return m_timer; }
   31   int chunks() const { return m_total_chunks; }
   32 private:
   33   virtual int action(PVOID param); // called for seek test
   34   virtual Thread *newThread(int threadNum);
   35   CFileOp(int threadNum, CFileOp *parent);
   36   int m_open(CPCCHAR base_name, bool create);
   37 
   38   BonTimer &m_timer;
   39   int m_file_size;
   40   FILE_TYPE m_fd;
   41   bool m_isopen;
   42   char *m_name;
   43   bool m_sync;
   44 #ifdef O_DIRECT
   45   bool m_use_direct_io;
   46 #endif
   47   const int m_chunk_bits, m_chunk_size;
   48   int m_total_chunks;
   49   char *m_buf;
   50 
   51   CFileOp(const CFileOp &f);
   52   CFileOp & operator =(const CFileOp &f);
   53 };
   54 
   55 
   56 #endif