home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / protocols / dumprestore.h next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  5.4 KB  |  134 lines

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