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