#include <stddef.h>
#include "bacula.h"
-#ifdef USE_FAKETAPE
-
#define FTAPE_MAX_DRIVE 50
/*
* Theses functions will replace open/read/write
*/
-int faketape_open(const char *pathname, int flags);
+int faketape_open(const char *pathname, int flags, ...);
int faketape_read(int fd, void *buffer, unsigned int count);
int faketape_write(int fd, const void *buffer, unsigned int count);
int faketape_close(int fd);
int faketape_ioctl(int fd, unsigned long int request, ...);
void faketape_debug(int level);
+typedef enum {
+ FT_READ_EOF, /* Need to read the entire EOF struct */
+ FT_SKIP_EOF /* Have already read the EOF byte */
+} FT_READ_FM_MODE;
+
class faketape {
private:
int fd; /* Our file descriptor */
- off_t file_size; /* size */
+ off_t file_block; /* size */
off_t max_block;
+ off_t last_FM; /* last file mark (last file) */
+ off_t next_FM; /* next file mark (next file) */
+ off_t cur_FM; /* current file mark */
+
bool atEOF; /* End of file */
bool atEOT; /* End of media */
bool atEOD; /* End of data */
bool atBOT; /* Begin of tape */
bool online; /* volume online */
- bool inplace; /* have to seek before writing ? */
bool needEOF; /* check if last operation need eof */
int32_t last_file; /* last file of the volume */
- int32_t current_file; /* max 65000 files */
- int32_t current_block; /* max 4G blocks of 1KB */
- off_t current_pos; /* current position in stream */
+ int32_t current_file; /* current position */
+ int32_t current_block; /* current position */
void destroy();
- int find_maxfile();
int offline();
int truncate_file();
- int seek_file();
- void check_eof() { if(needEOF) weof(1);};
+ void check_eof() { if(needEOF) weof();};
+ void update_pos();
+ bool read_fm(FT_READ_FM_MODE readfirst);
public:
- int fsf(int count);
+ int fsf();
int fsr(int count);
- int weof(int count);
- int bsf(int count);
+ int weof();
+ int bsf();
int bsr(int count);
faketape();
int tape_pos(struct mtpos *mt_com);
};
-#endif /* USE_FAKETAPE */
#endif /* !FAKETAPE_H */