Imported Upstream version 2.5.1
[debian/amanda] / server-src / changer.h
1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 1991-1998 University of Maryland at College Park
4  * All Rights Reserved.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of U.M. not be used in advertising or
11  * publicity pertaining to distribution of the software without specific,
12  * written prior permission.  U.M. makes no representations about the
13  * suitability of this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  *
16  * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  * Authors: the Amanda Development Team.  Its members are listed in a
24  * file named AUTHORS, in the root directory of this distribution.
25  */
26 /*
27  * $Id: changer.h,v 1.13 2006/05/25 01:47:19 johnfranks Exp $
28  *
29  * interface routines for tape changers
30  */
31 #ifndef CHANGER_H
32 #define CHANGER_H
33
34 #include "amanda.h"
35
36 extern int changer_debug;
37 extern char *changer_resultstr;
38
39 int changer_init(void);
40 int changer_reset(char **slotstr);
41 int changer_clean(char **slotstr);
42 int changer_eject(char **slotstr);
43 int changer_label(char *slotsp, char *labelstr);
44 int changer_info(int *nslotsp, char **curslotstr, int *backwards);
45 int changer_query(int *nslotsp, char **curslotstr, int *backwards,
46                      int *searchable);
47 int changer_search(char *searchlabel, char **outslotstr, char **devicename);
48 int changer_loadslot(char *inslotstr, char **outslotstr, char **devicename);
49 void changer_current(void *user_data,
50                         int (*user_init)(void *user_data,
51                                          int rc, int nslots, int backwards,
52                                          int searchable),
53                      int (*user_slot)(void *user_data,
54                                       int rc, char *slotstr, char *device));
55
56
57 /* USAGE: changer_find(user_data, init_fxn, slot_fxn, searchlabel)
58  *
59  * Searches the changer. If searchlabel is not NULL, and the changer has
60  * barcode support, then changer_find will load that tape
61  * first. Otherwise, changer_find will search through the tape drive
62  * one by one until user_slot() returns nonzero.
63  *
64  * Parameters: user_data: A pointer which is not interpreted by
65  *                        changer_find, but passed back to the
66  *                        callback functions user_data and user_slot.
67  *                        You can use this structure instead of
68  *                        globals.
69  *             user_init: This function is called right away. Its
70  *                        arguments are:
71  *                        user_data: (as above)
72  *                        rc:     The results of the changer -info
73  *                                command.
74  *                        nslots: The number of slots in the changer.
75  *                        backwards: Whether this changer can go
76  *                                backwards or not. Some changers
77  *                                can only search in one direction,
78  *                                and then the operator must reload
79  *                                the tapes.
80  *                        searchable: Whether this changer has a
81  *                                barcode reader or similar device.
82  *             user_slot: This function is called for every slot.
83  *                        Searching stops when it returns
84  *                        nonzero. Arguments are:
85  *                        user_data: (as above)
86  *                        rc:     The results of the changer -slot
87  *                                command.
88  *                        slotstr: The slot which was loaded
89  *                        device: The tape device to use to read this slot.
90  */
91
92
93
94 void changer_find(void *user_data,
95                      int (*user_init)(void *user_data, int rc,
96                                       int nslots, int backwards,
97                                       int searchable),
98                      int (*user_slot)(void *user_data, int rc,
99                                       char *slotstr, char *device),
100                      char *searchlabel);
101
102 #endif  /* !CHANGER_H */