Imported Upstream version 3.1.0
[debian/amanda] / server-src / infofile.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: infofile.h,v 1.14 2006/05/25 01:47:20 johnfranks Exp $
29  *
30  * interface for current info file reading code
31  */
32 #ifndef INFOFILE_H
33 #define INFOFILE_H
34
35 #include "amanda.h"
36
37 #define MAX_LABEL       80
38 #define EPOCH           ((time_t)0)
39
40 #define AVG_COUNT       3
41 #define NB_HISTORY      100
42 #define newperf(ary,f)  ( ary[2]=ary[1], ary[1]=ary[0], ary[0]=(f) )
43
44 typedef struct stats_s {
45     /* fields updated by dumper */
46     off_t size;                 /* original size of dump in kbytes */
47     off_t csize;                /* compressed size of dump in kbytes */
48     time_t secs;                /* time of dump in secs */
49     time_t date;                /* end time of dump */
50     /* fields updated by taper */
51     off_t filenum;              /* file number on tape */
52     char label[MAX_LABEL];      /* tape label */
53 } stats_t;
54
55 typedef struct history_s {
56     int level;                  /* level of dump */
57     off_t size;                 /* original size of dump in kbytes */
58     off_t csize;                /* compressed size of dump in kbytes */
59     time_t date;                /* time of dump */
60     time_t secs;                /* time of dump in secs */
61 } history_t;
62
63 typedef struct perf_s {
64     double rate[AVG_COUNT];
65     double comp[AVG_COUNT];
66 } perf_t;
67
68 typedef struct info_s {
69     unsigned int  command;              /* command word */
70 #       define NO_COMMAND       0       /* no outstanding commands */
71 #       define FORCE_FULL       1       /* force level 0 at next run */
72 #       define FORCE_BUMP       2       /* force bump at next run */
73 #       define FORCE_NO_BUMP    4       /* force no-bump at next run */
74     perf_t  full;
75     perf_t  incr;
76     stats_t inf[DUMP_LEVELS];
77     int last_level, consecutive_runs;
78     history_t history[NB_HISTORY+1];
79 } info_t;
80
81
82 int open_infofile(char *infofile);
83 void close_infofile(void);
84
85 char *get_dumpdate(info_t *info, int level);
86 double perf_average(double *array, double def);
87 int get_info(char *hostname, char *diskname, info_t *info);
88 int put_info(char *hostname, char *diskname, info_t *info);
89 int del_info(char *hostname, char *diskname);
90
91 #endif /* ! INFOFILE_H */