12321c474SPedro F. Giffuni /*- 22321c474SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 32321c474SPedro F. Giffuni * 459deaec5SRodney W. Grimes * Copyright (c) 1980, 1993 559deaec5SRodney W. Grimes * The Regents of the University of California. All rights reserved. 659deaec5SRodney W. Grimes * (c) UNIX System Laboratories, Inc. 759deaec5SRodney W. Grimes * All or some portions of this file are derived from material licensed 859deaec5SRodney W. Grimes * to the University of California by American Telephone and Telegraph 959deaec5SRodney W. Grimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 1059deaec5SRodney W. Grimes * the permission of UNIX System Laboratories, Inc. 1159deaec5SRodney W. Grimes * 1259deaec5SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 1359deaec5SRodney W. Grimes * modification, are permitted provided that the following conditions 1459deaec5SRodney W. Grimes * are met: 1559deaec5SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 1659deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 1759deaec5SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 1859deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 1959deaec5SRodney W. Grimes * documentation and/or other materials provided with the distribution. 202cca9f8fSWarner Losh * 3. Neither the name of the University nor the names of its contributors 2159deaec5SRodney W. Grimes * may be used to endorse or promote products derived from this software 2259deaec5SRodney W. Grimes * without specific prior written permission. 2359deaec5SRodney W. Grimes * 2459deaec5SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2559deaec5SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2659deaec5SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2759deaec5SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2859deaec5SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2959deaec5SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3059deaec5SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3159deaec5SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3259deaec5SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3359deaec5SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3459deaec5SRodney W. Grimes * SUCH DAMAGE. 3559deaec5SRodney W. Grimes */ 3659deaec5SRodney W. Grimes 37385e380aSPaul Richards #ifndef _PROTOCOLS_DUMPRESTORE_H_ 38385e380aSPaul Richards #define _PROTOCOLS_DUMPRESTORE_H_ 3959deaec5SRodney W. Grimes 4059deaec5SRodney W. Grimes /* 4159deaec5SRodney W. Grimes * TP_BSIZE is the size of file blocks on the dump tapes. 4259deaec5SRodney W. Grimes * Note that TP_BSIZE must be a multiple of DEV_BSIZE. 4359deaec5SRodney W. Grimes * 4459deaec5SRodney W. Grimes * NTREC is the number of TP_BSIZE blocks that are written 4559deaec5SRodney W. Grimes * in each tape record. HIGHDENSITYTREC is the number of 4659deaec5SRodney W. Grimes * TP_BSIZE blocks that are written in each tape record on 4759deaec5SRodney W. Grimes * 6250 BPI or higher density tapes. 4859deaec5SRodney W. Grimes * 4959deaec5SRodney W. Grimes * TP_NINDIR is the number of indirect pointers in a TS_INODE 5059deaec5SRodney W. Grimes * or TS_ADDR record. Note that it must be a power of two. 5159deaec5SRodney W. Grimes */ 5259deaec5SRodney W. Grimes #define TP_BSIZE 1024 5359deaec5SRodney W. Grimes #define NTREC 10 5459deaec5SRodney W. Grimes #define HIGHDENSITYTREC 32 5559deaec5SRodney W. Grimes #define TP_NINDIR (TP_BSIZE/2) 5659deaec5SRodney W. Grimes #define LBLSIZE 16 5759deaec5SRodney W. Grimes #define NAMELEN 64 5859deaec5SRodney W. Grimes 5959deaec5SRodney W. Grimes #define OFS_MAGIC (int)60011 6059deaec5SRodney W. Grimes #define NFS_MAGIC (int)60012 611c85e6a3SKirk McKusick #ifndef FS_UFS2_MAGIC 621c85e6a3SKirk McKusick #define FS_UFS2_MAGIC (int)0x19540119 631c85e6a3SKirk McKusick #endif 6459deaec5SRodney W. Grimes #define CHECKSUM (int)84446 6559deaec5SRodney W. Grimes 66788cefe2SGleb Kurtsou /* 67788cefe2SGleb Kurtsou * Since ino_t size is changing to 64-bits, yet we desire this structure to 68788cefe2SGleb Kurtsou * remain compatible with exiting dump formats, we do NOT use ino_t here, 69788cefe2SGleb Kurtsou * but rather define a 32-bit type in its place. At some point, it may be 70788cefe2SGleb Kurtsou * necessary to use some of the c_spare[] in order to fully support 64-bit 71788cefe2SGleb Kurtsou * inode numbers. 72788cefe2SGleb Kurtsou */ 73788cefe2SGleb Kurtsou typedef uint32_t dump_ino_t; 74788cefe2SGleb Kurtsou 7533ceb489SKirk McKusick extern union u_spcl { 7659deaec5SRodney W. Grimes char dummy[TP_BSIZE]; 7759deaec5SRodney W. Grimes struct s_spcl { 7897b465b1SDima Ruban int32_t c_type; /* record type (see below) */ 791c85e6a3SKirk McKusick int32_t c_old_date; /* date of this dump */ 801c85e6a3SKirk McKusick int32_t c_old_ddate; /* date of previous dump */ 8197b465b1SDima Ruban int32_t c_volume; /* dump volume number */ 821c85e6a3SKirk McKusick int32_t c_old_tapea; /* logical block of this record */ 83788cefe2SGleb Kurtsou dump_ino_t c_inumber; /* number of inode */ 8497b465b1SDima Ruban int32_t c_magic; /* magic number (see above) */ 8597b465b1SDima Ruban int32_t c_checksum; /* record checksum */ 861c85e6a3SKirk McKusick /* 871c85e6a3SKirk McKusick * Start old dinode structure, expanded for binary 881c85e6a3SKirk McKusick * compatibility with UFS1. 891c85e6a3SKirk McKusick */ 901c85e6a3SKirk McKusick u_int16_t c_mode; /* file mode */ 911c85e6a3SKirk McKusick int16_t c_spare1[3]; /* old nlink, ids */ 921c85e6a3SKirk McKusick u_int64_t c_size; /* file byte count */ 931c85e6a3SKirk McKusick int32_t c_old_atime; /* old last access time, seconds */ 941c85e6a3SKirk McKusick int32_t c_atimensec; /* last access time, nanoseconds */ 951c85e6a3SKirk McKusick int32_t c_old_mtime; /* old last modified time, secs */ 961c85e6a3SKirk McKusick int32_t c_mtimensec; /* last modified time, nanosecs */ 971c85e6a3SKirk McKusick int32_t c_spare2[2]; /* old ctime */ 981c85e6a3SKirk McKusick int32_t c_rdev; /* for devices, device number */ 99fb36a3d8SKirk McKusick int32_t c_birthtimensec; /* creation time, nanosecs */ 100fb36a3d8SKirk McKusick int64_t c_birthtime; /* creation time, seconds */ 1011c85e6a3SKirk McKusick int64_t c_atime; /* last access time, seconds */ 1021c85e6a3SKirk McKusick int64_t c_mtime; /* last modified time, seconds */ 103772ad651SKirk McKusick int32_t c_extsize; /* external attribute size */ 104772ad651SKirk McKusick int32_t c_spare4[6]; /* old block pointers */ 1051c85e6a3SKirk McKusick u_int32_t c_file_flags; /* status flags (chflags) */ 1061c85e6a3SKirk McKusick int32_t c_spare5[2]; /* old blocks, generation number */ 1071c85e6a3SKirk McKusick u_int32_t c_uid; /* file owner */ 1081c85e6a3SKirk McKusick u_int32_t c_gid; /* file group */ 1091c85e6a3SKirk McKusick int32_t c_spare6[2]; /* previously unused spares */ 1101c85e6a3SKirk McKusick /* 1111c85e6a3SKirk McKusick * End old dinode structure. 1121c85e6a3SKirk McKusick */ 11397b465b1SDima Ruban int32_t c_count; /* number of valid c_addr entries */ 11459deaec5SRodney W. Grimes char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */ 11559deaec5SRodney W. Grimes char c_label[LBLSIZE]; /* dump label */ 11697b465b1SDima Ruban int32_t c_level; /* level of this dump */ 117*8f87d402SGordon Bergling char c_filesys[NAMELEN]; /* name of dumped file system */ 118*8f87d402SGordon Bergling char c_dev[NAMELEN]; /* name of dumped device */ 119*8f87d402SGordon Bergling char c_host[NAMELEN]; /* name of dumped host */ 12097b465b1SDima Ruban int32_t c_flags; /* additional information */ 1211c85e6a3SKirk McKusick int32_t c_old_firstrec; /* first record on volume */ 1221c85e6a3SKirk McKusick int64_t c_date; /* date of this dump */ 1231c85e6a3SKirk McKusick int64_t c_ddate; /* date of previous dump */ 1241c85e6a3SKirk McKusick int64_t c_tapea; /* logical block of this record */ 1251c85e6a3SKirk McKusick int64_t c_firstrec; /* first record on volume */ 1261c85e6a3SKirk McKusick int32_t c_spare[24]; /* reserved for future uses */ 12759deaec5SRodney W. Grimes } s_spcl; 12859deaec5SRodney W. Grimes } u_spcl; 12959deaec5SRodney W. Grimes #define spcl u_spcl.s_spcl 13059deaec5SRodney W. Grimes /* 13159deaec5SRodney W. Grimes * special record types 13259deaec5SRodney W. Grimes */ 13359deaec5SRodney W. Grimes #define TS_TAPE 1 /* dump tape header */ 13459deaec5SRodney W. Grimes #define TS_INODE 2 /* beginning of file record */ 13559deaec5SRodney W. Grimes #define TS_ADDR 4 /* continuation of file record */ 13659deaec5SRodney W. Grimes #define TS_BITS 3 /* map of inodes on tape */ 13759deaec5SRodney W. Grimes #define TS_CLRI 6 /* map of inodes deleted since last dump */ 13859deaec5SRodney W. Grimes #define TS_END 5 /* end of volume marker */ 13959deaec5SRodney W. Grimes 14059deaec5SRodney W. Grimes #endif /* !_DUMPRESTORE_H_ */ 141