X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Ffind.h;h=6bb76d50d3a4c1c4e0902811e1b1f8fd34d6aa25;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=779964b93b19c7f5943a7baaf42b5f345643f6cd;hpb=3ab887b9bc819a846c75dd7f2ee5d41fac22b19f;p=debian%2Famanda diff --git a/server-src/find.h b/server-src/find.h index 779964b..6bb76d5 100644 --- a/server-src/find.h +++ b/server-src/find.h @@ -1,24 +1,65 @@ +#ifndef FIND_H +#define FIND_H -#define DEFAULT_SORT_ORDER "hkdlb" +#include "diskfile.h" + +#define DEFAULT_SORT_ORDER "hkdlpbfw" typedef struct find_result_s { struct find_result_s *next; - int datestamp; - int datestamp_aux; - /* aux is secondary key for intra-day comparisons -- could be timestamp, - just use seq# */ + char *timestamp; char *hostname; char *diskname; int level; char *label; - int filenum; + off_t filenum; char *status; + char *partnum; + double sec; /* may be 0.0 for older log files or holding files */ + size_t kb; /* may be 0 for older log files or holding files */ + void *user_ptr; } find_result_t; -find_result_t *find_dump P((int dyna_disklist, disklist_t* diskqp)); -char **find_log P(()); -void sort_find_result P((char *sort_order, find_result_t **output_find)); -void print_find_result P((find_result_t *output_find)); -void free_find_result P((find_result_t **output_find)); -find_result_t *dump_exist P((find_result_t *output_find, char *hostname, char *diskname, int datestamp, int level)); +/* Finds /all/ dumps still on a volume. If diskqp is not NULL, then dumps + * not matching any existing disklist entry will be added to diskqp and to + * the global disklist. If diskqp is NULL, disks not matching existing + * disklist entries will be skipped. See search_logfile below, which does + * the dirty work for find_dump. */ +find_result_t *find_dump(disklist_t* diskqp); + +/* Return a list of unqualified filenames of logfiles for active + * tapes. Filenames are relative to the logdir. + * + * @returns: dynamically allocated, null-terminated strv + */ +char **find_log(void); + +void sort_find_result(char *sort_order, find_result_t **output_find); +void print_find_result(find_result_t *output_find); +void free_find_result(find_result_t **output_find); +find_result_t *dump_exist(find_result_t *output_find, char *hostname, + char *diskname, char *datestamp, int level); +find_result_t *dumps_match(find_result_t *output_find, char *hostname, + char *diskname, char *datestamp, char *level, + int ok); +find_result_t *dumps_match_dumpspecs(find_result_t *output_find, + GSList *dumpspecs, + int ok); +/* This function looks in a particular log.xxx file for dumps. Returns TRUE + * if something was found. This function also skips dumps whose disklist + * entries are not marked 'todo'. + * * output_find : Put found dumps here. + * * volume_label : If not NULL, restrict the search to + * dumps matching the given volume details. + * * log_datestamp : If not NULL, checks that this logfile is from this time. + * * logfile : Name of logfile in config dir. + * * dynamic_disklist : If not NULL, adds disks not already in the global + * disklist to the given disklist (and the global one). + * If dynamic_disklist is NULL, skips disks not in the + * global disklist. + */ +gboolean search_logfile(find_result_t **output_find, const char *volume_label, + const char *log_datestamp, const char *logfile, + disklist_t * dynamic_disklist); +#endif /* !FIND_H */