2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2010 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation, which is
11 listed in the file LICENSE.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * vtape.h - Emulate the Linux st (scsi tape) driver on file.
30 * for regression and bug hunting purpose
41 void vtape_debug(int level);
45 #define FTAPE_MAX_DRIVE 50
47 #define VTAPE_MAX_BLOCK 20*1024*2048; /* 20GB */
50 VT_READ_EOF, /* Need to read the entire EOF struct */
51 VT_SKIP_EOF /* Have already read the EOF byte */
54 class vtape: public DEVICE {
56 int fd; /* Our file descriptor */
58 boffset_t file_block; /* size */
61 boffset_t last_FM; /* last file mark (last file) */
62 boffset_t next_FM; /* next file mark (next file) */
63 boffset_t cur_FM; /* current file mark */
65 bool atEOF; /* End of file */
66 bool atEOT; /* End of media */
67 bool atEOD; /* End of data */
68 bool atBOT; /* Begin of tape */
69 bool online; /* volume online */
70 bool needEOF; /* check if last operation need eof */
72 int32_t last_file; /* last file of the volume */
73 int32_t current_file; /* current position */
74 int32_t current_block; /* current position */
79 void check_eof() { if(needEOF) weof();};
81 bool read_fm(VT_READ_FM_MODE readfirst);
95 /* interface from DEVICE */
97 int d_open(const char *pathname, int flags);
98 int d_ioctl(int fd, ioctl_req_t request, char *mt=NULL);
99 ssize_t d_read(int, void *buffer, size_t count);
100 ssize_t d_write(int, const void *buffer, size_t count);
102 boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }
103 boffset_t lseek(int fd, off_t offset, int whence);
105 int tape_op(struct mtop *mt_com);
106 int tape_get(struct mtget *mt_com);
107 int tape_pos(struct mtpos *mt_com);
111 #else /*!USE_VTAPE */
113 class vtape: public DEVICE {
115 int d_open(const char *pathname, int flags) { return -1; }
116 ssize_t d_read(void *buffer, size_t count) { return -1; }
117 ssize_t d_write(const void *buffer, size_t count) { return -1; }
118 int d_close(int) { return -1; }
119 int d_ioctl(int fd, ioctl_req_t request, char *mt=NULL) { return -1; }
120 boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }
123 #endif /* USE_VTAPE */
125 #endif /* !VTAPE_H */