Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / tools / dumpscan / dumpfmt.h
1 /*
2 * CMUCS AFStools
3 * dumpscan - routines for scanning and manipulating AFS volume dumps
4 *
5 * Copyright (c) 1998, 2001 Carnegie Mellon University
6 * All Rights Reserved.
7 *
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.
13 *
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.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software_Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /* dumpfmt.h - Description of AFS dump format */
30
31 #ifndef _DUMPFMT_H_
32 #define _DUMPFMT_H_
33
34 #include "intNN.h"
35
36 /* AFS dump file format:
37 * All data in AFS dumps is tagged; that is, each data item is preceeded
38 * by a 1-byte tag which identifies what the data item is. There is no
39 * explicit mention of what the data type is, but the type of each possible
40 * data item (and thus, each possible tag) is fixed. Usually this is
41 * a relatively simple, fixed amount of data (byte, short, word), but
42 * sometimes it is more complex.
43 *
44 * There is some amount of structure to an AFS volume dump. Basically,
45 * you get a dump header, followed by a volume header, followed by some
46 * vnodes, followed by a dump end. Each of these items (header, vnode,
47 * dump end) consists of a tag, a fixed amount of required information,
48 * and 0 or more tagged attributes (except dump-end, which has no attributes).
49 *
50 * Vnodes, in turn, are usually listed in a particular order. First, we
51 * list all the directory vnodes in the volume, in increasing order by
52 * vnode. Then, we list all the file vnodes, again in increasing order.
53 * Directory vnodes must have a complete set of attributes and data, but
54 * in an incremental dump, file vnodes may have no attributes if the vnode
55 * has not changed since the reference date.
56 *
57 * The primary purpose of this file is to define the tags and some magic
58 * numbers. There is also some information that is defined in the Transarc
59 * provided header files.
60 */
61
62
63 /** MAGIC NUMBERS **/
64 #define DUMPVERSION 1
65 #define DUMPBEGINMAGIC 0xb3a11322
66 #define DUMPENDMAGIC 0x3a214b6e
67
68
69 /** TOP-LEVEL TAGS **/
70 #define TAG_DUMPHEADER 1
71 #define TAG_VOLHEADER 2
72 #define TAG_VNODE 3
73 #define TAG_DUMPEND 4
74
75
76 /** DUMP HEADER TAGS **/
77 #define DHTAG_VOLNAME 'n'
78 #define DHTAG_VOLID 'v'
79 #define DHTAG_DUMPTIMES 't'
80
81
82 /** VOLUME HEADER TAGS **/
83 #define VHTAG_VOLID 'i'
84 #define VHTAG_VERS 'v'
85 #define VHTAG_VOLNAME 'n'
86 #define VHTAG_INSERV 's'
87 #define VHTAG_BLESSED 'b'
88 #define VHTAG_VUNIQ 'u'
89 #define VHTAG_TYPE 't'
90 #define VHTAG_PARENT 'p'
91 #define VHTAG_CLONE 'c'
92 #define VHTAG_MAXQUOTA 'q'
93 #define VHTAG_MINQUOTA 'm'
94 #define VHTAG_DISKUSED 'd'
95 #define VHTAG_FILECNT 'f'
96 #define VHTAG_ACCOUNT 'a'
97 #define VHTAG_OWNER 'o'
98 #define VHTAG_CREAT 'C'
99 #define VHTAG_ACCESS 'A'
100 #define VHTAG_UPDATE 'U'
101 #define VHTAG_EXPIRE 'E'
102 #define VHTAG_BACKUP 'B'
103 #define VHTAG_OFFLINE 'O'
104 #define VHTAG_MOTD 'M'
105 #define VHTAG_WEEKUSE 'W'
106 #define VHTAG_DUDATE 'D'
107 #define VHTAG_DAYUSE 'Z'
108
109
110 /** VNODE TAGS **/
111 #define VTAG_TYPE 't'
112 #define VTAG_NLINKS 'l'
113 #define VTAG_DVERS 'v'
114 #define VTAG_CLIENT_DATE 'm'
115 #define VTAG_AUTHOR 'a'
116 #define VTAG_OWNER 'o'
117 #define VTAG_GROUP 'g'
118 #define VTAG_MODE 'b'
119 #define VTAG_PARENT 'p'
120 #define VTAG_SERVER_DATE 's'
121 #define VTAG_ACL 'A'
122 #define VTAG_DATA 'f'
123
124
125 #define AFS_DIR_MAGIC 1234
126 #define AFS_DIR_EPP 64
127 #define AFS_DIR_MAXPAGES 128
128 #define AFS_DIR_NHASH 128
129
130 typedef struct {
131 afs_uint16 pgcount;
132 afs_uint16 tag;
133 char freecount;
134 char freebitmap[AFS_DIR_EPP/8];
135 char padding[32 - (5 + AFS_DIR_EPP/8)];
136 } afs_dir_pagehdr;
137
138 typedef struct {
139 afs_dir_pagehdr pagehdr;
140 char allomap[AFS_DIR_MAXPAGES];
141 afs_uint16 hash[AFS_DIR_NHASH];
142 } afs_dir_header;
143
144 typedef struct {
145 char flag;
146 char length;
147 afs_uint16 next;
148 afs_uint32 vnode;
149 afs_uint32 vunique;
150 char name[16];
151 char padding[4];
152 } afs_dir_direntry;
153
154 typedef union {
155 afs_dir_pagehdr header;
156 afs_dir_direntry entry[AFS_DIR_EPP];
157 } afs_dir_page;
158
159 #endif /* _DUMPFMT_H_ */