xref: /freebsd/include/protocols/dumprestore.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
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  *
40  * $FreeBSD$
41  */
42 
43 #ifndef _PROTOCOLS_DUMPRESTORE_H_
44 #define _PROTOCOLS_DUMPRESTORE_H_
45 
46 /*
47  * TP_BSIZE is the size of file blocks on the dump tapes.
48  * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
49  *
50  * NTREC is the number of TP_BSIZE blocks that are written
51  * in each tape record. HIGHDENSITYTREC is the number of
52  * TP_BSIZE blocks that are written in each tape record on
53  * 6250 BPI or higher density tapes.
54  *
55  * TP_NINDIR is the number of indirect pointers in a TS_INODE
56  * or TS_ADDR record. Note that it must be a power of two.
57  */
58 #define TP_BSIZE	1024
59 #define NTREC   	10
60 #define HIGHDENSITYTREC	32
61 #define TP_NINDIR	(TP_BSIZE/2)
62 #define LBLSIZE		16
63 #define NAMELEN		64
64 
65 #define OFS_MAGIC   	(int)60011
66 #define NFS_MAGIC   	(int)60012
67 #ifndef FS_UFS2_MAGIC
68 #define FS_UFS2_MAGIC  	(int)0x19540119
69 #endif
70 #define CHECKSUM	(int)84446
71 
72 union u_spcl {
73 	char dummy[TP_BSIZE];
74 	struct	s_spcl {
75 		int32_t	c_type;		    /* record type (see below) */
76 		int32_t	c_old_date;	    /* date of this dump */
77 		int32_t	c_old_ddate;	    /* date of previous dump */
78 		int32_t	c_volume;	    /* dump volume number */
79 		int32_t	c_old_tapea;	    /* logical block of this record */
80 		ino_t	c_inumber;	    /* number of inode */
81 		int32_t	c_magic;	    /* magic number (see above) */
82 		int32_t	c_checksum;	    /* record checksum */
83 		/*
84 		 * Start old dinode structure, expanded for binary
85 		 * compatibility with UFS1.
86 		 */
87 		u_int16_t c_mode;	    /* file mode */
88 		int16_t	c_spare1[3];	    /* old nlink, ids */
89 		u_int64_t c_size;	    /* file byte count */
90 		int32_t	c_old_atime;	    /* old last access time, seconds */
91 		int32_t	c_atimensec;	    /* last access time, nanoseconds */
92 		int32_t	c_old_mtime;	    /* old last modified time, secs */
93 		int32_t	c_mtimensec;	    /* last modified time, nanosecs */
94 		int32_t	c_spare2[2];	    /* old ctime */
95 		int32_t	c_rdev;		    /* for devices, device number */
96 		int32_t	c_birthtimensec;    /* creation time, nanosecs */
97 		int64_t	c_birthtime;	    /* creation time, seconds */
98 		int64_t	c_atime;	    /* last access time, seconds */
99 		int64_t	c_mtime;	    /* last modified time, seconds */
100 		int32_t	c_extsize;	    /* external attribute size */
101 		int32_t	c_spare4[6];	    /* old block pointers */
102 		u_int32_t c_file_flags;	    /* status flags (chflags) */
103 		int32_t	c_spare5[2];	    /* old blocks, generation number */
104 		u_int32_t c_uid;	    /* file owner */
105 		u_int32_t c_gid;	    /* file group */
106 		int32_t	c_spare6[2];	    /* previously unused spares */
107 		/*
108 		 * End old dinode structure.
109 		 */
110 		int32_t	c_count;	    /* number of valid c_addr entries */
111 		char	c_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */
112 		char	c_label[LBLSIZE];   /* dump label */
113 		int32_t	c_level;	    /* level of this dump */
114 		char	c_filesys[NAMELEN]; /* name of dumpped file system */
115 		char	c_dev[NAMELEN];	    /* name of dumpped device */
116 		char	c_host[NAMELEN];    /* name of dumpped host */
117 		int32_t	c_flags;	    /* additional information */
118 		int32_t	c_old_firstrec;	    /* first record on volume */
119 		int64_t	c_date;		    /* date of this dump */
120 		int64_t	c_ddate;	    /* date of previous dump */
121 		int64_t	c_tapea;	    /* logical block of this record */
122 		int64_t	c_firstrec;	    /* first record on volume */
123 		int32_t	c_spare[24];	    /* reserved for future uses */
124 	} s_spcl;
125 } u_spcl;
126 #define spcl u_spcl.s_spcl
127 /*
128  * special record types
129  */
130 #define TS_TAPE 	1	/* dump tape header */
131 #define TS_INODE	2	/* beginning of file record */
132 #define TS_ADDR 	4	/* continuation of file record */
133 #define TS_BITS 	3	/* map of inodes on tape */
134 #define TS_CLRI 	6	/* map of inodes deleted since last dump */
135 #define TS_END  	5	/* end of volume marker */
136 
137 /*
138  * flag values
139  */
140 /* None at the moment */
141 
142 #define	DUMPOUTFMT	"%-32s %c %s"		/* for printf */
143 						/* name, level, ctime(date) */
144 #define	DUMPINFMT	"%32s %c %[^\n]\n"	/* inverse for scanf */
145 
146 #endif /* !_DUMPRESTORE_H_ */
147