working on rules file, still needs work
[debian/amanda] / server-src / changer.h
index 09d9ee9eeccca8bbd56bae19624e0154e83e0401..ba5b73aa010642943071dbb6e01e9281a53e50ef 100644 (file)
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: changer.h,v 1.6.4.3 1999/09/08 23:27:53 jrj Exp $
+ * $Id: changer.h,v 1.13 2006/05/25 01:47:19 johnfranks Exp $
  *
  * interface routines for tape changers
  */
+#ifndef CHANGER_H
+#define CHANGER_H
+
 #include "amanda.h"
 
 extern int changer_debug;
 extern char *changer_resultstr;
 
-int changer_init P((void));
-int changer_reset P((char **slotstr));
-int changer_clean P((char **slotstr));
-int changer_eject P((char **slotstr));
-int changer_label P((char *slotsp, char *labelstr));
-int changer_info P((int *nslotsp, char **curslotstr, int *backwards));
-int changer_query P((int *nslotsp, char **curslotstr, int *backwards,
-                    int *searchable));
-int changer_search P((char *searchlabel, char **outslotstr, char **devicename));
-int changer_loadslot P((char *inslotstr, char **outslotstr, char **devicename));
-void changer_current P((int (*user_init)(int rc, int nslots, int backwards),
-                    int (*user_slot)(int rc, char *slotstr, char *device)));
-void changer_scan P((int (*user_init)(int rc, int nslots, int backwards),
-                    int (*user_slot)(int rc, char *slotstr, char *device)));
-void changer_find P((int (*user_init)(int rc, int nslots, int backwards),
-                    int (*user_slot)(int rc, char *slotstr, char *device),
-                     char *searchlabel));
+int changer_init(void);
+int changer_reset(char **slotstr);
+int changer_clean(char **slotstr);
+int changer_eject(char **slotstr);
+int changer_label(char *slotsp, char *labelstr);
+int changer_info(int *nslotsp, char **curslotstr, int *backwards);
+int changer_query(int *nslotsp, char **curslotstr, int *backwards,
+                    int *searchable);
+int changer_search(char *searchlabel, char **outslotstr, char **devicename);
+int changer_loadslot(char *inslotstr, char **outslotstr, char **devicename);
+void changer_current(void *user_data,
+                        int (*user_init)(void *user_data,
+                                         int rc, int nslots, int backwards,
+                                         int searchable),
+                    int (*user_slot)(void *user_data,
+                                      int rc, char *slotstr, char *device));
+
+
+/* USAGE: changer_find(user_data, init_fxn, slot_fxn, searchlabel)
+ *
+ * Searches the changer. If searchlabel is not NULL, and the changer has
+ * barcode support, then changer_find will load that tape
+ * first. Otherwise, changer_find will search through the tape drive
+ * one by one until user_slot() returns nonzero.
+ *
+ * Parameters: user_data: A pointer which is not interpreted by
+ *                        changer_find, but passed back to the
+ *                        callback functions user_data and user_slot.
+ *                        You can use this structure instead of
+ *                        globals.
+ *             user_init: This function is called right away. Its
+ *                        arguments are:
+ *                        user_data: (as above)
+ *                        rc:     The results of the changer -info
+ *                                command.
+ *                        nslots: The number of slots in the changer.
+ *                        backwards: Whether this changer can go
+ *                                backwards or not. Some changers
+ *                                can only search in one direction,
+ *                                and then the operator must reload
+ *                                the tapes.
+ *                        searchable: Whether this changer has a
+ *                                barcode reader or similar device.
+ *             user_slot: This function is called for every slot.
+ *                        Searching stops when it returns
+ *                        nonzero. Arguments are:
+ *                        user_data: (as above)
+ *                        rc:     The results of the changer -slot
+ *                                command.
+ *                        slotstr: The slot which was loaded
+ *                        device: The tape device to use to read this slot.
+ */
+
+
+
+void changer_find(void *user_data,
+                     int (*user_init)(void *user_data, int rc,
+                                      int nslots, int backwards,
+                                      int searchable),
+                    int (*user_slot)(void *user_data, int rc,
+                                      char *slotstr, char *device),
+                     char *searchlabel);
+
+#endif /* !CHANGER_H */