Imported Upstream version 2.6.0p2
[debian/amanda] / tape-src / output-rait.h
1 /* NOTE: this driver is *deprecated* and should not be used.  See the Device API
2  * in device-src/ for the new implementation.
3  */
4
5 #ifndef RAIT_H
6
7 #define RAIT_H
8
9 typedef struct {
10     int nopen;
11     int nfds;
12     size_t fd_count;
13     int *fds;
14     ssize_t *readres;
15     size_t xorbuflen;
16     char *xorbuf;
17 } RAIT;
18
19 #ifdef NO_AMANDA
20
21 #define stralloc strdup
22
23 /*
24  * Tape drive status structure.  This abstracts the things we are
25  * interested in from the free-for-all of what the various drivers
26  * supply.
27  */
28
29 struct am_mt_status {
30     char online_valid;                  /* is the online flag valid? */
31     char bot_valid;                     /* is the BOT flag valid? */
32     char eot_valid;                     /* is the EOT flag valid? */
33     char protected_valid;               /* is the protected flag valid? */
34     char flags_valid;                   /* is the flags field valid? */
35     char fileno_valid;                  /* is the fileno field valid? */
36     char blkno_valid;                   /* is the blkno field valid? */
37     char device_status_valid;           /* is the device status field valid? */
38     char error_status_valid;            /* is the device status field valid? */
39
40     char online;                        /* true if device is online/ready */
41     char bot;                           /* true if tape is at the beginning */
42     char eot;                           /* true if tape is at end of medium */
43     char protected;                     /* true if tape is write protected */
44     long flags;                         /* device flags, whatever that is */
45     off_t fileno;                       /* tape file number */
46     off_t blkno;                        /* block within file */
47     int device_status_size;             /* size of orig device status field */
48     unsigned long device_status;        /* "device status", whatever that is */
49     int error_status_size;              /* size of orig error status field */
50     unsigned long error_status;         /* "error status", whatever that is */
51 };
52 #endif
53
54 int rait_open(char *dev, int flags, mode_t mask);
55 int rait_access(char *, int);
56 int rait_stat(char *, struct stat *);
57 int rait_close(int);
58 off_t rait_lseek(int, off_t, int);
59 ssize_t rait_write(int, const void *, size_t);
60 ssize_t rait_read(int, void *, size_t);
61 int rait_ioctl(int, int, void *);
62 int rait_copy(char *f1, char *f2, size_t buflen);
63 char *rait_init_namelist(char * dev, char **dev_left, char **dev_right, char **dev_next);
64 int rait_next_name(char * dev_left, char * dev_right, char **dev_next, char * dev_real);
65 int  rait_tape_open(char *, int, mode_t);
66 int  rait_tapefd_fsf(int rait_tapefd, off_t count);
67 int  rait_tapefd_rewind(int rait_tapefd);
68 void rait_tapefd_resetofs(int rait_tapefd);
69 int  rait_tapefd_unload(int rait_tapefd);
70 int  rait_tapefd_status(int rait_tapefd, struct am_mt_status *stat);
71 int  rait_tapefd_weof(int rait_tapefd, off_t count);
72 int  rait_tapefd_can_fork(int);
73
74 #ifdef RAIT_REDIRECT
75
76 /* handle ugly Solaris stat mess */
77
78 #ifdef _FILE_OFFSET_BITS
79 #include <sys/stat.h>
80 #undef stat
81 #undef open
82 #if _FILE_OFFSET_BITS == 64
83 struct  stat {
84         dev_t   st_dev;
85         long    st_pad1[3];     /* reserved for network id */
86         ino_t   st_ino;
87         mode_t  st_mode;
88         nlink_t st_nlink;
89         uid_t   st_uid;
90         gid_t   st_gid;
91         dev_t   st_rdev;
92         long    st_pad2[2];
93         off_t   st_size;
94         timestruc_t st_atim;
95         timestruc_t st_mtim;
96         timestruc_t st_ctim;
97         long    st_blksize;
98         blkcnt_t st_blocks;
99         char    st_fstype[_ST_FSTYPSZ];
100         long    st_pad4[8];     /* expansion area */
101 };
102 #endif
103
104 #endif
105
106 #define access(p,f)     rait_access(p,f)
107 #define stat(a,b)       rait_stat(a,b)
108 #define open            rait_open
109 #define close(a)        rait_close(a)
110 #define read(f,b,l)     rait_read(f,b,l)
111 #define write(f,b,l)    rait_write(f,b,l)
112 #define ioctl(f,n,x)    rait_ioctl(f,n,x)
113 #endif
114
115 #endif