2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: James da Silva, Systems Design and Analysis Group
24 * Computer Science Department
25 * University of Maryland at College Park
28 * $Id: tapeio.h,v 1.20 2005/12/21 19:07:51 paddy_s Exp $
30 * interface for tapeio.c
36 #include "util.h" /* For BSTRNCMP */
39 * Tape drive status structure. This abstracts the things we are
40 * interested in from the free-for-all of what the various drivers
45 char online_valid; /* is the online flag valid? */
46 char bot_valid; /* is the BOT flag valid? */
47 char eot_valid; /* is the EOT flag valid? */
48 char protected_valid; /* is the protected flag valid? */
49 char flags_valid; /* is the flags field valid? */
50 char fileno_valid; /* is the fileno field valid? */
51 char blkno_valid; /* is the blkno field valid? */
52 char device_status_valid; /* is the device status field valid? */
53 char error_status_valid; /* is the device status field valid? */
55 char online; /* true if device is online/ready */
56 char bot; /* true if tape is at the beginning */
57 char eot; /* true if tape is at end of medium */
58 char protected; /* true if tape is write protected */
59 long flags; /* device flags, whatever that is */
60 long fileno; /* tape file number */
61 long blkno; /* block within file */
62 int device_status_size; /* size of orig device status field */
63 unsigned long device_status; /* "device status", whatever that is */
64 int error_status_size; /* size of orig error status field */
65 unsigned long error_status; /* "error status", whatever that is */
68 #define FAKE_LABEL "[fake-label]"
69 #define NO_LABEL "[no-label-yet]"
71 int tape_open (char *, int, ...);
73 int tapefd_rewind P((int tapefd));
74 int tapefd_unload P((int tapefd));
75 int tapefd_fsf P((int tapefd, int count));
76 int tapefd_weof P((int tapefd, int count));
78 int tapefd_status P((int tapefd, struct am_mt_status *));
80 void tapefd_resetofs P((int tapefd));
82 ssize_t tapefd_read P((int tapefd, void *buffer, size_t count));
83 ssize_t tapefd_write P((int tapefd, const void *buffer, size_t count));
85 char *tapefd_rdlabel P((int tapefd, char **datestamp, char **label));
86 char *tapefd_wrlabel P((int tapefd,
91 char *auto_tapefd_label P((int tapefd, char **datestamp, char **label));
92 char *auto_tape_label P((char *dev, char **datestamp, char **label));
94 char *tapefd_wrendmark P((int tapefd, char *datestamp, unsigned int s));
96 int tapefd_eof P((int tapefd)); /* just used in tapeio-test */
97 int tapefd_close P((int tapefd));
98 int tapefd_can_fork P((int tapefd));
100 char *tape_unload P((char *dev));
101 char *tape_rewind P((char *dev));
102 char *tape_fsf P((char *dev, int count));
103 char *tape_rdlabel P((char *dev, char **datestamp, char **label));
104 char *tape_wrlabel P((char *dev,
108 char *tape_wrendmark P((char *dev,
111 char *tape_writable P((char *dev));
113 int tape_access P((char *dev, int mode));
114 int tape_stat P((char *filename, struct stat *buf));
116 char *tapefd_getinfo_label P((int fd));
117 void tapefd_setinfo_label P((int fd, char *v));
118 char *tapefd_getinfo_host P((int fd));
119 void tapefd_setinfo_host P((int fd, char *v));
120 char *tapefd_getinfo_disk P((int fd));
121 void tapefd_setinfo_disk P((int fd, char *v));
122 int tapefd_getinfo_level P((int fd));
123 void tapefd_setinfo_level P((int fd, int v));
124 char *tapefd_getinfo_datestamp P((int fd));
125 void tapefd_setinfo_datestamp P((int fd, char *v));
126 long tapefd_getinfo_length P((int fd));
127 void tapefd_setinfo_length P((int fd, long v));
128 char *tapefd_getinfo_tapetype P((int fd));
129 void tapefd_setinfo_tapetype P((int fd, char *v));
130 int tapefd_getinfo_fake_label P((int fd));
131 void tapefd_setinfo_fake_label P((int fd, int v));
132 int tapefd_getinfo_ioctl_fork P((int fd));
133 void tapefd_setinfo_ioctl_fork P((int fd, int v));
134 void tapefd_set_master_fd P((int tapefd, int master_fd));
136 #ifdef HAVE_LINUX_ZFTAPE_H
137 int is_zftape P((const char *filename));
140 int tapeio_init_devname P((char * dev,
144 char *tapeio_next_devname P((char * dev_left,
148 #define NOT_AMANDA_TAPE_MSG "not an amanda tape"
149 #define CHECK_NOT_AMANDA_TAPE_MSG(x) (!BSTRNCMP(x, NOT_AMANDA_TAPE_MSG))
151 #endif /* ! TAPEIO_H */