]> git.wh0rd.org - dump.git/blob - compat/include/protocols/dumprestore.h
a9f68e0630a83bb8e8ba78d17922c292319f095c
[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.15 2002/01/16 09:32:14 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 LBLSIZE 16
71 #define NAMELEN 64
72
73 #define OFS_MAGIC (int)60011
74 #define NFS_MAGIC (int)60012
75 #define CHECKSUM (int)84446
76
77 typedef u_int32_t dump_ino_t;
78
79 union u_spcl {
80 char dummy[TP_BSIZE];
81 struct s_spcl {
82 int32_t c_type; /* record type (see below) */
83 int32_t c_date; /* date of this dump */
84 int32_t c_ddate; /* date of previous dump */
85 int32_t c_volume; /* dump volume number */
86 daddr_t c_tapea; /* logical block of this record */
87 dump_ino_t c_inumber; /* number of inode */
88 int32_t c_magic; /* magic number (see above) */
89 int32_t c_checksum; /* record checksum */
90 #ifdef __linux__
91 struct new_bsd_inode c_dinode;
92 #else
93 struct dinode c_dinode; /* ownership and mode of inode */
94 #endif
95 int32_t c_count; /* number of valid c_addr entries */
96 char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
97 char c_label[LBLSIZE]; /* dump label */
98 int32_t c_level; /* level of this dump */
99 char c_filesys[NAMELEN]; /* name of dumpped file system */
100 char c_dev[NAMELEN]; /* name of dumpped device */
101 char c_host[NAMELEN]; /* name of dumpped host */
102 int32_t c_flags; /* additional information */
103 int32_t c_firstrec; /* first record on volume */
104 int32_t c_ntrec; /* blocksize on volume */
105 int32_t c_spare[31]; /* reserved for future uses */
106 } s_spcl;
107 } u_spcl;
108 #define spcl u_spcl.s_spcl
109 /*
110 * special record types
111 */
112 #define TS_TAPE 1 /* dump tape header */
113 #define TS_INODE 2 /* beginning of file record */
114 #define TS_ADDR 4 /* continuation of file record */
115 #define TS_BITS 3 /* map of inodes on tape */
116 #define TS_CLRI 6 /* map of inodes deleted since last dump */
117 #define TS_END 5 /* end of volume marker */
118
119 /*
120 * flag values
121 */
122 #define DR_NEWHEADER 0x0001 /* new format tape header */
123 #define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
124 #define DR_COMPRESSED 0x0080 /* dump tape is compressed */
125
126 /*
127 * compression flags for the tapebuf header.
128 */
129 #define COMPRESS_ZLIB 0
130 #define COMPRESS_BZLIB 1
131
132 /* used for compressed dump tapes */
133 struct tapebuf {
134 unsigned int compressed:1;
135 unsigned int flags:3;
136 unsigned int length:28;
137 char buf[0]; /* the data */
138 };
139
140 #endif /* !_DUMPRESTORE_H_ */