f53441c9eb77f3feb335a18782bf3d602a7d8cf6
[debian/amanda] / server-src / diskfile.h
1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 1991-1998 University of Maryland at College Park
4  * All Rights Reserved.
5  *
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.
15  *
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.
22  *
23  * Author: James da Silva, Systems Design and Analysis Group
24  *                         Computer Science Department
25  *                         University of Maryland at College Park
26  */
27 /*
28  * $Id: diskfile.h,v 1.32 2005/12/09 03:22:52 paddy_s Exp $
29  *
30  * interface for disklist file reading code
31  */
32 #ifndef DISKFILE_H
33 #define DISKFILE_H
34
35 #include "amanda.h"
36 #include "conffile.h"
37 #include "amfeatures.h"
38
39 typedef struct amhost_s {
40     struct amhost_s *next;              /* next host */
41     char *hostname;                     /* name of host */
42     struct disk_s *disks;               /* linked list of disk records */
43     int inprogress;                     /* # dumps in progress */
44     int maxdumps;                       /* maximum dumps in parallel */
45     interface_t *netif;                 /* network interface this host is on */
46     time_t start_t;                     /* start dump after this time */
47     char *up;                           /* generic user pointer */
48     am_feature_t *features;             /* feature set */
49 } am_host_t;
50
51 typedef struct disk_s {
52     int line;                           /* line number of last definition */
53     struct disk_s *prev, *next;         /* doubly linked disk list */
54
55     am_host_t *host;                    /* host list */
56     struct disk_s *hostnext;
57
58     char *name;                         /* label name for disk */
59     char *device;                       /* device name for disk, eg "sd0g" */
60     char *dtype_name;                   /* name of dump type   XXX shouldn't need this */
61     char *program;                      /* dump program, eg DUMP, GNUTAR */
62     char *srvcompprog;                  /* custom compression server filter */
63     char *clntcompprog;                 /* custom compression client filter */
64     char *srv_encrypt;                  /* custom encryption server filter */
65     char *clnt_encrypt;                 /* custom encryption client filter */
66     sl_t *exclude_file;                 /* file exclude spec */
67     sl_t *exclude_list;                 /* exclude list */
68     sl_t *include_file;                 /* file include spec */
69     sl_t *include_list;                 /* include list */
70     int exclude_optional;               /* exclude list are optional */
71     int include_optional;               /* include list are optional */
72     long priority;                      /* priority of disk */
73     long tape_splitsize;                /* size of dumpfile chunks on tape */
74     char *split_diskbuffer;             /* place where we can buffer PORT-WRITE dumps other than RAM */
75     long fallback_splitsize;            /* size for in-RAM PORT-WRITE buffers */
76     long dumpcycle;                     /* days between fulls */
77     long frequency;                     /* XXX - not used */
78     char *security_driver;              /* type of authentication (per disk) */
79     int maxdumps;                       /* max number of parallel dumps (per system) */
80     int maxpromoteday;                  /* maximum of promote day */
81     int bumppercent;
82     int bumpsize;
83     int bumpdays;
84     double bumpmult;
85     time_t start_t;                     /* start this dump after this time */
86     int strategy;                       /* what dump strategy to use */
87     int estimate;                       /* what estimate strategy to use */
88     int compress;                       /* type of compression to use */
89     int encrypt;                        /* type of encryption to use */
90     char *srv_decrypt_opt;              /* server-side decryption option parameter to use */
91     char *clnt_decrypt_opt;             /* client-side decryption option parameter to use */
92     float comprate[2];                  /* default compression rates */
93     /* flag options */
94     unsigned int record:1;              /* record dump in /etc/dumpdates ? */
95     unsigned int skip_incr:1;           /* incs done externally ? */
96     unsigned int skip_full:1;           /* fulls done externally ? */
97     unsigned int no_hold:1;             /* don't use holding disk ? */
98     unsigned int kencrypt:1;
99     unsigned int index:1;               /* produce an index ? */
100     int spindle;                        /* spindle # - for parallel dumps */
101     int inprogress;                     /* being dumped now? */
102     int todo;
103     void *up;                           /* generic user pointer */
104 } disk_t;
105
106 typedef struct disklist_s {
107     disk_t *head, *tail;
108 } disklist_t;
109
110 #define empty(dlist)    ((dlist).head == NULL)
111
112
113 int read_diskfile P((const char *, disklist_t *));
114
115 am_host_t *lookup_host P((const char *hostname));
116 disk_t *lookup_disk P((const char *hostname, const char *diskname));
117
118 disk_t *add_disk P((disklist_t *list, char *hostname, char *diskname));
119
120 void enqueue_disk P((disklist_t *list, disk_t *disk));
121 void headqueue_disk P((disklist_t *list, disk_t *disk));
122 void insert_disk P((disklist_t *list, disk_t *disk, int (*f)(disk_t *a, disk_t *b)));
123 int  find_disk P((disklist_t *list, disk_t *disk));
124 void sort_disk P((disklist_t *in, disklist_t *out, int (*f)(disk_t *a, disk_t *b)));
125 disk_t *dequeue_disk P((disklist_t *list));
126 void remove_disk P((disklist_t *list, disk_t *disk));
127
128 void dump_queue P((char *str, disklist_t q, int npr, FILE *f));
129
130 char *optionstr P((disk_t *dp, am_feature_t *their_features, FILE *fdout));
131
132 void match_disklist P((disklist_t *origqp, int sargc, char **sargv));
133 void free_disklist P((disklist_t *dl));
134
135 #endif /* ! DISKFILE_H */