Imported Upstream version 3.1.0
[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 char *modname = "@(#)" __FILE__
19                 ": SCSI support library for the proto scsi interface @(#)";
20
21 /* 
22  * this routine checks a specified slot to see if it is empty 
23  */
24 int isempty(int fd, int slot)
25 {
26     /*
27      * ask the robotics, which have knowledge of the storage elements
28      * if the requested slot is empty.
29      *
30      * nslot available for use when the number of slots needs to be known
31      * to allocate memory.
32      */
33     return (slot_empty? 1 : 0);
34 }
35
36 int get_clean_state(char *dev)
37 {
38    /* Ask the device, if it needs a cleaning */
39     return (needs_cleaning? 1 : 0);
40
41 }
42
43 /*
44  *
45  */
46 void eject_tape(char *tape)
47 /* This function ejects the tape from the drive */
48 {
49     eject_it;
50 }
51
52
53 /*
54  * find the first empty slot 
55  */
56 int find_empty( int fd, int start, int end)
57 {
58     /*
59      * find an empty slot to insert a tape into (if required)
60      *
61      * loop through the list of slots, checking see if it is currently 
62      * occupied.
63      */
64     return (emtpy_slot);
65 }
66
67 /*
68  * returns one if there is a tape loaded in the drive 
69  */
70 int drive_loaded(int fd, int drivenum)
71 {
72     /*
73      * check the status of the transport (tape drive).
74      *
75      * return 1 if the drive is occupied, 0 otherwise.
76      */
77     return (occupied ? 1 : 0);
78 }
79
80
81 /*
82  * unloads the drive, putting the tape in the specified slot 
83  */
84 int unload(int fd, int drive, int slot)
85 {
86     /*
87      * unload the specified drive into the specified slot
88      * (storage element)
89      */
90     return (success);
91 }
92
93
94 /*
95  * moves tape from the specified slot into the drive 
96  */
97 int load(int fd, int drive, int slot)
98 {
99     /*
100      * load the media from the specified element (slot) into the
101      * specified data transfer unit (drive)
102      */
103     return (success);
104 }
105
106 int get_slot_count(int fd)
107
108
109     /*
110      * return the number of slots in the robot 
111      * to the caller 
112      */
113
114     return number_of_storage_elements;
115 }
116
117 int get_drive_count(int fd)
118
119
120     /*
121      * retreive the number of data-transfer devices
122      */
123     return number_of_data-transfer_devices;
124 }