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