Imported Upstream version 2.6.1
[debian/amanda] / server-src / driverio.h
index e1725c7cc48b55a4e134d0b79ff5e43df868620d..c16d04186a3c8dd1c95a510c958ef63828209102 100644 (file)
@@ -32,9 +32,8 @@
 #ifndef DRIVERIO_H
 #define DRIVERIO_H
 
-#include "event.h"
-
 #include "amanda.h"
+#include "event.h"
 #include "holding.h"
 #include "server_util.h"
 
@@ -68,8 +67,20 @@ typedef struct dumper_s {
     chunker_t *chunker;
 } dumper_t;
 
+/* holding disk reservation structure; this is built as a list parallel
+ * to the configuration's linked list of holding disks. */
+
+typedef struct holdalloc_s {
+    struct holdalloc_s *next;
+    holdingdisk_t *hdisk;
+
+    off_t disksize;
+    int allocated_dumpers;
+    off_t allocated_space;
+} holdalloc_t;
+
 typedef struct assignedhd_s {
-    holdingdisk_t      *disk;
+    holdalloc_t                *disk;
     off_t              used;
     off_t              reserved;
     char               *destname;
@@ -78,7 +89,9 @@ typedef struct assignedhd_s {
 /* schedule structure */
 
 typedef struct sched_s {
-    int attempted, priority;
+    int dump_attempted;
+    int taper_attempted;
+    int  priority;
     int level, degr_level;
     unsigned long est_time, degr_time;
     off_t est_nsize, est_csize, est_size;
@@ -94,28 +107,39 @@ typedef struct sched_s {
     char *datestamp;
     int activehd;
     int no_space;
+    char *degr_mesg;
 } sched_t;
 
 #define sched(dp)      ((sched_t *) (dp)->up)
 
 
-/* holding disk reservation structure */
-
-typedef struct holdalloc_s {
-    int allocated_dumpers;
-    off_t allocated_space;
-} holdalloc_t;
-
-#define holdalloc(hp)  ((holdalloc_t *) (hp)->up)
-
 GLOBAL dumper_t dmptable[MAX_DUMPERS];
 GLOBAL chunker_t chktable[MAX_DUMPERS];
 
 /* command/result tokens */
 
+typedef enum {
+   TAPER_STATE_DEFAULT       = 0,
+   TAPER_STATE_DUMP_TO_TAPE  = (1 << 0), // if taper is doing a dump to tape
+   TAPER_STATE_WAIT_FOR_TAPE = (1 << 1), // if taper wait for a tape, after a
+                                        //   REQUEST-NEW-TAPE
+   TAPER_STATE_TAPE_STARTED  = (1 << 2)         // taper already started to write to
+                                        //   a tape.
+} TaperState;
+
 GLOBAL int taper, taper_busy;
+GLOBAL int taper_sendresult;
+GLOBAL char *taper_input_error;
+GLOBAL char *taper_tape_error;
 GLOBAL pid_t taper_pid;
+GLOBAL int taper_result;
+GLOBAL dumper_t *taper_dumper;
 GLOBAL event_handle_t *taper_ev_read;
+GLOBAL char *taper_first_label;
+GLOBAL off_t taper_first_fileno;
+GLOBAL TaperState taper_state;
+GLOBAL off_t taper_written;            // Number of kb already written to tape
+                                       //   for the DLE.
 
 void init_driverio(void);
 void startup_tape_process(char *taper_program);
@@ -123,6 +147,7 @@ void startup_dump_process(dumper_t *dumper, char *dumper_program);
 void startup_dump_processes(char *dumper_program, int inparallel, char *timestamp);
 void startup_chunk_process(chunker_t *chunker, char *chunker_program);
 
+cmd_t getresult(int fd, int show, int *result_argc, char ***result_argv);
 disk_t *serial2disk(char *str);
 void free_serial(char *str);
 void free_serial_dp(disk_t *dp);