home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / archives.h next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  4.0 KB  |  149 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. /*    Portions Copyright (c) 1988, Sun Microsystems, Inc.    */
  11. /*    All Rights Reserved.                    */
  12.  
  13. #ident    "@(#)/usr/include/archives.h.sl 1.1 4.0 12/08/90 23719 AT&T-USL"
  14.  
  15. #include <tar.h>
  16.  
  17. /* Magic numbers */
  18.  
  19. #define CMN_ASC    0x070701    /* Cpio Magic Number for ASCii header */
  20. #define CMN_BIN    070707        /* Cpio Magic Number for Binary header */
  21. #define CMN_BBS    0143561        /* Cpio Magic Number for Byte-Swap header */
  22. #define CMN_CRC    0x070702    /* Cpio Magic Number for CRC header */
  23. #define CMS_ASC    "070701"    /* Cpio Magic String for ASCii header */
  24. #define CMS_CHR    "070707"    /* Cpio Magic String for CHR (-c) header */
  25. #define CMS_CRC    "070702"    /* Cpio Magic String for CRC header */
  26. #define CMS_LEN    6        /* Cpio Magic String LENgth */
  27.  
  28. /* Various header and field lengths */
  29.  
  30. #define CHRSZ    76        /* -c hdr size minus filename field */
  31. #define ASCSZ    110        /* ASC and CRC hdr size minus filename field */
  32. #define TARSZ    512        /* TAR hdr size */
  33.  
  34. #define HNAMLEN    256    /* maximum filename length for binary and -c headers */
  35. #define EXPNLEN    1024    /* maximum filename length for ASC and CRC headers */
  36. #define HTIMLEN    2    /* length of modification time field */
  37. #define HSIZLEN    2    /* length of file size field */
  38.  
  39. /* cpio binary header definition */
  40.  
  41. struct hdr_cpio {
  42.     short    h_magic,        /* magic number field */
  43.         h_dev;            /* file system of file */
  44.     ushort    h_ino,            /* inode of file */
  45.         h_mode,            /* modes of file */
  46.         h_uid,            /* uid of file */
  47.         h_gid;            /* gid of file */
  48.     short    h_nlink,        /* number of links to file */
  49.         h_rdev,            /* maj/min numbers for special files */
  50.         h_mtime[HTIMLEN],    /* modification time of file */
  51.         h_namesize,        /* length of filename */
  52.         h_filesize[HSIZLEN];    /* size of file */
  53.     char    h_name[HNAMLEN];    /* filename */
  54. } ;
  55.  
  56. /* cpio ODC header format */
  57.  
  58. struct c_hdr {
  59.     char    c_magic[CMS_LEN],
  60.         c_dev[6],
  61.         c_ino[6],
  62.         c_mode[6],
  63.         c_uid[6],
  64.         c_gid[6],
  65.         c_nlink[6],
  66.         c_rdev[6],
  67.         c_mtime[11],
  68.         c_namesz[6],
  69.         c_filesz[11],
  70.         c_name[HNAMLEN];
  71. } ;
  72.  
  73. /* -c and CRC header format */
  74.  
  75. struct Exp_cpio_hdr {
  76.     char    E_magic[CMS_LEN],
  77.         E_ino[8],
  78.         E_mode[8],
  79.         E_uid[8],
  80.         E_gid[8],
  81.         E_nlink[8],
  82.         E_mtime[8],
  83.         E_filesize[8],
  84.         E_maj[8],
  85.         E_min[8],
  86.         E_rmaj[8],
  87.         E_rmin[8],
  88.         E_namesize[8],
  89.         E_chksum[8],
  90.         E_name[EXPNLEN];
  91. } ;
  92.  
  93. /* Tar header structure and format */
  94.  
  95. #define TBLOCK    512    /* length of tar header and data blocks */
  96. #define    TNAMLEN    100    /* maximum length for tar file names */
  97. #define TMODLEN    8    /* length of mode field */
  98. #define TUIDLEN    8    /* length of uid field */
  99. #define TGIDLEN    8    /* length of gid field */
  100. #define TSIZLEN    12    /* length of size field */
  101. #define TTIMLEN    12    /* length of modification time field */
  102. #define TCRCLEN    8    /* length of header checksum field */
  103.  
  104. /* tar header definition */
  105.  
  106. union tblock {
  107.     char dummy[TBLOCK];
  108.     struct tar_hdr {
  109.         char    t_name[TNAMLEN],    /* name of file */
  110.             t_mode[TMODLEN],    /* mode of file */
  111.             t_uid[TUIDLEN],        /* uid of file */
  112.             t_gid[TGIDLEN],        /* gid of file */
  113.             t_size[TSIZLEN],    /* size of file in bytes */
  114.             t_mtime[TTIMLEN],    /* modification time of file */
  115.             t_cksum[TCRCLEN],    /* checksum of header */
  116.             t_typeflag,
  117.             t_linkname[TNAMLEN],    /* file this file linked with */
  118.             t_magic[TMAGLEN],
  119.             t_version[TVERSLEN],
  120.             t_uname[32],
  121.             t_gname[32],
  122.             t_devmajor[8],
  123.             t_devminor[8],
  124.             t_prefix[155];
  125.     } tbuf;
  126. } ;
  127.  
  128. /* volcopy tape label format and structure */
  129.  
  130. #define VMAGLEN 8
  131. #define VVOLLEN 6
  132. #define VFILLEN 464
  133.  
  134. struct volcopy_label {
  135.     char    v_magic[VMAGLEN],
  136.         v_volume[VVOLLEN],
  137.         v_reels,
  138.         v_reel;
  139.     long    v_time,
  140.                 v_length,
  141.         v_dens,
  142.         v_reelblks,    /* u370 added field */
  143.         v_blksize,    /* u370 added field */
  144.         v_nblocks;    /* u370 added field */
  145.     char    v_fill[VFILLEN];
  146.     long    v_offset;    /* used with -e and -reel options */
  147.     int    v_type;        /* does tape have nblocks field? */
  148. } ;
  149.