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: diskfile.h,v 1.38 2006/06/22 20:41:33 martinea Exp $
30 * interface for disklist file reading code
37 #include "fileheader.h"
38 #include "amfeatures.h"
40 typedef struct netif_s {
43 unsigned long curusage;
46 typedef struct amhost_s {
47 struct amhost_s *next; /* next host */
48 char *hostname; /* name of host */
49 struct disk_s *disks; /* linked list of disk records */
50 int inprogress; /* # dumps in progress */
51 int maxdumps; /* maximum dumps in parallel */
52 netif_t *netif; /* network interface this host is on */
53 time_t start_t; /* time last dump was started on this host */
54 char *up; /* generic user pointer */
55 am_feature_t *features; /* feature set */
60 typedef struct disk_s {
61 int line; /* line number of last definition */
62 char *filename; /* the filename where it is read */
63 struct disk_s *prev, *next; /* doubly linked disk list */
65 am_host_t *host; /* host list */
66 struct disk_s *hostnext;
68 char *hostname; /* hostname */
69 char *name; /* label name for disk */
70 char *device; /* device name for disk, eg "sd0g" */
71 char *dtype_name; /* name of dump type */
72 dumptype_t *config; /* pointer to the dumptype config */
73 char *program; /* dump program, eg DUMP, STAR, GNUTAR */
74 char *srvcompprog; /* custom compression server filter */
75 char *clntcompprog; /* custom compression client filter */
76 char *srv_encrypt; /* custom encryption server filter */
77 char *clnt_encrypt; /* custom encryption client filter */
78 char *amandad_path; /* amandad path on the client */
79 char *client_username; /* username to connect on the client */
80 char *client_port; /* port to connect on the client */
81 char *ssh_keys; /* ssh_key file to use */
82 am_sl_t *exclude_file; /* file exclude spec */
83 am_sl_t *exclude_list; /* exclude list */
84 am_sl_t *include_file; /* file include spec */
85 am_sl_t *include_list; /* include list */
86 int exclude_optional; /* exclude list are optional */
87 int include_optional; /* include list are optional */
88 int priority; /* priority of disk */
92 off_t tape_splitsize; /* size of dumpfile chunks on tape */
93 char *split_diskbuffer; /* place where we can buffer PORT-WRITE dumps other than RAM */
94 off_t fallback_splitsize; /* size for in-RAM PORT-WRITE buffers */
95 int dumpcycle; /* days between fulls */
96 long frequency; /* XXX - not used */
97 char *auth; /* type of authentication (per disk) */
98 int maxdumps; /* max number of parallel dumps (per system) */
99 int maxpromoteday; /* maximum of promote day */
104 time_t starttime; /* start this dump after this time (integer: HHMM) */
105 time_t start_t; /* start this dump after this time (time_t) */
106 int strategy; /* what dump strategy to use */
107 int ignore; /* ignore */
108 estimatelist_t estimatelist; /* what estimate strategy to use */
109 int compress; /* type of compression to use */
110 int encrypt; /* type of encryption to use */
111 char *srv_decrypt_opt; /* server-side decryption option parameter to use */
112 char *clnt_decrypt_opt; /* client-side decryption option parameter to use */
113 double comprate[2]; /* default compression rates */
115 int record; /* record dump in /etc/dumpdates ? */
116 int skip_incr; /* incs done externally ? */
117 int skip_full; /* fulls done externally ? */
118 int to_holdingdisk; /* use holding disk ? */
120 int index; /* produce an index ? */
121 data_path_t data_path; /* defined data-path */
122 char *dataport_list; /* list of address to send data */
123 int spindle; /* spindle # - for parallel dumps */
124 int inprogress; /* being dumped now? */
127 identlist_t pp_scriptlist;
128 host_limit_t *dump_limit;
129 void *up; /* generic user pointer */
132 typedef struct disklist_s {
136 #define empty(dlist) ((dlist).head == NULL)
138 /* This function is integrated with the conffile.c error-handling; handle its return
139 * value just as you would the return of config_init() */
140 cfgerr_level_t read_diskfile(const char *, disklist_t *);
142 am_host_t *get_hostlist(void);
143 am_host_t *lookup_host(const char *hostname);
144 disk_t *lookup_disk(const char *hostname, const char *diskname);
146 disk_t *add_disk(disklist_t *list, char *hostname, char *diskname);
148 void enqueue_disk(disklist_t *list, disk_t *disk);
149 void headqueue_disk(disklist_t *list, disk_t *disk);
150 void insert_disk(disklist_t *list, disk_t *disk, int (*f)(disk_t *a, disk_t *b));
151 int find_disk(disklist_t *list, disk_t *disk);
152 void sort_disk(disklist_t *in, disklist_t *out, int (*f)(disk_t *a, disk_t *b));
153 disk_t *dequeue_disk(disklist_t *list);
154 void remove_disk(disklist_t *list, disk_t *disk);
156 void dump_queue(char *str, disklist_t q, int npr, FILE *f);
158 char *optionstr(disk_t *dp);
161 * to_server must be set to 1 if the result is sent to another server
162 * application, eg. driver to dumper.
163 * It must be set to 0 if the result is sent to the client.
165 GPtrArray *validate_optionstr(disk_t *dp);
166 char *xml_optionstr(disk_t *dp, int to_server);
167 char *xml_estimate(estimatelist_t estimatelist, am_feature_t *their_features);
168 char *clean_dle_str_for_client(char *dle_str, am_feature_t *their_features);
169 char *xml_application(disk_t *dp, application_t *application,
170 am_feature_t *their_features);
171 char *xml_scripts(identlist_t pp_scriptlist, am_feature_t *their_features);
172 char *xml_dumptype_properties(disk_t *dp);
174 /* disable_skip_disk() set the db->todo flag to 0 for each dle with 'ignore'
175 * 'strategy skip'. It is useful for all programs that want to skip them,i
176 * eg. all amdump process.
177 * Program use for listing dump or index should not use it.
179 void disable_skip_disk(disklist_t *origqp);
181 char *match_disklist(disklist_t *origqp, int sargc, char **sargv);
182 gboolean match_dumpfile(dumpfile_t *file, int sargc, char **sargv);
183 void free_disklist(disklist_t *dl);
185 netif_t *disklist_netifs(void);
187 #endif /* ! DISKFILE_H */