xref: /dragonfly/include/protocols/dumprestore.h (revision 73610d44)
1 /*
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the University of
21  *	California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  * @(#)dumprestore.h	8.2 (Berkeley) 1/21/94
39  * $DragonFly: src/include/protocols/dumprestore.h,v 1.3 2006/04/03 01:58:44 dillon Exp $
40  */
41 
42 #ifndef _PROTOCOLS_DUMPRESTORE_H_
43 #define _PROTOCOLS_DUMPRESTORE_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 #define CHECKSUM	(int)84446
67 
68 union u_spcl {
69 	char dummy[TP_BSIZE];
70 	struct	s_spcl {
71 		int32_t	c_type;		    /* record type (see below) */
72 		int32_t	c_date;		    /* date of this dump */
73 		int32_t	c_ddate;	    /* date of previous dump */
74 		int32_t	c_volume;	    /* dump volume number */
75 		daddr_t	c_tapea;	    /* logical block of this record */
76 		u_int32_t c_inumber;	    /* number of inode */
77 		int32_t	c_magic;	    /* magic number (see above) */
78 		int32_t	c_checksum;	    /* record checksum */
79 		struct	ufs1_dinode c_dinode; /* ownership and mode of inode */
80 		int32_t	c_count;	    /* number of valid c_addr entries */
81 		char	c_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */
82 		char	c_label[LBLSIZE];   /* dump label */
83 		int32_t	c_level;	    /* level of this dump */
84 		char	c_filesys[NAMELEN]; /* name of dumpped file system */
85 		char	c_dev[NAMELEN];	    /* name of dumpped device */
86 		char	c_host[NAMELEN];    /* name of dumpped host */
87 		int32_t	c_flags;	    /* additional information */
88 		int32_t	c_firstrec;	    /* first record on volume */
89 		int32_t	c_spare[32];	    /* reserved for future uses */
90 	} s_spcl;
91 } u_spcl;
92 #define spcl u_spcl.s_spcl
93 /*
94  * special record types
95  */
96 #define TS_TAPE 	1	/* dump tape header */
97 #define TS_INODE	2	/* beginning of file record */
98 #define TS_ADDR 	4	/* continuation of file record */
99 #define TS_BITS 	3	/* map of inodes on tape */
100 #define TS_CLRI 	6	/* map of inodes deleted since last dump */
101 #define TS_END  	5	/* end of volume marker */
102 
103 /*
104  * flag values
105  */
106 #define DR_NEWHEADER	0x0001	/* new format tape header */
107 #define DR_NEWINODEFMT	0x0002	/* new format inodes on tape */
108 
109 #define	DUMPOUTFMT	"%-32s %c %s"		/* for printf */
110 						/* name, level, ctime(date) */
111 #define	DUMPINFMT	"%32s %c %[^\n]\n"	/* inverse for scanf */
112 
113 #endif /* !_DUMPRESTORE_H_ */
114