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