dumprestore.h revision 1.12 1 1.12 agc /* $NetBSD: dumprestore.h,v 1.12 2003/08/07 09:44:13 agc Exp $ */
2 1.6 cgd
3 1.4 cgd /*
4 1.5 cgd * Copyright (c) 1980, 1993
5 1.5 cgd * The Regents of the University of California. All rights reserved.
6 1.4 cgd * (c) UNIX System Laboratories, Inc.
7 1.4 cgd * All or some portions of this file are derived from material licensed
8 1.4 cgd * to the University of California by American Telephone and Telegraph
9 1.4 cgd * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 1.4 cgd * the permission of UNIX System Laboratories, Inc.
11 1.4 cgd *
12 1.4 cgd * Redistribution and use in source and binary forms, with or without
13 1.4 cgd * modification, are permitted provided that the following conditions
14 1.4 cgd * are met:
15 1.4 cgd * 1. Redistributions of source code must retain the above copyright
16 1.4 cgd * notice, this list of conditions and the following disclaimer.
17 1.4 cgd * 2. Redistributions in binary form must reproduce the above copyright
18 1.4 cgd * notice, this list of conditions and the following disclaimer in the
19 1.4 cgd * documentation and/or other materials provided with the distribution.
20 1.12 agc * 3. Neither the name of the University nor the names of its contributors
21 1.4 cgd * may be used to endorse or promote products derived from this software
22 1.4 cgd * without specific prior written permission.
23 1.4 cgd *
24 1.4 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 1.4 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.4 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.4 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 1.4 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.4 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.4 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.4 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.4 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.4 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.4 cgd * SUCH DAMAGE.
35 1.4 cgd *
36 1.6 cgd * @(#)dumprestore.h 8.2 (Berkeley) 1/21/94
37 1.4 cgd */
38 1.4 cgd
39 1.8 perry #ifndef _PROTOCOLS_DUMPRESTORE_H_
40 1.8 perry #define _PROTOCOLS_DUMPRESTORE_H_
41 1.4 cgd
42 1.4 cgd /*
43 1.4 cgd * TP_BSIZE is the size of file blocks on the dump tapes.
44 1.4 cgd * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
45 1.4 cgd *
46 1.4 cgd * NTREC is the number of TP_BSIZE blocks that are written
47 1.4 cgd * in each tape record. HIGHDENSITYTREC is the number of
48 1.4 cgd * TP_BSIZE blocks that are written in each tape record on
49 1.4 cgd * 6250 BPI or higher density tapes.
50 1.4 cgd *
51 1.4 cgd * TP_NINDIR is the number of indirect pointers in a TS_INODE
52 1.4 cgd * or TS_ADDR record. Note that it must be a power of two.
53 1.4 cgd */
54 1.4 cgd #define TP_BSIZE 1024
55 1.4 cgd #define NTREC 10
56 1.4 cgd #define HIGHDENSITYTREC 32
57 1.4 cgd #define TP_NINDIR (TP_BSIZE/2)
58 1.4 cgd #define LBLSIZE 16
59 1.4 cgd #define NAMELEN 64
60 1.4 cgd
61 1.4 cgd #define OFS_MAGIC (int)60011
62 1.4 cgd #define NFS_MAGIC (int)60012
63 1.11 fvdl #ifndef FS_UFS2_MAGIC
64 1.11 fvdl #define FS_UFS2_MAGIC (int)0x19540119
65 1.11 fvdl #endif
66 1.4 cgd #define CHECKSUM (int)84446
67 1.4 cgd
68 1.4 cgd union u_spcl {
69 1.4 cgd char dummy[TP_BSIZE];
70 1.4 cgd struct s_spcl {
71 1.7 cgd int32_t c_type; /* record type (see below) */
72 1.11 fvdl int32_t c_old_date; /* date of this dump */
73 1.11 fvdl int32_t c_old_ddate; /* date of previous dump */
74 1.7 cgd int32_t c_volume; /* dump volume number */
75 1.11 fvdl int32_t c_old_tapea; /* logical block of this record */
76 1.4 cgd ino_t c_inumber; /* number of inode */
77 1.7 cgd int32_t c_magic; /* magic number (see above) */
78 1.7 cgd int32_t c_checksum; /* record checksum */
79 1.11 fvdl union {
80 1.11 fvdl struct ufs1_dinode __uc_dinode;
81 1.11 fvdl struct {
82 1.11 fvdl u_int16_t __uc_mode;
83 1.11 fvdl int16_t __uc_spare1[3];
84 1.11 fvdl u_int64_t __uc_size;
85 1.11 fvdl int32_t __uc_old_atime;
86 1.11 fvdl int32_t __uc_atimensec;
87 1.11 fvdl int32_t __uc_old_mtime;
88 1.11 fvdl int32_t __uc_mtimensec;
89 1.11 fvdl int32_t __uc_spare2[2];
90 1.11 fvdl int32_t __uc_rdev;
91 1.11 fvdl int32_t __uc_birthtimensec;
92 1.11 fvdl int64_t __uc_birthtime;
93 1.11 fvdl int64_t __uc_atime;
94 1.11 fvdl int64_t __uc_mtime;
95 1.11 fvdl int32_t __uc_spare4[7];
96 1.11 fvdl u_int32_t __uc_file_flags;
97 1.11 fvdl int32_t __uc_spare5[2];
98 1.11 fvdl u_int32_t __uc_uid;
99 1.11 fvdl u_int32_t __uc_gid;
100 1.11 fvdl int32_t __uc_spare6[2];
101 1.11 fvdl } __uc_ino;
102 1.11 fvdl } __c_ino;
103 1.7 cgd int32_t c_count; /* number of valid c_addr entries */
104 1.4 cgd char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
105 1.4 cgd char c_label[LBLSIZE]; /* dump label */
106 1.7 cgd int32_t c_level; /* level of this dump */
107 1.4 cgd char c_filesys[NAMELEN]; /* name of dumpped file system */
108 1.4 cgd char c_dev[NAMELEN]; /* name of dumpped device */
109 1.4 cgd char c_host[NAMELEN]; /* name of dumpped host */
110 1.7 cgd int32_t c_flags; /* additional information */
111 1.11 fvdl int32_t c_old_firstrec; /* first record on volume */
112 1.11 fvdl int64_t c_date; /* date of this dump */
113 1.11 fvdl int64_t c_ddate; /* date of previous dump */
114 1.11 fvdl int64_t c_tapea; /* logical block of this record */
115 1.11 fvdl int64_t c_firstrec; /* first record on volume */
116 1.11 fvdl int32_t c_spare[24]; /* reserved for future uses */
117 1.4 cgd } s_spcl;
118 1.4 cgd } u_spcl;
119 1.4 cgd #define spcl u_spcl.s_spcl
120 1.11 fvdl
121 1.11 fvdl #define c_dinode __c_ino.__uc_dinode
122 1.11 fvdl #define c_mode __c_ino.__uc_ino.__uc_mode
123 1.11 fvdl #define c_spare1 __c_ino.__uc_ino.__uc_spare1
124 1.11 fvdl #define c_size __c_ino.__uc_ino.__uc_size
125 1.11 fvdl #define c_old_atime __c_ino.__uc_ino.__uc_old_atime
126 1.11 fvdl #define c_atime __c_ino.__uc_ino.__uc_atime
127 1.11 fvdl #define c_atimensec __c_ino.__uc_ino.__uc_atimensec
128 1.11 fvdl #define c_mtime __c_ino.__uc_ino.__uc_mtime
129 1.11 fvdl #define c_mtimensec __c_ino.__uc_ino.__uc_mtimensec
130 1.11 fvdl #define c_birthtime __c_ino.__uc_ino.__uc_birthtime
131 1.11 fvdl #define c_birthtimensec __c_ino.__uc_ino.__uc_birthtimensec
132 1.11 fvdl #define c_old_mtime __c_ino.__uc_ino.__uc_old_mtime
133 1.11 fvdl #define c_rdev __c_ino.__uc_ino.__uc_rdev
134 1.11 fvdl #define c_file_flags __c_ino.__uc_ino.__uc_file_flags
135 1.11 fvdl #define c_uid __c_ino.__uc_ino.__uc_uid
136 1.11 fvdl #define c_gid __c_ino.__uc_ino.__uc_gid
137 1.11 fvdl
138 1.4 cgd /*
139 1.4 cgd * special record types
140 1.4 cgd */
141 1.4 cgd #define TS_TAPE 1 /* dump tape header */
142 1.4 cgd #define TS_INODE 2 /* beginning of file record */
143 1.4 cgd #define TS_ADDR 4 /* continuation of file record */
144 1.4 cgd #define TS_BITS 3 /* map of inodes on tape */
145 1.4 cgd #define TS_CLRI 6 /* map of inodes deleted since last dump */
146 1.4 cgd #define TS_END 5 /* end of volume marker */
147 1.4 cgd
148 1.4 cgd /*
149 1.4 cgd * flag values
150 1.4 cgd */
151 1.4 cgd #define DR_NEWHEADER 0x0001 /* new format tape header */
152 1.4 cgd #define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
153 1.4 cgd
154 1.4 cgd #define DUMPOUTFMT "%-16s %c %s" /* for printf */
155 1.4 cgd /* name, level, ctime(date) */
156 1.4 cgd #define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */
157 1.4 cgd
158 1.8 perry #endif /* !_PROTOCOLS_DUMPRESTORE_H_ */
159