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