check for sizeof(buf) so strcpy doesn't trash stack.
[unix-history] / usr / src / include / protocols / dumprestore.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 * @(#)dumprestore.h 5.8 (Berkeley) %G%
8 */
9
10#ifndef _DUMPRESTORE_H_
11#define _DUMPRESTORE_H_
12
13/*
14 * TP_BSIZE is the size of file blocks on the dump tapes.
15 * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
16 *
17 * NTREC is the number of TP_BSIZE blocks that are written
18 * in each tape record. HIGHDENSITYTREC is the number of
19 * TP_BSIZE blocks that are written in each tape record on
20 * 6250 BPI or higher density tapes.
21 *
22 * TP_NINDIR is the number of indirect pointers in a TS_INODE
23 * or TS_ADDR record. Note that it must be a power of two.
24 */
25#define TP_BSIZE 1024
26#define NTREC 10
27#define HIGHDENSITYTREC 32
28#define TP_NINDIR (TP_BSIZE/2)
29#define LBLSIZE 16
30#define NAMELEN 64
31
32#define OFS_MAGIC (int)60011
33#define NFS_MAGIC (int)60012
34#define CHECKSUM (int)84446
35
36union u_spcl {
37 char dummy[TP_BSIZE];
38 struct s_spcl {
39 long c_type; /* record type (see below) */
40 time_t c_date; /* date of previous dump */
41 time_t c_ddate; /* date of this dump */
42 long c_volume; /* dump volume number */
43 daddr_t c_tapea; /* logical block of this record */
44 ino_t c_inumber; /* number of inode */
45 long c_magic; /* magic number (see above) */
46 long c_checksum; /* record checksum */
47 struct dinode c_dinode; /* ownership and mode of inode */
48 long c_count; /* number of valid c_addr entries */
49 char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
50 char c_label[LBLSIZE]; /* dump label */
51 long c_level; /* level of this dump */
52 char c_filesys[NAMELEN]; /* name of dumpped file system */
53 char c_dev[NAMELEN]; /* name of dumpped device */
54 char c_host[NAMELEN]; /* name of dumpped host */
55 long c_flags; /* additional information */
56 long c_firstrec; /* first record on volume */
57 long c_spare[32]; /* reserved for future uses */
58 } s_spcl;
59} u_spcl;
60#define spcl u_spcl.s_spcl
61/*
62 * special record types
63 */
64#define TS_TAPE 1 /* dump tape header */
65#define TS_INODE 2 /* beginning of file record */
66#define TS_ADDR 4 /* continuation of file record */
67#define TS_BITS 3 /* map of inodes on tape */
68#define TS_CLRI 6 /* map of inodes deleted since last dump */
69#define TS_END 5 /* end of volume marker */
70
71/*
72 * flag values
73 */
74#define DR_NEWHEADER 0x0001 /* new format tape header */
75#define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
76
77#define DUMPOUTFMT "%-16s %c %s" /* for printf */
78 /* name, level, ctime(date) */
79#define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */
80
81#endif /* !_DUMPRESTORE_H_ */