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