Imported Debian patch 1.2.16rel-5
[debian/mtx] / mtxl.h
1 /* 
2   MTX -- SCSI Tape Attached Medium Changer Control Program
3
4   Copyright 1997-1998 Leonard N. Zubkoff <lnz@dandelion.com>
5   This file created by Eric Lee Green <eric@estinc.com>
6   
7   This program is free software; you may redistribute and/or modify it under
8   the terms of the GNU General Public License Version 2 as published by the
9   Free Software Foundation.
10
11   This program is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
13   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   for complete details.
15
16   $Date: 2001/06/19 21:51:32 $
17   $Revision: 1.2 $
18 */
19
20 /* Much of the guts of mtx.c has been extracted to mtxl.c, a library file
21  * full of utility routines. This file is the header file for that library.
22  *   -E
23  */
24
25 #ifndef MTXL_H
26 #define MTXL_H 1
27
28 #include "mtx.h"
29
30 void FatalError(char *ErrorMessage, ...);
31 void *xmalloc(size_t Size);
32 void *xzmalloc(size_t Size);
33 void slow_bzero(char *buffer, int numchars);
34
35 DEVICE_TYPE SCSI_OpenDevice(char *DeviceName);
36 void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD);
37 int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD,
38                                Direction_T Direction,
39                                CDB_T *CDB,
40                                int CDB_Length,
41                                void *DataBuffer,
42                                int DataBufferLength,
43                                RequestSense_T *RequestSense);
44
45 void PrintRequestSense(RequestSense_T *RequestSense);
46
47 int BigEndian16(unsigned char *BigEndianData);
48 int BigEndian24(unsigned char *BigEndianData);
49 int min(int x, int y);
50 int max(int x, int y);
51
52 ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *RequestSense, Inquiry_T *inquiry_info, SCSI_Flags_T *flags);
53
54 Inquiry_T *RequestInquiry(DEVICE_TYPE fd, RequestSense_T *RequestSense);
55
56 RequestSense_T *MoveMedium(DEVICE_TYPE MediumChangerFD, int SourceAddress,
57                        int DestinationAddress, 
58                        ElementStatus_T *ElementStatus, 
59                            Inquiry_T *inquiry_info, SCSI_Flags_T *flags);
60
61 int Inventory(DEVICE_TYPE MediumChangerFD);  /* inventory library */
62 int Eject(DEVICE_TYPE fd);                  /* unload tape or magazine */
63 RequestSense_T *Erase(DEVICE_TYPE fd);        /* send SHORT erase to drive */
64
65 void SCSI_Set_Timeout(int secs); /* set the SCSI timeout */
66 void SCSI_Default_Timeout(void);  /* go back to default timeout */
67
68 /* we may not have this function :-(. */
69 #ifdef HAVE_GET_ID_LUN
70    scsi_id_t *SCSI_GetIDLun(DEVICE_TYPE fd);
71 #endif
72
73 #endif