Imported Upstream version 2.6.0p1
[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      "hkdlpbf"
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     void *user_ptr;
19 } find_result_t;
20
21 /* Finds /all/ dumps still on a volume. If diskqp is not NULL, then dumps
22  * not matching any existing disklist entry will be added to diskqp and to
23  * the global disklist. If diskqp is NULL, disks not matching existing
24  * disklist entries will be skipped. See search_logfile below, which does
25  * the dirty work for find_dump. */
26 find_result_t *find_dump(disklist_t* diskqp);
27
28 /* Return a list of unqualified filenames of logfiles for active
29  * tapes.  Filenames are relative to the logdir.
30  *
31  * @returns: dynamically allocated, null-terminated strv
32  */
33 char **find_log(void);
34
35 void sort_find_result(char *sort_order, find_result_t **output_find);
36 void print_find_result(find_result_t *output_find);
37 void free_find_result(find_result_t **output_find);
38 find_result_t *dump_exist(find_result_t *output_find, char *hostname,
39                           char *diskname, char *datestamp, int level);
40 find_result_t *dumps_match(find_result_t *output_find, char *hostname,
41                            char *diskname, char *datestamp, char *level,
42                            int ok);
43 find_result_t *dumps_match_dumpspecs(find_result_t *output_find,
44                                      GSList *dumpspecs,
45                                      int ok);
46
47 /* This function looks in a particular log.xxx file for dumps. Returns TRUE
48  * if something was found. This function also skips dumps whose disklist
49  * entries are not marked 'todo'.
50  * * output_find      : Put found dumps here.
51  * * volume_label     : If not NULL, restrict the search to
52  *                      dumps matching the given volume details.
53  * * log_datestamp    : If not NULL, checks that this logfile is from this time.
54  * * logfile          : Name of logfile in config dir.
55  * * dynamic_disklist : If not NULL, adds disks not already in the global
56  *                      disklist to the given disklist (and the global one).
57  *                      If dynamic_disklist is NULL, skips disks not in the
58  *                      global disklist.
59  */
60 gboolean search_logfile(find_result_t **output_find, const char *volume_label,
61                         const char *log_datestamp, const char *logfile,
62                         disklist_t * dynamic_disklist);
63 #endif  /* !FIND_H */