1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate /* Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. */ 28*0Sstevel@tonic-gate /* All rights reserved. */ 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate /* 31*0Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 4.3 BSD 32*0Sstevel@tonic-gate * under license from the Regents of the University of California. 33*0Sstevel@tonic-gate */ 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #ifndef _PROTOCOLS_DUMPRESTORE_H 36*0Sstevel@tonic-gate #define _PROTOCOLS_DUMPRESTORE_H 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate #ifdef __cplusplus 41*0Sstevel@tonic-gate extern "C" { 42*0Sstevel@tonic-gate #endif 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate /* 45*0Sstevel@tonic-gate * This header file defines two different versions of the 46*0Sstevel@tonic-gate * ufsdump/ufsrestore interface. If the defined constant 47*0Sstevel@tonic-gate * SUPPORTS_MTB_TAPE_FORMAT is set, the data structures in 48*0Sstevel@tonic-gate * this header file will support backups of more than 2 terabytes 49*0Sstevel@tonic-gate * of data. 50*0Sstevel@tonic-gate * 51*0Sstevel@tonic-gate * In the old format (the format that only supports dumps 52*0Sstevel@tonic-gate * of less than 2 terabytes), TP_BSIZE is the size of file blocks 53*0Sstevel@tonic-gate * on the dump tapes. 54*0Sstevel@tonic-gate * Note that TP_BSIZE must be a multiple of DEV_BSIZE. 55*0Sstevel@tonic-gate * 56*0Sstevel@tonic-gate * In the new format, tp_bsize is used to store the 57*0Sstevel@tonic-gate * tape block size, which is variable. The tape block size 58*0Sstevel@tonic-gate * is like 'fragsize', in that 'c_tapea' in each tape record 59*0Sstevel@tonic-gate * contains the 'tape block record' number in a signed int. 60*0Sstevel@tonic-gate * We set TP_BSIZE_MAX to 65536, which will handle 128TB 61*0Sstevel@tonic-gate * of data. The new format is indicated by a magic number 62*0Sstevel@tonic-gate * in the tape header of MTB_MAGIC. The new format is only 63*0Sstevel@tonic-gate * used when the size of the backup exceeds 2 TB. If the 64*0Sstevel@tonic-gate * backup can be stored in less thatn 2 TB, ufsdump still 65*0Sstevel@tonic-gate * uses the format indicated by the NFS_MAGIC magic number. 66*0Sstevel@tonic-gate * Therefore, backups of less than 2 TB are still readable 67*0Sstevel@tonic-gate * by earlier versions of ufsrestore. 68*0Sstevel@tonic-gate * 69*0Sstevel@tonic-gate * NTREC is the number of TP_BSIZE blocks that are written 70*0Sstevel@tonic-gate * in each tape record. HIGHDENSITYTREC is the number of 71*0Sstevel@tonic-gate * TP_BSIZE blocks that are written in each tape record on 72*0Sstevel@tonic-gate * 6250 BPI or higher density tapes. CARTRIDGETREC is the 73*0Sstevel@tonic-gate * number of TP_BSIZE (or tp_bsize) blocks that are written 74*0Sstevel@tonic-gate * in each tape record on cartridge tapes. 75*0Sstevel@tonic-gate * 76*0Sstevel@tonic-gate * TP_NINDIR is the number of indirect pointers in a TS_INODE 77*0Sstevel@tonic-gate * or TS_ADDR record. Note that it must be a power of two. 78*0Sstevel@tonic-gate * 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate #define TP_BSIZE_MAX 65536 81*0Sstevel@tonic-gate #define TP_BSIZE_MIN 1024 82*0Sstevel@tonic-gate #define ESIZE_SHIFT_MAX 6 /* shift TP_BSIZE_MIN to TP_BSIZE_MAX */ 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate #ifdef SUPPORTS_MTB_TAPE_FORMAT 85*0Sstevel@tonic-gate #define TP_BUFSIZE TP_BSIZE_MAX 86*0Sstevel@tonic-gate extern int32_t tp_bsize; 87*0Sstevel@tonic-gate #else 88*0Sstevel@tonic-gate #define TP_BSIZE 1024 89*0Sstevel@tonic-gate #define TP_BUFSIZE TP_BSIZE 90*0Sstevel@tonic-gate #endif /* SUPPORTS_MTB_TAPE_FORMAT */ 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define NTREC 10 93*0Sstevel@tonic-gate #define HIGHDENSITYTREC 32 94*0Sstevel@tonic-gate #define CARTRIDGETREC 63 95*0Sstevel@tonic-gate #define TP_NINDIR (TP_BSIZE_MIN/2) 96*0Sstevel@tonic-gate #define TP_NINOS (TP_NINDIR / sizeof (long)) 97*0Sstevel@tonic-gate #define LBLSIZE 16 98*0Sstevel@tonic-gate #define NAMELEN 64 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate #define OFS_MAGIC (int)60011 101*0Sstevel@tonic-gate #define NFS_MAGIC (int)60012 102*0Sstevel@tonic-gate #define MTB_MAGIC (int)60013 103*0Sstevel@tonic-gate #define CHECKSUM (int)84446 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate union u_data { 106*0Sstevel@tonic-gate char s_addrs[TP_NINDIR]; /* 1 => data; 0 => hole in inode */ 107*0Sstevel@tonic-gate int32_t s_inos[TP_NINOS]; /* starting inodes on tape */ 108*0Sstevel@tonic-gate }; 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate union u_shadow { 111*0Sstevel@tonic-gate struct s_nonsh { 112*0Sstevel@tonic-gate int32_t c_level; /* level of this dump */ 113*0Sstevel@tonic-gate char c_filesys[NAMELEN]; /* dumpped file system name */ 114*0Sstevel@tonic-gate char c_dev[NAMELEN]; /* name of dumpped device */ 115*0Sstevel@tonic-gate char c_host[NAMELEN]; /* name of dumpped host */ 116*0Sstevel@tonic-gate } c_nonsh; 117*0Sstevel@tonic-gate char c_shadow[1]; 118*0Sstevel@tonic-gate }; 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate /* if you change anything here, be sure to change normspcl in byteorder.c */ 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate union u_spcl { 123*0Sstevel@tonic-gate char dummy[TP_BUFSIZE]; 124*0Sstevel@tonic-gate struct s_spcl { 125*0Sstevel@tonic-gate int32_t c_type; /* record type (see below) */ 126*0Sstevel@tonic-gate time32_t c_date; /* date of previous dump */ 127*0Sstevel@tonic-gate time32_t c_ddate; /* date of this dump */ 128*0Sstevel@tonic-gate int32_t c_volume; /* dump volume number */ 129*0Sstevel@tonic-gate daddr32_t c_tapea; /* logical block of this record */ 130*0Sstevel@tonic-gate ino32_t c_inumber; /* number of inode */ 131*0Sstevel@tonic-gate int32_t c_magic; /* magic number (see above) */ 132*0Sstevel@tonic-gate int32_t c_checksum; /* record checksum */ 133*0Sstevel@tonic-gate struct dinode c_dinode; /* ownership and mode of inode */ 134*0Sstevel@tonic-gate int32_t c_count; /* number of valid c_addr entries */ 135*0Sstevel@tonic-gate union u_data c_data; /* see union above */ 136*0Sstevel@tonic-gate char c_label[LBLSIZE]; /* dump label */ 137*0Sstevel@tonic-gate union u_shadow c_shadow; /* see union above */ 138*0Sstevel@tonic-gate int32_t c_flags; /* additional information */ 139*0Sstevel@tonic-gate int32_t c_firstrec; /* first record on volume */ 140*0Sstevel@tonic-gate #ifdef SUPPORTS_MTB_TAPE_FORMAT 141*0Sstevel@tonic-gate int32_t c_tpbsize; /* tape block size */ 142*0Sstevel@tonic-gate int32_t c_spare[31]; /* reserved for future uses */ 143*0Sstevel@tonic-gate #else 144*0Sstevel@tonic-gate int32_t c_spare[32]; 145*0Sstevel@tonic-gate #endif /* SUPPORTS_MTB_TAPE_FORMAT */ 146*0Sstevel@tonic-gate } s_spcl; 147*0Sstevel@tonic-gate } u_spcl; 148*0Sstevel@tonic-gate #define spcl u_spcl.s_spcl 149*0Sstevel@tonic-gate #define c_addr c_data.s_addrs 150*0Sstevel@tonic-gate #define c_inos c_data.s_inos 151*0Sstevel@tonic-gate #define c_level c_shadow.c_nonsh.c_level 152*0Sstevel@tonic-gate #define c_filesys c_shadow.c_nonsh.c_filesys 153*0Sstevel@tonic-gate #define c_dev c_shadow.c_nonsh.c_dev 154*0Sstevel@tonic-gate #define c_host c_shadow.c_nonsh.c_host 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate /* 157*0Sstevel@tonic-gate * special record types 158*0Sstevel@tonic-gate */ 159*0Sstevel@tonic-gate #define TS_TAPE 1 /* dump tape header */ 160*0Sstevel@tonic-gate #define TS_INODE 2 /* beginning of file record */ 161*0Sstevel@tonic-gate #define TS_ADDR 4 /* continuation of file record */ 162*0Sstevel@tonic-gate #define TS_BITS 3 /* map of inodes on tape */ 163*0Sstevel@tonic-gate #define TS_CLRI 6 /* map of inodes deleted since last dump */ 164*0Sstevel@tonic-gate #define TS_END 5 /* end of volume marker */ 165*0Sstevel@tonic-gate #define TS_EOM 7 /* floppy EOM - restore compat w/ old dump */ 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate /* 168*0Sstevel@tonic-gate * flag values 169*0Sstevel@tonic-gate */ 170*0Sstevel@tonic-gate #define DR_NEWHEADER 1 /* new format tape header */ 171*0Sstevel@tonic-gate #define DR_INODEINFO 2 /* header contains starting inode info */ 172*0Sstevel@tonic-gate #define DR_REDUMP 4 /* dump contains recopies of active files */ 173*0Sstevel@tonic-gate #define DR_TRUEINC 8 /* dump is a "true incremental" */ 174*0Sstevel@tonic-gate #define DR_HASMETA 16 /* metadata in this header */ 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate #define DUMPOUTFMT "%-32s %c %s" /* for printf */ 179*0Sstevel@tonic-gate /* name, incno, ctime(date) */ 180*0Sstevel@tonic-gate #define DUMPINFMT "%258s %c %128[^\n]\n" /* inverse for scanf */ 181*0Sstevel@tonic-gate 182*0Sstevel@tonic-gate #ifdef __cplusplus 183*0Sstevel@tonic-gate } 184*0Sstevel@tonic-gate #endif 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate #endif /* !_PROTOCOLS_DUMPRESTORE_H */ 187