2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
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.
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.
23 * Author: James da Silva, Systems Design and Analysis Group
24 * Computer Science Department
25 * University of Maryland at College Park
28 * $Id: driverio.h,v 1.35 2006/05/25 01:47:19 johnfranks Exp $
30 * driver-related helper functions
38 #include "server_util.h"
40 #define MAX_DUMPERS 63
46 /* chunker process structure */
48 typedef struct chunker_s {
49 char *name; /* name of this chunker */
50 pid_t pid; /* its pid */
52 int fd; /* read/write */
54 event_handle_t *ev_read; /* read event handle */
55 struct dumper_s *dumper;
58 /* dumper process structure */
60 typedef struct dumper_s {
61 char *name; /* name of this dumper */
62 pid_t pid; /* its pid */
63 int busy, down; /* state */
64 int fd; /* read/write */
66 int output_port; /* output port */
67 event_handle_t *ev_read; /* read event handle */
68 disk_t *dp; /* disk currently being dumped */
72 typedef struct assignedhd_s {
79 /* schedule structure */
81 typedef struct sched_s {
82 int attempted, priority;
83 int level, degr_level;
84 unsigned long est_time, degr_time;
85 off_t est_nsize, est_csize, est_size;
86 off_t degr_nsize, degr_csize, act_size;
87 off_t origsize, dumpsize;
88 time_t dumptime, tapetime;
89 char *dumpdate, *degr_dumpdate;
90 unsigned long est_kps, degr_kps;
91 char *destname; /* file/port name */
100 #define sched(dp) ((sched_t *) (dp)->up)
103 /* holding disk reservation structure */
105 typedef struct holdalloc_s {
106 int allocated_dumpers;
107 off_t allocated_space;
110 #define holdalloc(hp) ((holdalloc_t *) (hp)->up)
112 GLOBAL dumper_t dmptable[MAX_DUMPERS];
113 GLOBAL chunker_t chktable[MAX_DUMPERS];
115 /* command/result tokens */
117 GLOBAL int taper, taper_busy;
118 GLOBAL pid_t taper_pid;
119 GLOBAL event_handle_t *taper_ev_read;
121 void init_driverio(void);
122 void startup_tape_process(char *taper_program);
123 void startup_dump_process(dumper_t *dumper, char *dumper_program);
124 void startup_dump_processes(char *dumper_program, int inparallel, char *timestamp);
125 void startup_chunk_process(chunker_t *chunker, char *chunker_program);
127 disk_t *serial2disk(char *str);
128 void free_serial(char *str);
129 void free_serial_dp(disk_t *dp);
130 void check_unfree_serial(void);
131 char *disk2serial(disk_t *dp);
132 void update_info_dumper(disk_t *dp, off_t origsize, off_t dumpsize, time_t dumptime);
133 void update_info_taper(disk_t *dp, char *label, off_t filenum, int level);
134 void free_assignedhd(assignedhd_t **holdp);
135 #endif /* !DRIVERIO_H */