]> git.wh0rd.org - dump.git/blob - compat/include/protocols/dumprestore.h
-A archive file implementation
[dump.git] / compat / include / protocols / dumprestore.h
1 /*
2 * Ported to Linux's Second Extended File System as part of the
3 * dump and restore backup suit
4 * Remy Card <card@Linux.EU.Org>, 1994-1997
5 * Stelian Pop <stelian@popies.net>, 1999-2000
6 * Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
7 *
8 * $Id: dumprestore.h,v 1.16 2002/01/25 14:59:53 stelian Exp $
9 */
10
11 /*
12 * Copyright (c) 1980, 1993
13 * The Regents of the University of California. All rights reserved.
14 * (c) UNIX System Laboratories, Inc.
15 * All or some portions of this file are derived from material licensed
16 * to the University of California by American Telephone and Telegraph
17 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
18 * the permission of UNIX System Laboratories, Inc.
19 *
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions
22 * are met:
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in the
27 * documentation and/or other materials provided with the distribution.
28 * 3. All advertising materials mentioning features or use of this software
29 * must display the following acknowledgement:
30 * This product includes software developed by the University of
31 * California, Berkeley and its contributors.
32 * 4. Neither the name of the University nor the names of its contributors
33 * may be used to endorse or promote products derived from this software
34 * without specific prior written permission.
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
37 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
40 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
42 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
45 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 */
48
49 #ifndef _PROTOCOLS_DUMPRESTORE_H_
50 #define _PROTOCOLS_DUMPRESTORE_H_
51
52 #include <config.h>
53
54 /*
55 * TP_BSIZE is the size of file blocks on the dump tapes.
56 * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
57 *
58 * NTREC is the number of TP_BSIZE blocks that are written
59 * in each tape record. HIGHDENSITYTREC is the number of
60 * TP_BSIZE blocks that are written in each tape record on
61 * 6250 BPI or higher density tapes.
62 *
63 * TP_NINDIR is the number of indirect pointers in a TS_INODE
64 * or TS_ADDR record. Note that it must be a power of two.
65 */
66 #define TP_BSIZE 1024
67 #define NTREC 10
68 #define HIGHDENSITYTREC 32
69 #define TP_NINDIR (TP_BSIZE/2)
70 #define TP_NINOS (TP_NINDIR / sizeof (int32_t))
71 #define LBLSIZE 16
72 #define NAMELEN 64
73
74 #define OFS_MAGIC (int)60011
75 #define NFS_MAGIC (int)60012
76 #define CHECKSUM (int)84446
77
78 typedef u_int32_t dump_ino_t;
79
80 union u_data {
81 char s_addrs[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
82 int32_t s_inos[TP_NINOS]; /* table of first inode on each volume */
83 } u_data;
84
85 union u_spcl {
86 char dummy[TP_BSIZE];
87 struct s_spcl {
88 int32_t c_type; /* record type (see below) */
89 int32_t c_date; /* date of this dump */
90 int32_t c_ddate; /* date of previous dump */
91 int32_t c_volume; /* dump volume number */
92 daddr_t c_tapea; /* logical block of this record */
93 dump_ino_t c_inumber; /* number of inode */
94 int32_t c_magic; /* magic number (see above) */
95 int32_t c_checksum; /* record checksum */
96 #ifdef __linux__
97 struct new_bsd_inode c_dinode;
98 #else
99 struct dinode c_dinode; /* ownership and mode of inode */
100 #endif
101 int32_t c_count; /* number of valid c_addr entries */
102 union u_data c_data; /* see above */
103 char c_label[LBLSIZE]; /* dump label */
104 int32_t c_level; /* level of this dump */
105 char c_filesys[NAMELEN]; /* name of dumpped file system */
106 char c_dev[NAMELEN]; /* name of dumpped device */
107 char c_host[NAMELEN]; /* name of dumpped host */
108 int32_t c_flags; /* additional information */
109 int32_t c_firstrec; /* first record on volume */
110 int32_t c_ntrec; /* blocksize on volume */
111 int32_t c_spare[31]; /* reserved for future uses */
112 } s_spcl;
113 } u_spcl;
114 #define spcl u_spcl.s_spcl
115 #define c_addr c_data.s_addrs
116 #define c_inos c_data.s_inos
117
118 /*
119 * special record types
120 */
121 #define TS_TAPE 1 /* dump tape header */
122 #define TS_INODE 2 /* beginning of file record */
123 #define TS_ADDR 4 /* continuation of file record */
124 #define TS_BITS 3 /* map of inodes on tape */
125 #define TS_CLRI 6 /* map of inodes deleted since last dump */
126 #define TS_END 5 /* end of volume marker */
127
128 /*
129 * flag values
130 */
131 #define DR_NEWHEADER 0x0001 /* new format tape header */
132 #define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
133 #define DR_COMPRESSED 0x0080 /* dump tape is compressed */
134 #define DR_INODEINFO 0x0002 /* TS_END header contains c_inos information */
135
136
137 /*
138 * compression flags for the tapebuf header.
139 */
140 #define COMPRESS_ZLIB 0
141 #define COMPRESS_BZLIB 1
142
143 /* used for compressed dump tapes */
144 struct tapebuf {
145 unsigned int compressed:1;
146 unsigned int flags:3;
147 unsigned int length:28;
148 char buf[0]; /* the data */
149 };
150
151 #endif /* !_DUMPRESTORE_H_ */