3 * dumpscan - routines for scanning and manipulating AFS volume dumps
5 * Copyright (c) 1998 Carnegie Mellon University
8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation.
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software_Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
29 /* backuphdr.c - Parse and print backup system headers */
34 #include "dumpscan_errs.h"
37 afs_uint32 try_backuphdr(XFILE *X, char *tag, tagged_field *field,
38 afs_uint32 value, tag_parse_info *pi,
39 void *g_refcon, void *l_refcon)
41 dump_parser *p = (dump_parser *)g_refcon;
42 backup_system_header bh;
46 /* Which header should we try (if any)? */
48 case STAGE_VERSMIN: r = ParseStageHdr(X, tag, &bh); break;
49 default: return DSERR_MAGIC;
53 /* Do something with it... */
54 if (p->print_flags & DSPRINT_BCKHDR) PrintBackupHdr(&bh);
56 r = xftell(X, &where);
57 if (!r && p->cb_bckhdr)
58 r = (p->cb_bckhdr)(&bh, X, p->refcon);
59 if (p->flags & DSFLAG_SEEK) {
60 if (!r) r = xfseek(X, &where);
61 else xfseek(X, &where);
64 if (bh.server) free(bh.server);
65 if (bh.part) free(bh.part);
66 if (bh.volname) free(bh.volname);
71 void PrintBackupHdr(backup_system_header *hdr)
73 time_t from = hdr->from_date, to = hdr->to_date, dd = hdr->dump_date;
75 printf("* BACKUP SYSTEM HEADER\n");
76 printf(" Version: %d\n", hdr->version);
77 printf(" Volume: %s (%d)\n", hdr->volname, hdr->volid);
78 printf(" Location: %s %s\n", hdr->server, hdr->part);
79 printf(" Level: %d\n", hdr->level);
80 printf(" Range: %d => %d\n", hdr->from_date, hdr->to_date);
81 printf(" == %s", ctime(&from));
82 printf(" => %s", ctime(&to));
83 printf(" Dump Time: %d == %s", hdr->dump_date, ctime(&dd));
84 printf(" Dump Flags: 0x%08x\n", hdr->flags);
85 printf(" Length: %d\n", hdr->dumplen);
86 printf(" File Num: %d\n", hdr->filenum);