123571Sbde/*
223571Sbde * Copyright (c) 1980, 1993
323571Sbde *	The Regents of the University of California.  All rights reserved.
423571Sbde * (c) UNIX System Laboratories, Inc.
523571Sbde * All or some portions of this file are derived from material licensed
623571Sbde * to the University of California by American Telephone and Telegraph
723571Sbde * Co. or Unix System Laboratories, Inc. and are reproduced herein with
823571Sbde * the permission of UNIX System Laboratories, Inc.
923571Sbde *
1023571Sbde * Redistribution and use in source and binary forms, with or without
1123571Sbde * modification, are permitted provided that the following conditions
1223571Sbde * are met:
1323571Sbde * 1. Redistributions of source code must retain the above copyright
1423571Sbde *    notice, this list of conditions and the following disclaimer.
1523571Sbde * 2. Redistributions in binary form must reproduce the above copyright
1623571Sbde *    notice, this list of conditions and the following disclaimer in the
1723571Sbde *    documentation and/or other materials provided with the distribution.
1823571Sbde * 3. Neither the name of the University nor the names of its contributors
1923571Sbde *    may be used to endorse or promote products derived from this software
2023571Sbde *    without specific prior written permission.
2123571Sbde *
2223571Sbde * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2323571Sbde * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2423571Sbde * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2523571Sbde * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2623571Sbde * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2723571Sbde * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2823571Sbde * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2923571Sbde * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3023571Sbde * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3123571Sbde * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3223571Sbde * SUCH DAMAGE.
3350477Speter *
3423571Sbde *	@(#)dumprestore.h	8.2 (Berkeley) 1/21/94
3523571Sbde *
3625111Sbde * $FreeBSD$
3725111Sbde */
3825111Sbde
3923571Sbde#ifndef _PROTOCOLS_DUMPRESTORE_H_
4023571Sbde#define _PROTOCOLS_DUMPRESTORE_H_
4123571Sbde
4223571Sbde/*
4323571Sbde * TP_BSIZE is the size of file blocks on the dump tapes.
4423571Sbde * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
4523571Sbde *
4623571Sbde * NTREC is the number of TP_BSIZE blocks that are written
4723571Sbde * in each tape record. HIGHDENSITYTREC is the number of
4823571Sbde * TP_BSIZE blocks that are written in each tape record on
4923571Sbde * 6250 BPI or higher density tapes.
5023571Sbde *
5123571Sbde * TP_NINDIR is the number of indirect pointers in a TS_INODE
52254463Sjilles * or TS_ADDR record. Note that it must be a power of two.
5323571Sbde */
5423571Sbde#define TP_BSIZE	1024
5523571Sbde#define NTREC   	10
5623571Sbde#define HIGHDENSITYTREC	32
57254463Sjilles#define TP_NINDIR	(TP_BSIZE/2)
5823571Sbde#define LBLSIZE		16
5923571Sbde#define NAMELEN		64
6023571Sbde
6123571Sbde#define OFS_MAGIC   	(int)60011
6223571Sbde#define NFS_MAGIC   	(int)60012
6323571Sbde#ifndef FS_UFS2_MAGIC
6423571Sbde#define FS_UFS2_MAGIC  	(int)0x19540119
6523571Sbde#endif
6623571Sbde#define CHECKSUM	(int)84446
6723571Sbde
68115671Sobrienunion u_spcl {
6923571Sbde	char dummy[TP_BSIZE];
7025111Sbde	struct	s_spcl {
7125111Sbde		int32_t	c_type;		    /* record type (see below) */
7223571Sbde		int32_t	c_old_date;	    /* date of this dump */
7325111Sbde		int32_t	c_old_ddate;	    /* date of previous dump */
7425111Sbde		int32_t	c_volume;	    /* dump volume number */
75171914Sjkoshy		int32_t	c_old_tapea;	    /* logical block of this record */
7625111Sbde		ino_t	c_inumber;	    /* number of inode */
7725111Sbde		int32_t	c_magic;	    /* magic number (see above) */
7856581Sbde		int32_t	c_checksum;	    /* record checksum */
7925111Sbde		/*
8025111Sbde		 * Start old dinode structure, expanded for binary
8156581Sbde		 * compatibility with UFS1.
8256581Sbde		 */
8356581Sbde		u_int16_t c_mode;	    /* file mode */
8456581Sbde		int16_t	c_spare1[3];	    /* old nlink, ids */
8556581Sbde		u_int64_t c_size;	    /* file byte count */
8656581Sbde		int32_t	c_old_atime;	    /* old last access time, seconds */
8756581Sbde		int32_t	c_atimensec;	    /* last access time, nanoseconds */
8823571Sbde		int32_t	c_old_mtime;	    /* old last modified time, secs */
8956581Sbde		int32_t	c_mtimensec;	    /* last modified time, nanosecs */
9025111Sbde		int32_t	c_spare2[2];	    /* old ctime */
9123571Sbde		int32_t	c_rdev;		    /* for devices, device number */
9223571Sbde		int32_t	c_birthtimensec;    /* creation time, nanosecs */
93229367Sed		int64_t	c_birthtime;	    /* creation time, seconds */
94229562Sed		int64_t	c_atime;	    /* last access time, seconds */
95229562Sed		int64_t	c_mtime;	    /* last modified time, seconds */
96229562Sed		int32_t	c_extsize;	    /* external attribute size */
97229562Sed		int32_t	c_spare4[6];	    /* old block pointers */
98229562Sed		u_int32_t c_file_flags;	    /* status flags (chflags) */
99229562Sed		int32_t	c_spare5[2];	    /* old blocks, generation number */
100229562Sed		u_int32_t c_uid;	    /* file owner */
101229367Sed		u_int32_t c_gid;	    /* file group */
102229367Sed		int32_t	c_spare6[2];	    /* previously unused spares */
103229367Sed		/*
104229367Sed		 * End old dinode structure.
105229367Sed		 */
106229367Sed		int32_t	c_count;	    /* number of valid c_addr entries */
10725111Sbde		char	c_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */
10823571Sbde		char	c_label[LBLSIZE];   /* dump label */
10992998Sobrien		int32_t	c_level;	    /* level of this dump */
11092998Sobrien		char	c_filesys[NAMELEN]; /* name of dumpped file system */
11192998Sobrien		char	c_dev[NAMELEN];	    /* name of dumpped device */
11292998Sobrien		char	c_host[NAMELEN];    /* name of dumpped host */
11392998Sobrien		int32_t	c_flags;	    /* additional information */
11492998Sobrien		int32_t	c_old_firstrec;	    /* first record on volume */
11592998Sobrien		int64_t	c_date;		    /* date of this dump */
11625111Sbde		int64_t	c_ddate;	    /* date of previous dump */
117		int64_t	c_tapea;	    /* logical block of this record */
118		int64_t	c_firstrec;	    /* first record on volume */
119		int32_t	c_spare[24];	    /* reserved for future uses */
120	} s_spcl;
121} u_spcl;
122#define spcl u_spcl.s_spcl
123/*
124 * special record types
125 */
126#define TS_TAPE 	1	/* dump tape header */
127#define TS_INODE	2	/* beginning of file record */
128#define TS_ADDR 	4	/* continuation of file record */
129#define TS_BITS 	3	/* map of inodes on tape */
130#define TS_CLRI 	6	/* map of inodes deleted since last dump */
131#define TS_END  	5	/* end of volume marker */
132
133#endif /* !_DUMPRESTORE_H_ */
134