2 MTX -- SCSI Tape Attached Medium Changer Control Program
4 Copyright 1997-1998 Leonard N. Zubkoff <lnz@dandelion.com>
5 Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org>
6 This file created by Eric Lee Green <eric@badtux.org>
8 This program is free software; you may redistribute and/or modify it under
9 the terms of the GNU General Public License Version 2 as published by the
10 Free Software Foundation.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 $Date: 2008-08-19 03:03:38 -0700 (Tue, 19 Aug 2008) $
21 /* Much of the guts of mtx.c has been extracted to mtxl.c, a library file
22 * full of utility routines. This file is the header file for that library.
34 void FatalError(char *ErrorMessage, ...);
35 void *xmalloc(size_t Size);
36 void *xzmalloc(size_t Size);
37 void slow_bzero(char *buffer, int numchars);
39 DEVICE_TYPE SCSI_OpenDevice(char *DeviceName);
40 void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD);
41 int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD,
42 Direction_T Direction,
47 RequestSense_T *RequestSense);
49 void PrintRequestSense(RequestSense_T *RequestSense);
51 int BigEndian16(unsigned char *BigEndianData);
52 int BigEndian24(unsigned char *BigEndianData);
53 int min(int x, int y);
54 int max(int x, int y);
56 void PrintHex(int Indent, unsigned char *Buffer, int Length);
57 int ClearUnitAttention(DEVICE_TYPE fd, RequestSense_T *RequestSense);
59 ElementStatus_T *ReadElementStatus( DEVICE_TYPE MediumChangerFD,
60 RequestSense_T *RequestSense,
61 Inquiry_T *inquiry_info,
64 Inquiry_T *RequestInquiry( DEVICE_TYPE fd,
65 RequestSense_T *RequestSense);
67 RequestSense_T *MoveMedium( DEVICE_TYPE MediumChangerFD,
69 int DestinationAddress,
70 ElementStatus_T *ElementStatus,
71 Inquiry_T *inquiry_info,
74 RequestSense_T *ExchangeMedium( DEVICE_TYPE MediumChangerFD,
76 int DestinationAddress,
78 ElementStatus_T *ElementStatus,
81 RequestSense_T *PositionElement(DEVICE_TYPE MediumChangerFD,
82 int DestinationAddress,
83 ElementStatus_T *ElementStatus);
85 int Inventory(DEVICE_TYPE MediumChangerFD); /* inventory library */
86 int LoadUnload(DEVICE_TYPE fd, int bLoad); /* load/unload tape, magazine or disc */
87 int StartStop(DEVICE_TYPE fd, int bStart); /* start/stop device */
88 int LockUnlock(DEVICE_TYPE fd, int bLock); /* lock/unlock medium in device */
89 RequestSense_T *Erase(DEVICE_TYPE fd); /* send SHORT erase to drive */
91 void SCSI_Set_Timeout(int secs); /* set the SCSI timeout */
92 void SCSI_Default_Timeout(void); /* go back to default timeout */
94 /* we may not have this function :-(. */
95 #ifdef HAVE_GET_ID_LUN
96 scsi_id_t *SCSI_GetIDLun(DEVICE_TYPE fd);
99 /* These two hacks are so that I can stick the tongue out on an
100 * NSM optical jukebox.
102 NSM_Result_T *RecNSMHack(DEVICE_TYPE MediumChangerFD,
103 int param_len, int timeout);
105 int SendNSMHack(DEVICE_TYPE MediumChangerFD, NSM_Param_T *nsm_command,
106 int param_len, int timeout);