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.21 2006/05/25 01:47:27 johnfranks 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(int tapefd);
74 int tapefd_unload(int tapefd);
75 int tapefd_fsf(int tapefd, off_t count);
76 int tapefd_weof(int tapefd, off_t count);
78 int tapefd_status(int tapefd, struct am_mt_status *);
80 void tapefd_resetofs(int tapefd);
82 ssize_t tapefd_read(int, void *, size_t);
83 ssize_t tapefd_write(int tapefd, const void *buffer, size_t count);
85 char *tapefd_rdlabel(int tapefd, char **datestamp, char **label);
86 char *tapefd_wrlabel(int tapefd,
91 char *auto_tapefd_label(int tapefd, char **datestamp, char **label);
92 char *auto_tape_label(char *dev, char **datestamp, char **label);
94 char *tapefd_wrendmark(int tapefd, char *datestamp, size_t s);
96 int tapefd_eof(int tapefd); /* just used in tapeio-test */
97 int tapefd_close(int tapefd);
98 int tapefd_can_fork(int tapefd);
100 char *tape_unload(char *dev);
101 char *tape_rewind(char *dev);
102 char *tape_fsf(char *dev, off_t count);
103 char *tape_rdlabel(char *dev, char **datestamp, char **label);
104 char *tape_wrlabel(char *dev,
108 char *tape_wrendmark(char *dev,
111 char *tape_writable(char *dev);
113 int tape_access(char *dev, int mode);
114 int tape_stat(char *filename, struct stat *buf);
116 char *tapefd_getinfo_label(int fd);
117 void tapefd_setinfo_label(int fd, char *v);
118 char *tapefd_getinfo_host(int fd);
119 void tapefd_setinfo_host(int fd, char *v);
120 char *tapefd_getinfo_disk(int fd);
121 void tapefd_setinfo_disk(int fd, char *v);
122 int tapefd_getinfo_level(int fd);
123 void tapefd_setinfo_level(int fd, int v);
124 char *tapefd_getinfo_datestamp(int fd);
125 void tapefd_setinfo_datestamp(int fd, char *v);
126 off_t tapefd_getinfo_length(int fd);
127 void tapefd_setinfo_length(int fd, off_t v);
128 char *tapefd_getinfo_tapetype(int fd);
129 void tapefd_setinfo_tapetype(int fd, char *v);
130 int tapefd_getinfo_fake_label(int fd);
131 void tapefd_setinfo_fake_label(int fd, int v);
132 int tapefd_getinfo_ioctl_fork(int fd);
133 void tapefd_setinfo_ioctl_fork(int fd, int v);
134 void tapefd_set_master_fd(int tapefd, int master_fd);
136 #ifdef HAVE_LINUX_ZFTAPE_H
137 int is_zftape(const char *filename);
140 int tapeio_init_devname(char * dev,
144 char *tapeio_next_devname(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 */