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