6bb76d50d3a4c1c4e0902811e1b1f8fd34d6aa25
[debian/amanda] / server-src / find.h
1 #ifndef FIND_H
2 #define FIND_H
3
4 #include "diskfile.h"
5
6 #define DEFAULT_SORT_ORDER      "hkdlpbfw"
7
8 typedef struct find_result_s {
9     struct find_result_s *next;
10     char *timestamp;
11     char *hostname;
12     char *diskname;
13     int level;
14     char *label;
15     off_t filenum;
16     char *status;
17     char *partnum;
18     double sec;         /* may be 0.0 for older log files or holding files */
19     size_t kb;          /* may be 0 for older log files or holding files */
20     void *user_ptr;
21 } find_result_t;
22
23 /* Finds /all/ dumps still on a volume. If diskqp is not NULL, then dumps
24  * not matching any existing disklist entry will be added to diskqp and to
25  * the global disklist. If diskqp is NULL, disks not matching existing
26  * disklist entries will be skipped. See search_logfile below, which does
27  * the dirty work for find_dump. */
28 find_result_t *find_dump(disklist_t* diskqp);
29
30 /* Return a list of unqualified filenames of logfiles for active
31  * tapes.  Filenames are relative to the logdir.
32  *
33  * @returns: dynamically allocated, null-terminated strv
34  */
35 char **find_log(void);
36
37 void sort_find_result(char *sort_order, find_result_t **output_find);
38 void print_find_result(find_result_t *output_find);
39 void free_find_result(find_result_t **output_find);
40 find_result_t *dump_exist(find_result_t *output_find, char *hostname,
41                           char *diskname, char *datestamp, int level);
42 find_result_t *dumps_match(find_result_t *output_find, char *hostname,
43                            char *diskname, char *datestamp, char *level,
44                            int ok);
45 find_result_t *dumps_match_dumpspecs(find_result_t *output_find,
46                                      GSList *dumpspecs,
47                                      int ok);
48
49 /* This function looks in a particular log.xxx file for dumps. Returns TRUE
50  * if something was found. This function also skips dumps whose disklist
51  * entries are not marked 'todo'.
52  * * output_find      : Put found dumps here.
53  * * volume_label     : If not NULL, restrict the search to
54  *                      dumps matching the given volume details.
55  * * log_datestamp    : If not NULL, checks that this logfile is from this time.
56  * * logfile          : Name of logfile in config dir.
57  * * dynamic_disklist : If not NULL, adds disks not already in the global
58  *                      disklist to the given disklist (and the global one).
59  *                      If dynamic_disklist is NULL, skips disks not in the
60  *                      global disklist.
61  */
62 gboolean search_logfile(find_result_t **output_find, const char *volume_label,
63                         const char *log_datestamp, const char *logfile,
64                         disklist_t * dynamic_disklist);
65 #endif  /* !FIND_H */