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; /* dump timestamp */ 11 char *write_timestamp; 12 char *hostname; 13 char *diskname; 14 int level; 15 char *label; /* holding filename for holding files */ 16 off_t filenum; 17 char *status; /* status of the part */ 18 char *dump_status; /* status of the dump; should be identical for all parts in dump */ 19 char *message; /* reason for dump_status; should be identical for all parts in dump */ 20 int partnum; /* -1 for holding files */ 21 int totalparts; /* -1 for holding files */ 22 double sec; /* may be 0.0 for older log files or holding files */ 23 off_t bytes; /* may be 0 for older log files, can be compressed */ 24 off_t kb; /* may be 0 for older log files, can be compressed */ 25 off_t orig_kb; /* native size */ 26 void *user_ptr; 27 } find_result_t; 28 29 /* Finds /all/ dumps still on a volume. If diskqp is not NULL, then dumps 30 * not matching any existing disklist entry will be added to diskqp and to 31 * the global disklist. If diskqp is NULL, disks not matching existing 32 * disklist entries will be skipped. See search_logfile below, which does 33 * the dirty work for find_dump. */ 34 find_result_t *find_dump(disklist_t* diskqp); 35 36 /* Return a list of unqualified filenames of logfiles for active 37 * tapes. Filenames are relative to the logdir. 38 * 39 * @returns: dynamically allocated, null-terminated strv 40 */ 41 char **find_log(void); 42 43 void sort_find_result(char *sort_order, find_result_t **output_find); 44 void print_find_result(find_result_t *output_find); 45 void free_find_result(find_result_t **output_find); 46 find_result_t *dump_exist(find_result_t *output_find, char *hostname, 47 char *diskname, char *datestamp, int level); 48 find_result_t *dumps_match(find_result_t *output_find, char *hostname, 49 char *diskname, char *datestamp, char *level, 50 int ok); 51 find_result_t *dumps_match_dumpspecs(find_result_t *output_find, 52 GSList *dumpspecs, 53 int ok); 54 55 /* This function looks in a particular log.xxx file for dumps. Returns TRUE 56 * if something was found. This function also skips dumps whose disklist 57 * entries are not marked 'todo'. 58 * * output_find : Put found dumps here. 59 * * volume_label : If not NULL, restrict the search to 60 * dumps matching the given volume details. 61 * * log_datestamp : If not NULL, checks that this logfile is from this time. 62 * * logfile : Name of logfile in config dir. 63 * * dynamic_disklist : If not NULL, adds disks not already in the global 64 * disklist to the given disklist (and the global one). 65 * If dynamic_disklist is NULL, skips disks not in the 66 * global disklist. 67 */ 68 gboolean search_logfile(find_result_t **output_find, const char *volume_label, 69 const char *log_datestamp, const char *logfile, 70 disklist_t * dynamic_disklist); 71 72 /* return all dumps on holding disk; not really a search at all. 73 * 74 * * output_find : Put found dumps here. 75 * * dynamic_disklist : If not NULL, adds disks not already in the global 76 * disklist to the given disklist (and the global one). 77 * If dynamic_disklist is NULL, skips disks not in the 78 * global disklist. 79 */ 80 void search_holding_disk( 81 find_result_t **output_find, 82 disklist_t * dynamic_disklist); 83 84 #endif /* !FIND_H */ 85