dumprestore.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*-
  2. * SPDX-License-Identifier: BSD-3-Clause
  3. *
  4. * Copyright (c) 1980, 1993
  5. * The Regents of the University of California. All rights reserved.
  6. * (c) UNIX System Laboratories, Inc.
  7. * All or some portions of this file are derived from material licensed
  8. * to the University of California by American Telephone and Telegraph
  9. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  10. * the permission of UNIX System Laboratories, Inc.
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. * 3. Neither the name of the University nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34. * SUCH DAMAGE.
  35. */
  36. #ifndef _PROTOCOLS_DUMPRESTORE_H_
  37. #define _PROTOCOLS_DUMPRESTORE_H_
  38. /*
  39. * TP_BSIZE is the size of file blocks on the dump tapes.
  40. * Note that TP_BSIZE must be a multiple of DEV_BSIZE.
  41. *
  42. * NTREC is the number of TP_BSIZE blocks that are written
  43. * in each tape record. HIGHDENSITYTREC is the number of
  44. * TP_BSIZE blocks that are written in each tape record on
  45. * 6250 BPI or higher density tapes.
  46. *
  47. * TP_NINDIR is the number of indirect pointers in a TS_INODE
  48. * or TS_ADDR record. Note that it must be a power of two.
  49. */
  50. #define TP_BSIZE 1024
  51. #define NTREC 10
  52. #define HIGHDENSITYTREC 32
  53. #define TP_NINDIR (TP_BSIZE/2)
  54. #define LBLSIZE 16
  55. #define NAMELEN 64
  56. #define OFS_MAGIC (int)60011
  57. #define NFS_MAGIC (int)60012
  58. #ifndef FS_UFS2_MAGIC
  59. #define FS_UFS2_MAGIC (int)0x19540119
  60. #endif
  61. #define CHECKSUM (int)84446
  62. /*
  63. * Since ino_t size is changing to 64-bits, yet we desire this structure to
  64. * remain compatible with exiting dump formats, we do NOT use ino_t here,
  65. * but rather define a 32-bit type in its place. At some point, it may be
  66. * necessary to use some of the c_spare[] in order to fully support 64-bit
  67. * inode numbers.
  68. */
  69. typedef uint32_t dump_ino_t;
  70. extern union u_spcl {
  71. char dummy[TP_BSIZE];
  72. struct s_spcl {
  73. int32_t c_type; /* record type (see below) */
  74. int32_t c_old_date; /* date of this dump */
  75. int32_t c_old_ddate; /* date of previous dump */
  76. int32_t c_volume; /* dump volume number */
  77. int32_t c_old_tapea; /* logical block of this record */
  78. dump_ino_t c_inumber; /* number of inode */
  79. int32_t c_magic; /* magic number (see above) */
  80. int32_t c_checksum; /* record checksum */
  81. /*
  82. * Start old dinode structure, expanded for binary
  83. * compatibility with UFS1.
  84. */
  85. u_int16_t c_mode; /* file mode */
  86. int16_t c_spare1[3]; /* old nlink, ids */
  87. u_int64_t c_size; /* file byte count */
  88. int32_t c_old_atime; /* old last access time, seconds */
  89. int32_t c_atimensec; /* last access time, nanoseconds */
  90. int32_t c_old_mtime; /* old last modified time, secs */
  91. int32_t c_mtimensec; /* last modified time, nanosecs */
  92. int32_t c_spare2[2]; /* old ctime */
  93. int32_t c_rdev; /* for devices, device number */
  94. int32_t c_birthtimensec; /* creation time, nanosecs */
  95. int64_t c_birthtime; /* creation time, seconds */
  96. int64_t c_atime; /* last access time, seconds */
  97. int64_t c_mtime; /* last modified time, seconds */
  98. int32_t c_extsize; /* external attribute size */
  99. int32_t c_spare4[6]; /* old block pointers */
  100. u_int32_t c_file_flags; /* status flags (chflags) */
  101. int32_t c_spare5[2]; /* old blocks, generation number */
  102. u_int32_t c_uid; /* file owner */
  103. u_int32_t c_gid; /* file group */
  104. int32_t c_spare6[2]; /* previously unused spares */
  105. /*
  106. * End old dinode structure.
  107. */
  108. int32_t c_count; /* number of valid c_addr entries */
  109. char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
  110. char c_label[LBLSIZE]; /* dump label */
  111. int32_t c_level; /* level of this dump */
  112. char c_filesys[NAMELEN]; /* name of dumped file system */
  113. char c_dev[NAMELEN]; /* name of dumped device */
  114. char c_host[NAMELEN]; /* name of dumped host */
  115. int32_t c_flags; /* additional information */
  116. int32_t c_old_firstrec; /* first record on volume */
  117. int64_t c_date; /* date of this dump */
  118. int64_t c_ddate; /* date of previous dump */
  119. int64_t c_tapea; /* logical block of this record */
  120. int64_t c_firstrec; /* first record on volume */
  121. int32_t c_spare[24]; /* reserved for future uses */
  122. } s_spcl;
  123. } u_spcl;
  124. #define spcl u_spcl.s_spcl
  125. /*
  126. * special record types
  127. */
  128. #define TS_TAPE 1 /* dump tape header */
  129. #define TS_INODE 2 /* beginning of file record */
  130. #define TS_ADDR 4 /* continuation of file record */
  131. #define TS_BITS 3 /* map of inodes on tape */
  132. #define TS_CLRI 6 /* map of inodes deleted since last dump */
  133. #define TS_END 5 /* end of volume marker */
  134. #endif /* !_DUMPRESTORE_H_ */