Home | History | Annotate | Line # | Download | only in protocols
dumprestore.h revision 1.18.16.1
      1  1.18.16.1    martin /*	$NetBSD: dumprestore.h,v 1.18.16.1 2020/04/08 14:07:11 martin Exp $	*/
      2        1.6       cgd 
      3        1.4       cgd /*
      4        1.5       cgd  * Copyright (c) 1980, 1993
      5        1.5       cgd  *	The Regents of the University of California.  All rights reserved.
      6        1.4       cgd  * (c) UNIX System Laboratories, Inc.
      7        1.4       cgd  * All or some portions of this file are derived from material licensed
      8        1.4       cgd  * to the University of California by American Telephone and Telegraph
      9        1.4       cgd  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
     10        1.4       cgd  * the permission of UNIX System Laboratories, Inc.
     11        1.4       cgd  *
     12        1.4       cgd  * Redistribution and use in source and binary forms, with or without
     13        1.4       cgd  * modification, are permitted provided that the following conditions
     14        1.4       cgd  * are met:
     15        1.4       cgd  * 1. Redistributions of source code must retain the above copyright
     16        1.4       cgd  *    notice, this list of conditions and the following disclaimer.
     17        1.4       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     18        1.4       cgd  *    notice, this list of conditions and the following disclaimer in the
     19        1.4       cgd  *    documentation and/or other materials provided with the distribution.
     20       1.12       agc  * 3. Neither the name of the University nor the names of its contributors
     21        1.4       cgd  *    may be used to endorse or promote products derived from this software
     22        1.4       cgd  *    without specific prior written permission.
     23        1.4       cgd  *
     24        1.4       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25        1.4       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26        1.4       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27        1.4       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28        1.4       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29        1.4       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30        1.4       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31        1.4       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32        1.4       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33        1.4       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34        1.4       cgd  * SUCH DAMAGE.
     35        1.4       cgd  *
     36        1.6       cgd  *	@(#)dumprestore.h	8.2 (Berkeley) 1/21/94
     37        1.4       cgd  */
     38        1.4       cgd 
     39        1.8     perry #ifndef _PROTOCOLS_DUMPRESTORE_H_
     40        1.8     perry #define _PROTOCOLS_DUMPRESTORE_H_
     41        1.4       cgd 
     42       1.18  dholland #include <stdint.h>
     43       1.18  dholland #include <ufs/ufs/dinode.h>
     44       1.18  dholland 
     45        1.4       cgd /*
     46        1.4       cgd  * TP_BSIZE is the size of file blocks on the dump tapes.
     47        1.4       cgd  * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
     48        1.4       cgd  *
     49        1.4       cgd  * NTREC is the number of TP_BSIZE blocks that are written
     50        1.4       cgd  * in each tape record. HIGHDENSITYTREC is the number of
     51        1.4       cgd  * TP_BSIZE blocks that are written in each tape record on
     52        1.4       cgd  * 6250 BPI or higher density tapes.
     53        1.4       cgd  *
     54        1.4       cgd  * TP_NINDIR is the number of indirect pointers in a TS_INODE
     55        1.4       cgd  * or TS_ADDR record. Note that it must be a power of two.
     56        1.4       cgd  */
     57        1.4       cgd #define TP_BSIZE	1024
     58        1.4       cgd #define NTREC   	10
     59        1.4       cgd #define HIGHDENSITYTREC	32
     60        1.4       cgd #define TP_NINDIR	(TP_BSIZE/2)
     61        1.4       cgd #define LBLSIZE		16
     62        1.4       cgd #define NAMELEN		64
     63        1.4       cgd 
     64        1.4       cgd #define OFS_MAGIC   	(int)60011
     65        1.4       cgd #define NFS_MAGIC   	(int)60012
     66       1.11      fvdl #ifndef FS_UFS2_MAGIC
     67       1.11      fvdl #define FS_UFS2_MAGIC   (int)0x19540119
     68       1.11      fvdl #endif
     69        1.4       cgd #define CHECKSUM	(int)84446
     70        1.4       cgd 
     71  1.18.16.1    martin extern union u_spcl {
     72        1.4       cgd 	char dummy[TP_BSIZE];
     73        1.4       cgd 	struct	s_spcl {
     74        1.7       cgd 		int32_t	c_type;		    /* record type (see below) */
     75       1.11      fvdl 		int32_t	c_old_date;	    /* date of this dump */
     76       1.11      fvdl 		int32_t	c_old_ddate;	    /* date of previous dump */
     77        1.7       cgd 		int32_t	c_volume;	    /* dump volume number */
     78       1.11      fvdl 		int32_t	c_old_tapea;	    /* logical block of this record */
     79       1.14     perry 		uint32_t c_inumber;	    /* number of inode */
     80        1.7       cgd 		int32_t	c_magic;	    /* magic number (see above) */
     81        1.7       cgd 		int32_t	c_checksum;	    /* record checksum */
     82       1.11      fvdl 		union {
     83       1.11      fvdl 			struct ufs1_dinode __uc_dinode;
     84       1.11      fvdl 			struct {
     85       1.14     perry 				uint16_t __uc_mode;
     86       1.11      fvdl 				int16_t __uc_spare1[3];
     87       1.14     perry 				uint64_t __uc_size;
     88       1.11      fvdl 				int32_t __uc_old_atime;
     89       1.11      fvdl 				int32_t __uc_atimensec;
     90       1.11      fvdl 				int32_t __uc_old_mtime;
     91       1.11      fvdl 				int32_t __uc_mtimensec;
     92       1.11      fvdl 				int32_t __uc_spare2[2];
     93       1.11      fvdl 				int32_t __uc_rdev;
     94       1.11      fvdl 				int32_t __uc_birthtimensec;
     95       1.11      fvdl 				int64_t __uc_birthtime;
     96       1.11      fvdl 				int64_t __uc_atime;
     97       1.11      fvdl 				int64_t __uc_mtime;
     98       1.11      fvdl 				int32_t __uc_spare4[7];
     99       1.14     perry 				uint32_t __uc_file_flags;
    100       1.11      fvdl 				int32_t __uc_spare5[2];
    101       1.14     perry 				uint32_t __uc_uid;
    102       1.14     perry 				uint32_t __uc_gid;
    103       1.11      fvdl 				int32_t __uc_spare6[2];
    104       1.11      fvdl 			} __uc_ino;
    105       1.11      fvdl 		} __c_ino;
    106        1.7       cgd 		int32_t	c_count;	    /* number of valid c_addr entries */
    107        1.4       cgd 		char	c_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */
    108        1.4       cgd 		char	c_label[LBLSIZE];   /* dump label */
    109        1.7       cgd 		int32_t	c_level;	    /* level of this dump */
    110        1.4       cgd 		char	c_filesys[NAMELEN]; /* name of dumpped file system */
    111        1.4       cgd 		char	c_dev[NAMELEN];	    /* name of dumpped device */
    112        1.4       cgd 		char	c_host[NAMELEN];    /* name of dumpped host */
    113        1.7       cgd 		int32_t	c_flags;	    /* additional information */
    114       1.11      fvdl 		int32_t	c_old_firstrec;	    /* first record on volume */
    115       1.11      fvdl 		int64_t c_date;		    /* date of this dump */
    116       1.11      fvdl 		int64_t c_ddate;	    /* date of previous dump */
    117       1.11      fvdl 		int64_t c_tapea;	    /* logical block of this record */
    118       1.11      fvdl 		int64_t c_firstrec;	    /* first record on volume */
    119       1.11      fvdl 		int32_t	c_spare[24];	    /* reserved for future uses */
    120        1.4       cgd 	} s_spcl;
    121        1.4       cgd } u_spcl;
    122        1.4       cgd #define spcl u_spcl.s_spcl
    123       1.11      fvdl 
    124       1.11      fvdl #define c_dinode	__c_ino.__uc_dinode
    125       1.11      fvdl #define c_mode		__c_ino.__uc_ino.__uc_mode
    126       1.11      fvdl #define c_spare1	__c_ino.__uc_ino.__uc_spare1
    127       1.11      fvdl #define c_size		__c_ino.__uc_ino.__uc_size
    128       1.11      fvdl #define c_old_atime	__c_ino.__uc_ino.__uc_old_atime
    129       1.11      fvdl #define c_atime		__c_ino.__uc_ino.__uc_atime
    130       1.11      fvdl #define c_atimensec	__c_ino.__uc_ino.__uc_atimensec
    131       1.11      fvdl #define c_mtime		__c_ino.__uc_ino.__uc_mtime
    132       1.11      fvdl #define c_mtimensec	__c_ino.__uc_ino.__uc_mtimensec
    133       1.11      fvdl #define c_birthtime	__c_ino.__uc_ino.__uc_birthtime
    134       1.11      fvdl #define c_birthtimensec	__c_ino.__uc_ino.__uc_birthtimensec
    135       1.11      fvdl #define c_old_mtime	__c_ino.__uc_ino.__uc_old_mtime
    136       1.11      fvdl #define c_rdev		__c_ino.__uc_ino.__uc_rdev
    137       1.11      fvdl #define c_file_flags	__c_ino.__uc_ino.__uc_file_flags
    138       1.11      fvdl #define c_uid		__c_ino.__uc_ino.__uc_uid
    139       1.11      fvdl #define c_gid		__c_ino.__uc_ino.__uc_gid
    140       1.11      fvdl 
    141        1.4       cgd /*
    142        1.4       cgd  * special record types
    143        1.4       cgd  */
    144        1.4       cgd #define TS_TAPE 	1	/* dump tape header */
    145        1.4       cgd #define TS_INODE	2	/* beginning of file record */
    146        1.4       cgd #define TS_ADDR 	4	/* continuation of file record */
    147        1.4       cgd #define TS_BITS 	3	/* map of inodes on tape */
    148        1.4       cgd #define TS_CLRI 	6	/* map of inodes deleted since last dump */
    149        1.4       cgd #define TS_END  	5	/* end of volume marker */
    150        1.4       cgd 
    151        1.4       cgd /*
    152        1.4       cgd  * flag values
    153        1.4       cgd  */
    154        1.4       cgd #define DR_NEWHEADER	0x0001	/* new format tape header */
    155        1.4       cgd #define DR_NEWINODEFMT	0x0002	/* new format inodes on tape */
    156       1.15   hannken #define DR_EXTATTRIBUTES 0x8000	/* linux: extended attributes */
    157        1.4       cgd 
    158       1.17  christos /* 511 == NAME_MAX */
    159       1.17  christos #define	DUMPOUTFMT	"%-511s %c %s"		/* for printf */
    160        1.4       cgd 						/* name, level, ctime(date) */
    161       1.17  christos #define	DUMPINFMT	"%511s %c %[^\n]\n"	/* inverse for scanf */
    162        1.4       cgd 
    163        1.8     perry #endif /* !_PROTOCOLS_DUMPRESTORE_H_ */
    164