2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
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.
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.
23 * Author: James da Silva, Systems Design and Analysis Group
24 * Computer Science Department
25 * University of Maryland at College Park
28 * $Id: find.c,v 1.33 2006/07/06 13:13:15 martinea Exp $
30 * controlling process for the Amanda backup system
40 int find_match(char *host, char *disk);
41 void search_holding_disk(find_result_t **output_find);
42 char *find_nicedate(char *datestamp);
43 static int find_compare(const void *, const void *);
44 static int parse_taper_datestamp_log(char *logline, char **datestamp, char **level);
45 static gboolean logfile_has_tape(char * label, char * datestamp,
48 static char *find_sort_order = NULL;
50 find_result_t * find_dump(disklist_t* diskqp) {
51 char *conf_logdir, *logfile = NULL;
52 int tape, maxtape, logs;
55 find_result_t *output_find = NULL;
57 conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
58 maxtape = lookup_nb_tape();
60 for(tape = 1; tape <= maxtape; tape++) {
62 tp = lookup_tapepos(tape);
63 if(tp == NULL) continue;
65 /* search log files */
69 /* new-style log.<date>.<seq> */
71 for(seq = 0; 1; seq++) {
72 char seq_str[NUM_STR_SIZE];
74 g_snprintf(seq_str, SIZEOF(seq_str), "%u", seq);
75 logfile = newvstralloc(logfile,
76 conf_logdir, "/log.", tp->datestamp, ".", seq_str, NULL);
77 if(access(logfile, R_OK) != 0) break;
78 if (search_logfile(&output_find, tp->label, tp->datestamp,
84 /* search old-style amflush log, if any */
86 logfile = newvstralloc(logfile, conf_logdir, "/log.",
87 tp->datestamp, ".amflush", NULL);
88 if(access(logfile,R_OK) == 0) {
89 if (search_logfile(&output_find, tp->label, tp->datestamp,
95 /* search old-style main log, if any */
97 logfile = newvstralloc(logfile, conf_logdir, "/log.", tp->datestamp,
99 if(access(logfile,R_OK) == 0) {
100 if (search_logfile(&output_find, tp->label, tp->datestamp,
105 if(logs == 0 && strcmp(tp->datestamp,"0") != 0)
107 _("Warning: no log files found for tape %s written %s\n"),
108 tp->label, find_nicedate(tp->datestamp));
113 search_holding_disk(&output_find);
121 char *conf_logdir, *logfile = NULL;
122 char *pathlogfile = NULL;
123 int tape, maxtape, logs;
126 char **output_find_log = NULL;
129 conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
130 maxtape = lookup_nb_tape();
132 output_find_log = alloc((maxtape*5+10) * SIZEOF(char *));
133 current_log = output_find_log;
135 for(tape = 1; tape <= maxtape; tape++) {
137 tp = lookup_tapepos(tape);
138 if(tp == NULL) continue;
140 /* search log files */
144 /* new-style log.<date>.<seq> */
146 for(seq = 0; 1; seq++) {
147 char seq_str[NUM_STR_SIZE];
149 g_snprintf(seq_str, SIZEOF(seq_str), "%u", seq);
150 logfile = newvstralloc(logfile, "log.", tp->datestamp, ".", seq_str, NULL);
151 pathlogfile = newvstralloc(pathlogfile, conf_logdir, "/", logfile, NULL);
152 if (access(pathlogfile, R_OK) != 0) break;
153 if (logfile_has_tape(tp->label, tp->datestamp, pathlogfile)) {
154 if (current_log == output_find_log || strcmp(*(current_log-1), logfile)) {
155 *current_log = stralloc(logfile);
163 /* search old-style amflush log, if any */
165 logfile = newvstralloc(logfile, "log.", tp->datestamp, ".amflush", NULL);
166 pathlogfile = newvstralloc(pathlogfile, conf_logdir, "/", logfile, NULL);
167 if (access(pathlogfile, R_OK) == 0) {
168 if (logfile_has_tape(tp->label, tp->datestamp, pathlogfile)) {
169 if (current_log == output_find_log || strcmp(*(current_log-1), logfile)) {
170 *current_log = stralloc(logfile);
177 /* search old-style main log, if any */
179 logfile = newvstralloc(logfile, "log.", tp->datestamp, NULL);
180 pathlogfile = newvstralloc(pathlogfile, conf_logdir, "/", logfile, NULL);
181 if (access(pathlogfile, R_OK) == 0) {
182 if (logfile_has_tape(tp->label, tp->datestamp, pathlogfile)) {
183 if (current_log == output_find_log || strcmp(*(current_log-1), logfile)) {
184 *current_log = stralloc(logfile);
191 if(logs == 0 && strcmp(tp->datestamp,"0") != 0)
192 g_fprintf(stderr, _("Warning: no log files found for tape %s written %s\n"),
193 tp->label, find_nicedate(tp->datestamp));
199 return(output_find_log);
204 find_result_t **output_find)
206 GSList *holding_file_list;
212 holding_file_list = holding_get_files(NULL, 1);
214 for(e = holding_file_list; e != NULL; e = e->next) {
215 holding_file = (char *)e->data;
217 if (!holding_file_get_dumpfile(holding_file, &file))
220 if (file.dumplevel < 0 || file.dumplevel > 9)
226 if((dp = lookup_disk(file.name, file.disk)))
228 if((s = strrchr(file.name,'.')) == NULL)
236 if(find_match(file.name,file.disk)) {
237 find_result_t *new_output_find =
238 alloc(SIZEOF(find_result_t));
239 new_output_find->next=*output_find;
240 new_output_find->timestamp = stralloc(file.datestamp);
241 new_output_find->hostname = stralloc(file.name);
242 new_output_find->diskname = stralloc(file.disk);
243 new_output_find->level=file.dumplevel;
244 new_output_find->label=stralloc(holding_file);
245 new_output_find->partnum=stralloc("--");
246 new_output_find->filenum=0;
247 new_output_find->status=stralloc("OK");
248 *output_find=new_output_find;
252 g_slist_free_full(holding_file_list);
261 find_result_t *i, *j;
263 size_t nb_compare=strlen(find_sort_order);
266 for(k=0;k<nb_compare;k++) {
267 char sort_key = find_sort_order[k];
268 if (isupper((int)sort_key)) {
270 sort_key = tolower(sort_key);
271 j = *(find_result_t **)i1;
272 i = *(find_result_t **)j1;
274 i = *(find_result_t **)i1;
275 j = *(find_result_t **)j1;
279 case 'h' : compare=strcmp(i->hostname,j->hostname);
281 case 'k' : compare=strcmp(i->diskname,j->diskname);
283 case 'd' : compare=strcmp(i->timestamp,j->timestamp);
285 case 'l' : compare=j->level - i->level;
287 case 'f' : compare=(i->filenum == j->filenum) ? 0 :
288 ((i->filenum < j->filenum) ? -1 : 1);
290 case 'b' : compare=compare_possibly_null_strings(i->label,
294 if(strcmp(i->partnum, "--") != 0 &&
295 strcmp(j->partnum, "--") != 0){
296 compare = atoi(i->partnum) - atoi(j->partnum);
298 else compare=strcmp(i->partnum,j->partnum);
310 find_result_t **output_find)
312 find_result_t *output_find_result;
313 find_result_t **array_find_result = NULL;
317 find_sort_order = sort_order;
318 /* qsort core dump if nothing to sort */
319 if(*output_find==NULL)
322 /* How many result */
323 for(output_find_result=*output_find;
325 output_find_result=output_find_result->next) {
329 /* put the list in an array */
330 array_find_result=alloc(nb_result * SIZEOF(find_result_t *));
331 for(output_find_result=*output_find,no_result=0;
333 output_find_result=output_find_result->next,no_result++) {
334 array_find_result[no_result]=output_find_result;
338 qsort(array_find_result,nb_result,SIZEOF(find_result_t *),
341 /* put the sorted result in the list */
343 no_result<nb_result-1; no_result++) {
344 array_find_result[no_result]->next = array_find_result[no_result+1];
346 array_find_result[nb_result-1]->next=NULL;
347 *output_find=array_find_result[0];
348 amfree(array_find_result);
353 find_result_t *output_find)
355 find_result_t *output_find_result;
356 int max_len_datestamp = 4;
357 int max_len_hostname = 4;
358 int max_len_diskname = 4;
359 int max_len_level = 2;
360 int max_len_label =12;
361 int max_len_filenum = 4;
362 int max_len_part = 4;
363 int max_len_status = 6;
366 for(output_find_result=output_find;
368 output_find_result=output_find_result->next) {
371 len=strlen(find_nicedate(output_find_result->timestamp));
372 if((int)len > max_len_datestamp)
373 max_len_datestamp=(int)len;
375 len=strlen(output_find_result->hostname);
376 if((int)len > max_len_hostname)
377 max_len_hostname = (int)len;
379 qdiskname=quote_string(output_find_result->diskname);
380 len=strlen(qdiskname);
382 if((int)len > max_len_diskname)
383 max_len_diskname = (int)len;
385 if (output_find_result->label != NULL) {
386 len=strlen(output_find_result->label);
387 if((int)len > max_len_label)
388 max_len_label = (int)len;
391 len=strlen(output_find_result->status);
392 if((int)len > max_len_status)
393 max_len_status = (int)len;
395 len=strlen(output_find_result->partnum);
396 if((int)len > max_len_part)
397 max_len_part = (int)len;
401 * Since status is the rightmost field, we zap the maximum length
402 * because it is not needed. The code is left in place in case
403 * another column is added later.
407 if(output_find==NULL) {
408 g_printf(_("\nNo dump to list\n"));
411 g_printf(_("\ndate%*s host%*s disk%*s lv%*s tape or file%*s file%*s part%*s status\n"),
412 max_len_datestamp-4,"",
413 max_len_hostname-4 ,"",
414 max_len_diskname-4 ,"",
416 max_len_label-12 ,"",
417 max_len_filenum-4 ,"",
419 for(output_find_result=output_find;
421 output_find_result=output_find_result->next) {
423 char * formatted_label;
425 qdiskname = quote_string(output_find_result->diskname);
426 formatted_label = output_find_result->label;
427 if (formatted_label == NULL)
428 formatted_label = "";
430 g_printf("%-*s %-*s %-*s %*d %-*s %*lld %*s %-*s\n",
432 find_nicedate(output_find_result->timestamp),
433 max_len_hostname, output_find_result->hostname,
434 max_len_diskname, qdiskname,
435 max_len_level, output_find_result->level,
436 max_len_label, formatted_label,
437 max_len_filenum, (long long)output_find_result->filenum,
438 max_len_part, output_find_result->partnum,
439 max_len_status, output_find_result->status
449 find_result_t **output_find)
451 find_result_t *output_find_result, *prev;
454 for(output_find_result=*output_find;
456 output_find_result=output_find_result->next) {
458 amfree(output_find_result->timestamp);
459 amfree(output_find_result->hostname);
460 amfree(output_find_result->diskname);
461 amfree(output_find_result->label);
462 amfree(output_find_result->partnum);
463 amfree(output_find_result->status);
464 prev = output_find_result;
475 disk_t *dp = lookup_disk(host,disk);
476 return (dp && dp->todo);
483 static char nice[20];
484 int year, month, day;
485 int hours, minutes, seconds;
486 char date[9], atime[7];
487 int numdate, numtime;
489 strncpy(date, datestamp, 8);
491 numdate = atoi(date);
492 year = numdate / 10000;
493 month = (numdate / 100) % 100;
496 if(strlen(datestamp) <= 8) {
497 g_snprintf(nice, SIZEOF(nice), "%4d-%02d-%02d",
501 strncpy(atime, &(datestamp[8]), 6);
503 numtime = atoi(atime);
504 hours = numtime / 10000;
505 minutes = (numtime / 100) % 100;
506 seconds = numtime % 100;
508 g_snprintf(nice, SIZEOF(nice), "%4d-%02d-%02d %02d:%02d:%02d",
509 year, month, day, hours, minutes, seconds);
516 parse_taper_datestamp_log(
527 skip_whitespace(s, ch);
531 if(strncmp_const_skip(s - 1, "datestamp", s, ch) != 0) {
535 skip_whitespace(s, ch);
540 skip_non_whitespace(s, ch);
543 skip_whitespace(s, ch);
547 if(strncmp_const_skip(s - 1, "label", s, ch) != 0) {
551 skip_whitespace(s, ch);
556 skip_non_whitespace(s, ch);
562 /* Returns TRUE if the given logfile mentions the given tape. */
563 static gboolean logfile_has_tape(char * label, char * datestamp,
566 char * ck_datestamp, *ck_label;
567 if((logf = fopen(logfile, "r")) == NULL) {
568 error(_("could not open logfile %s: %s"), logfile, strerror(errno));
572 while(get_logline(logf)) {
573 if(curlog == L_START && curprog == P_TAPER) {
574 if(parse_taper_datestamp_log(curstr,
575 &ck_datestamp, &ck_label) == 0) {
576 g_printf(_("strange log line \"start taper %s\" curstr='%s'\n"),
578 } else if(strcmp(ck_datestamp, datestamp) == 0
579 && strcmp(ck_label, label) == 0) {
590 /* Like (strcmp(label1, label2) == 0), except that NULL values force TRUE. */
591 static gboolean volume_matches(const char * label1, const char * label2) {
592 return (label1 == NULL || label2 == NULL || strcmp(label1, label2) == 0);
595 /* WARNING: Function accesses globals find_diskqp, curlog, curlog, curstr,
596 * dynamic_disklist */
599 find_result_t **output_find,
601 const char *passed_datestamp,
603 disklist_t * dynamic_disklist)
606 char *host, *host_undo;
607 char *disk, *qdisk, *disk_undo;
608 char *date, *date_undo;
609 char *partnum=NULL, *partnum_undo;
612 char *current_label = NULL;
617 char *ck_datestamp, *datestamp;
621 find_result_t *part_find = NULL; /* List for all part of a DLE */
622 find_result_t *a_part_find;
623 gboolean right_label = FALSE;
624 gboolean found_something = FALSE;
626 g_return_val_if_fail(output_find != NULL, 0);
627 g_return_val_if_fail(logfile != NULL, 0);
629 datestamp = g_strdup(passed_datestamp);
631 if((logf = fopen(logfile, "r")) == NULL) {
632 error(_("could not open logfile %s: %s"), logfile, strerror(errno));
637 while(get_logline(logf)) {
638 if (curlog == L_START && curprog == P_TAPER) {
639 if(parse_taper_datestamp_log(curstr, &ck_datestamp,
641 g_printf(_("strange log line in %s \"start taper %s\"\n"),
645 if (datestamp != NULL) {
646 if (strcmp(datestamp, ck_datestamp) != 0) {
647 g_printf(_("Log file %s stamped %s, expecting %s!\n"),
648 logfile, ck_datestamp, datestamp);
653 right_label = volume_matches(label, ck_label);
654 if (label && datestamp && right_label) {
655 found_something = TRUE;
657 amfree(current_label);
658 current_label = g_strdup(ck_label);
659 if (datestamp == NULL) {
660 datestamp = g_strdup(ck_datestamp);
666 if ((curlog == L_SUCCESS ||
667 curlog == L_CHUNK || curlog == L_PART || curlog == L_PARTPARTIAL) &&
668 curprog == P_TAPER) {
672 if (curlog == L_SUCCESS || curlog == L_CHUNKSUCCESS ||
673 curlog == L_DONE || curlog == L_FAIL ||
674 curlog == L_CHUNK || curlog == L_PART || curlog == L_PARTIAL ||
675 curlog == L_PARTPARTIAL ) {
679 skip_whitespace(s, ch);
681 g_printf(_("strange log line in %s \"%s\"\n"),
686 if (curlog == L_PART || curlog == L_PARTPARTIAL) {
687 char * part_label = s - 1;
688 skip_non_whitespace(s, ch);
691 if (strcmp(current_label, part_label) != 0) {
692 g_printf("PART label %s doesn't match START label %s\n",
693 part_label, current_label);
696 skip_whitespace(s, ch);
698 g_printf("strange log line in %s \"%s\"\n",
704 skip_non_whitespace(s, ch);
706 fileno = atoi(number);
709 skip_whitespace(s, ch);
711 g_printf("strange log line in %s \"%s\"\n",
718 skip_non_whitespace(s, ch);
722 skip_whitespace(s, ch);
724 g_printf(_("strange log line in %s \"%s\"\n"),
729 skip_quoted_string(s, ch);
732 disk = unquote_string(qdisk);
734 skip_whitespace(s, ch);
736 g_printf(_("strange log line in %s \"%s\"\n"),
741 skip_non_whitespace(s, ch);
745 if(strlen(date) < 3) { /* old log didn't have datestamp */
747 date = stralloc(datestamp);
749 if (curlog == L_CHUNK || curlog == L_PART ||
750 curlog == L_PARTPARTIAL || curlog == L_DONE){
751 skip_whitespace(s, ch);
753 skip_non_whitespace(s, ch);
754 partnum_undo = s - 1;
755 *partnum_undo = '\0';
757 skip_whitespace(s, ch);
758 if(ch == '\0' || sscanf(s - 1, "%d", &level) != 1) {
759 g_printf(_("strange log line in %s \"%s\"\n"),
766 skip_whitespace(s, ch);
768 g_printf(_("strange log line in %s \"%s\"\n"),
773 if((s = strchr(s, '\n')) != NULL) {
777 dp = lookup_disk(host,disk);
779 if (dynamic_disklist == NULL) {
782 dp = add_disk(dynamic_disklist, host, disk);
783 enqueue_disk(dynamic_disklist, dp);
785 if (find_match(host, disk)) {
786 if(curprog == P_TAPER) {
787 find_result_t *new_output_find =
788 (find_result_t *)alloc(SIZEOF(find_result_t));
789 new_output_find->timestamp = stralloc(date);
790 new_output_find->hostname=stralloc(host);
791 new_output_find->diskname=stralloc(disk);
792 new_output_find->level=level;
793 new_output_find->partnum = stralloc(partnum);
794 new_output_find->label=stralloc(current_label);
795 new_output_find->status=NULL;
796 new_output_find->filenum=filenum;
797 new_output_find->next=NULL;
798 if (curlog == L_SUCCESS) {
799 new_output_find->status = stralloc("OK");
800 new_output_find->next = *output_find;
801 *output_find = new_output_find;
802 found_something = TRUE;
803 } else if (curlog == L_CHUNKSUCCESS || curlog == L_DONE ||
804 curlog == L_PARTIAL || curlog == L_FAIL) {
806 if (curlog == L_PARTIAL || curlog == L_FAIL) {
807 /* change status of each part */
808 for (a_part_find = part_find; a_part_find;
809 a_part_find = a_part_find->next) {
810 if (curlog == L_PARTIAL)
811 a_part_find->status = stralloc("PARTIAL");
813 a_part_find->status = stralloc(rest);
816 if (part_find) { /* find last element */
817 for (a_part_find = part_find;
818 a_part_find->next != NULL;
819 a_part_find=a_part_find->next) {
821 /* merge part_find to *output_find */
822 a_part_find->next = *output_find;
823 *output_find = part_find;
825 found_something = TRUE;
827 free_find_result(&new_output_find);
828 } else { /* part line */
829 if (curlog == L_PART || curlog == L_CHUNK)
830 new_output_find->status=stralloc("OK");
831 else /* PARTPARTIAL */
832 new_output_find->status=stralloc("PARTIAL");
833 /* Add to part_find list */
834 new_output_find->next = part_find;
835 part_find = new_output_find;
836 found_something = TRUE;
839 else if(curlog == L_FAIL) { /* print other failures too */
840 find_result_t *new_output_find =
841 (find_result_t *)alloc(SIZEOF(find_result_t));
842 new_output_find->next=*output_find;
843 new_output_find->timestamp = stralloc(date);
844 new_output_find->hostname=stralloc(host);
845 new_output_find->diskname=stralloc(disk);
846 new_output_find->level=level;
847 new_output_find->label=NULL;
848 new_output_find->partnum=stralloc(partnum);
849 new_output_find->filenum=0;
850 new_output_find->status=vstralloc(
852 program_str[(int)curprog],
856 *output_find=new_output_find;
857 found_something = TRUE;
864 if (part_find != NULL) {
866 /* parse log file until PARTIAL/DONE/SUCCESS/FAIL from taper */
867 while(get_logline(logf)) {
868 if (curprog == P_TAPER &&
869 (curlog == L_DONE || curlog == L_SUCCESS ||
870 curlog == L_PARTIAL || curlog == L_FAIL)) {
875 for (a_part_find = part_find; a_part_find;
876 a_part_find = a_part_find->next) {
877 if (curlog == L_PARTIAL)
878 a_part_find->status = stralloc("PARTIAL");
879 else if (curlog == L_FAIL)
880 a_part_find->status = stralloc("FAIL");
882 for (a_part_find = part_find;
883 a_part_find->next != NULL;
884 a_part_find=a_part_find->next) {
886 /* merge part_find to *output_find */
887 a_part_find->next = *output_find;
888 *output_find = part_find;
894 amfree(current_label);
896 return found_something;
901 * Return the set of dumps that match *all* of the given patterns (we consider
902 * an empty pattern to match .*, though). If 'ok' is true, will only match
903 * dumps with SUCCESS status.
905 * Returns a newly allocated list of results, where all strings are also newly
906 * allocated. Apparently some part of Amanda leaks under this condition.
910 find_result_t *output_find,
917 find_result_t *cur_result;
918 find_result_t *matches = NULL;
920 for(cur_result=output_find;
922 cur_result=cur_result->next) {
923 char level_str[NUM_STR_SIZE];
924 g_snprintf(level_str, SIZEOF(level_str), "%d", cur_result->level);
925 if((!hostname || *hostname == '\0' || match_host(hostname, cur_result->hostname)) &&
926 (!diskname || *diskname == '\0' || match_disk(diskname, cur_result->diskname)) &&
927 (!datestamp || *datestamp== '\0' || match_datestamp(datestamp, cur_result->timestamp)) &&
928 (!level || *level== '\0' || match_level(level, level_str)) &&
929 (!ok || !strcmp(cur_result->status, "OK"))){
931 find_result_t *curmatch = alloc(SIZEOF(find_result_t));
932 memcpy(curmatch, cur_result, SIZEOF(find_result_t));
934 curmatch->timestamp = stralloc(cur_result->timestamp);
935 curmatch->hostname = stralloc(cur_result->hostname);
936 curmatch->diskname = stralloc(cur_result->diskname);
937 curmatch->level = cur_result->level;
938 curmatch->label = stralloc(cur_result->label);
939 curmatch->filenum = cur_result->filenum;
940 curmatch->status = stralloc(cur_result->status);
941 curmatch->partnum = stralloc(cur_result->partnum);
943 curmatch->next = matches;
952 * Return the set of dumps that match one or more of the given dumpspecs,
953 * If 'ok' is true, only dumps with a SUCCESS status will be matched.
955 * Returns a newly allocated list of results, where all strings are also newly
956 * allocated. Apparently some part of Amanda leaks under this condition.
959 dumps_match_dumpspecs(
960 find_result_t *output_find,
964 find_result_t *cur_result;
965 find_result_t *matches = NULL;
969 for(cur_result=output_find;
971 cur_result=cur_result->next) {
972 char level_str[NUM_STR_SIZE];
973 g_snprintf(level_str, SIZEOF(level_str), "%d", cur_result->level);
974 for (dumpspec = dumpspecs; dumpspec; dumpspec = dumpspec->next) {
975 ds = (dumpspec_t *)dumpspec->data;
976 if((!ds->host || *ds->host == '\0' || match_host(ds->host, cur_result->hostname)) &&
977 (!ds->disk || *ds->disk == '\0' || match_disk(ds->disk, cur_result->diskname)) &&
978 (!ds->datestamp || *ds->datestamp== '\0' || match_datestamp(ds->datestamp, cur_result->timestamp)) &&
979 (!ds->level || *ds->level== '\0' || match_level(ds->level, level_str)) &&
980 (!ok || !strcmp(cur_result->status, "OK"))){
982 find_result_t *curmatch = alloc(SIZEOF(find_result_t));
983 memcpy(curmatch, cur_result, SIZEOF(find_result_t));
985 curmatch->timestamp = stralloc(cur_result->timestamp);
986 curmatch->hostname = stralloc(cur_result->hostname);
987 curmatch->diskname = stralloc(cur_result->diskname);
988 curmatch->level = cur_result->level;
989 curmatch->label = stralloc(cur_result->label);
990 curmatch->filenum = cur_result->filenum;
991 curmatch->status = stralloc(cur_result->status);
992 curmatch->partnum = stralloc(cur_result->partnum);
994 curmatch->next = matches;
1006 find_result_t *output_find,
1012 find_result_t *output_find_result;
1014 for(output_find_result=output_find;
1016 output_find_result=output_find_result->next) {
1017 if( !strcmp(output_find_result->hostname, hostname) &&
1018 !strcmp(output_find_result->diskname, diskname) &&
1019 !strcmp(output_find_result->timestamp, datestamp) &&
1020 output_find_result->level == level) {
1022 return output_find_result;