root / synthbench / bonnie++ / bon_io.h @ 0:839f52ef7657
History | View | Annotate | Download (1.2 kB)
1 |
#ifndef BON_FILE
|
---|---|
2 |
#define BON_FILE
|
3 |
|
4 |
#include "bonnie.h" |
5 |
class Semaphore; |
6 |
class BonTimer; |
7 |
|
8 |
class CFileOp |
9 |
{ |
10 |
public:
|
11 |
CFileOp(BonTimer &timer, int file_size, int chunk_bits, bool use_sync = false); |
12 |
int open(CPCCHAR base_name, bool create, bool use_fopen = false); |
13 |
~CFileOp(); |
14 |
int write_block_putc();
|
15 |
int write_block(PVOID buf);
|
16 |
int read_block_getc(char *buf); |
17 |
int read_block(PVOID buf);
|
18 |
int seek(int offset, int whence); |
19 |
int doseek(long where, bool update); |
20 |
int seek_test(bool quiet, Semaphore &s); |
21 |
void close();
|
22 |
// reopen a file, bools for whether the file should be unlink()'d and
|
23 |
// creat()'d and for whether fopen should be used
|
24 |
int reopen(bool create, bool use_fopen = false); |
25 |
BonTimer &getTimer() { return m_timer; }
|
26 |
int chunks() const { return m_total_chunks; } |
27 |
private:
|
28 |
int m_open(CPCCHAR base_name, int ind, bool create); |
29 |
|
30 |
BonTimer &m_timer; |
31 |
FILE **m_stream; |
32 |
FILE_TYPE *m_fd; |
33 |
bool m_isopen;
|
34 |
char *m_name;
|
35 |
bool m_sync;
|
36 |
const int m_chunk_bits, m_chunk_size; |
37 |
int m_chunks_per_file, m_total_chunks;
|
38 |
int m_last_file_chunks;
|
39 |
int m_cur_pos;
|
40 |
int m_file_ind;
|
41 |
int m_file_size;
|
42 |
int m_num_files;
|
43 |
CFileOp(const CFileOp &f);
|
44 |
CFileOp & operator =(const CFileOp &f);
|
45 |
char *m_buf;
|
46 |
}; |
47 |
|
48 |
|
49 |
#endif
|