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