Imported Upstream version 2.5.1
[debian/amanda] / changer-src / scsi-proto.c
1 /*
2  *      $Id: scsi-proto.c,v 1.4 2006/05/25 01:47:10 johnfranks Exp $
3  *
4  *      scsi-proto.c -- library routines to handle the changer
5  *                      Prototype file for customization
6  *
7  *      Author: Eric Schnoebelen, eric@cirr.com
8  *      interface based on work by: Larry Pyeatt, pyeatt@cs.colostate.edu 
9  *      Copyright: 1997, 1998 Eric Schnoebelen
10  *              
11  *      Michael C. Povel 03.06.98 added dummy for eject_tape
12  */
13
14 #include "config.h"
15 #include "amanda.h"
16 #include "libscsi.h"
17
18 #if defined(PROTO_H) 
19
20 char *modname = "@(#)" __FILE__
21                 ": SCSI support library for the proto scsi interface @(#)";
22
23 /* 
24  * this routine checks a specified slot to see if it is empty 
25  */
26 int isempty(int fd, int slot)
27 {
28     /*
29      * ask the robotics, which have knowledge of the storage elements
30      * if the requested slot is empty.
31      *
32      * nslot available for use when the number of slots needs to be known
33      * to allocate memory.
34      */
35     return (slot_empty? 1 : 0);
36 }
37
38 int get_clean_state(char *dev)
39 {
40    /* Ask the device, if it needs a cleaning */
41     return (needs_cleaning? 1 : 0);
42
43 }
44
45 /*
46  *
47  */
48 void eject_tape(char *tape)
49 /* This function ejects the tape from the drive */
50 {
51     eject_it;
52 }
53
54
55 /*
56  * find the first empty slot 
57  */
58 int find_empty( int fd, int start, int end)
59 {
60     /*
61      * find an empty slot to insert a tape into (if required)
62      *
63      * loop through the list of slots, checking see if it is currently 
64      * occupied.
65      */
66     return (emtpy_slot);
67 }
68
69 /*
70  * returns one if there is a tape loaded in the drive 
71  */
72 int drive_loaded(int fd, int drivenum)
73 {
74     /*
75      * check the status of the transport (tape drive).
76      *
77      * return 1 if the drive is occupied, 0 otherwise.
78      */
79     return (occupied ? 1 : 0);
80 }
81
82
83 /*
84  * unloads the drive, putting the tape in the specified slot 
85  */
86 int unload(int fd, int drive, int slot)
87 {
88     /*
89      * unload the specified drive into the specified slot
90      * (storage element)
91      */
92     return (success);
93 }
94
95
96 /*
97  * moves tape from the specified slot into the drive 
98  */
99 int load(int fd, int drive, int slot)
100 {
101     /*
102      * load the media from the specified element (slot) into the
103      * specified data transfer unit (drive)
104      */
105     return (success);
106 }
107
108 int get_slot_count(int fd)
109
110
111     /*
112      * return the number of slots in the robot 
113      * to the caller 
114      */
115
116     return number_of_storage_elements;
117 }
118
119 int get_drive_count(int fd)
120
121
122     /*
123      * retreive the number of data-transfer devices
124      */
125     return number_of_data-transfer_devices;
126 }
127
128 #endif