X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Fdriverio.h;h=794c0fa013c0912afacae59c9428df77cf300d25;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hp=e1725c7cc48b55a4e134d0b79ff5e43df868620d;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/server-src/driverio.h b/server-src/driverio.h index e1725c7..794c0fa 100644 --- a/server-src/driverio.h +++ b/server-src/driverio.h @@ -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" @@ -42,6 +41,23 @@ #define GLOBAL extern #endif +typedef enum { + TAPER_STATE_DEFAULT = 0, // 0 Before TAPER-START + TAPER_STATE_INIT = (1 << 0), // 1 Between TAPE-START and TAPE-OK + TAPER_STATE_RESERVATION = (1 << 1), // 2 Have a reservation + TAPER_STATE_IDLE = (1 << 2), // 4 tape started and do nothing + TAPER_STATE_DUMP_TO_TAPE = (1 << 3), // 8 Doing a PORT-WRITE + TAPER_STATE_FILE_TO_TAPE = (1 << 4), // 16 Doing a FILE-WRITE + TAPER_STATE_TAPE_REQUESTED = (1 << 5), // 32 REQUEST-NEW-TAPE received + TAPER_STATE_WAIT_FOR_TAPE = (1 << 6), // 64 if taper wait for a tape, + // after a START-SCAN send + TAPER_STATE_WAIT_NEW_TAPE = (1 << 7), // 128 AFTER NEW-TAPE sent and before + // NEW-TAPE received + TAPER_STATE_TAPE_STARTED = (1 << 8), // 256 taper already started to write + // to a tape. + TAPER_STATE_DONE = (1 << 9), +} TaperState; + /* chunker process structure */ typedef struct chunker_s { @@ -68,8 +84,35 @@ typedef struct dumper_s { chunker_t *chunker; } dumper_t; +typedef struct taper_s { + char *name; /* name of this taper */ + int sendresult; + char *input_error; + char *tape_error; + int result; + dumper_t *dumper; + disk_t *disk; + char *first_label; + off_t first_fileno; + TaperState state; + off_t left; + off_t written; // Number of kb already written to tape +} taper_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 +121,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; @@ -89,40 +134,36 @@ typedef struct sched_s { unsigned long est_kps, degr_kps; char *destname; /* file/port name */ dumper_t *dumper; + taper_t *taper; assignedhd_t **holdp; time_t timestamp; 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]; +GLOBAL taper_t *tapetable; /* command/result tokens */ -GLOBAL int taper, taper_busy; +GLOBAL int taper_fd; GLOBAL pid_t taper_pid; GLOBAL event_handle_t *taper_ev_read; +GLOBAL int taper_nb_wait_reply; void init_driverio(void); -void startup_tape_process(char *taper_program); +void startup_tape_process(char *taper_program, int taper_parallel_write, gboolean no_taper); 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);