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