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