home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / ftp-102.zip / ftape-1.02 / qic / header.h < prev    next >
C/C++ Source or Header  |  1992-10-12  |  4KB  |  140 lines

  1. /* Header segment definition.
  2.    Copyright (C) 1992 David L. Brown, Jr.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.    
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.    
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; see the file COPYING.  If not, write to
  16.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /*
  19.  * header.h,v 1.3 1992/10/13 01:55:21 dbrown Exp
  20.  *
  21.  * header.h,v
  22.  * Revision 1.3  1992/10/13  01:55:21  dbrown
  23.  * Added FSF copyright.
  24.  *
  25.  * Revision 1.2  1992/03/19  23:00:59  dbrown
  26.  * Now compiles for tape but doesn't do anything.
  27.  *
  28.  */
  29.  
  30. #ifndef _HEADER_H_
  31. #define _HEADER_H_
  32.  
  33. struct failed_log {
  34.   short number;            /* Segment number of failure. */
  35.   short date;
  36. };
  37.  
  38. /* Since the compiler tries to pad longs, this allows us to define a
  39.    long and use it. */
  40.  
  41. typedef unsigned char llong[4];
  42.  
  43. #define LLONG_SET(l,value)                \
  44.       do {                        \
  45.         (l)[0] = (value);                \
  46.         (l)[1] = (value) >> 8;            \
  47.         (l)[2] = (value) >> 16;            \
  48.         (l)[3] = (value) >> 24;            \
  49.       } while(0)
  50. #define LLONG(l) ((l)[0] | ((l)[1] << 8) | ((l)[2] << 16) | ((l)[3] << 24))
  51.  
  52. struct qic_header_segment {
  53.   char signature[4];        /* Signature. */
  54.   char format_code;        /* Type of format. */
  55.   char unused_1;
  56.   short header;            /* Segment number of header. */
  57.   short alt_header;        /* Segment humber of duplicate header. */
  58.   short data_first;        /* First logical area data segment. */
  59.   short data_last;        /* Last logical area data segment. */
  60.   llong format_time;        /* Time of last format (seconds). */
  61.   llong write_time;        /* Time of last format or write. */
  62.   short unused_2;
  63.   short segments_per_track;
  64.   char tracks_per_cartridge;
  65.   char maximum_floppy_side;
  66.   char maximum_floppy_track;
  67.   char maximum_floppy_sector;
  68.   char tape_name[8];
  69.   char unused_6[36];
  70.   llong tape_name_time;        /* Time tape name was written
  71.                    (seconds). */
  72.   short compression_map;    /* Segment of compression map segment. */
  73.   char unused_3[48];
  74.   char format_error;
  75.   char unused_7;
  76.   llong segments_used;        /* Number of segments written,
  77.                    formatted or verified throughout
  78.                    the life of tape. */
  79.   llong unused_4;
  80.   llong initial_format_time;    /* Time of initial tape format. */
  81.   short format_count;
  82.   short failed_sector_count;    /* Number of entries in failed sector
  83.                    log. */
  84.   char oem_name[44];
  85.   char oem_lot[44];
  86.   char unused_5[22];
  87. #ifdef FLOPPY
  88.   struct failed_log bad_log[64+128]; /* Failed sector log. */
  89. #else /* not FLOPPY */
  90.   struct failed_log bad_log[192+256]; /* Failed sector log. */
  91. #endif /* not FLOPPY */
  92.  
  93. #if 0
  94.   /* In next block. */
  95. #ifdef FLOPPY
  96.   struct failed_log bad_log2[128]; /* Failed sector log. */
  97. #else /* not FLOPPY */
  98.   struct failed_log bad_log2[256]; /* Failed sector log. */
  99. #endif /* not FLOPPY */
  100. #endif
  101.  
  102.   /* Bad sector table. */
  103. #ifdef FLOPPY
  104.   BAD_SECTOR bad_sectors[3456];
  105. #else /* not FLOPPY */
  106.   BAD_SECTOR bad_sectors[6912];
  107. #endif /* not FLOPPY */
  108. };
  109.  
  110. extern struct qic_header_segment current_header;
  111.  
  112. /* Volume table segment.  Each entry of the volume table is 128 bytes
  113.    long, and of this format. */
  114.  
  115. struct vt_entry {
  116.   char signature[4];
  117.   short start_segment;        /* First segment of entry. */
  118.   short last_segment;        /* Last segment of entry. */
  119.   char description[44];        /* Ascii description. */
  120.   llong time;            /* Time of storage. */
  121.   char flags;            /* Flags (see below). */
  122.   char sequence;        /* Multi-cartridge sequence number. */
  123.   char vendor_ext[26];
  124.   char password[8];        /* Ascii, '\0' for no password. */
  125.   llong directory_size;        /* Bytes for directory. */
  126.   llong data_size;        /* Bytes of data following directory.
  127.                    Includes multiple cartridges if
  128.                    necessary. */
  129.   short os_version;        /* First byte, major, second byte is
  130.                    minor. */
  131.   char volume_label[16];    /* Name of volume, or '\0' if
  132.                    undefined. */
  133.   char logical_origin;
  134.   char physical_origin;
  135.   char compression_type;    /* Zero if no compression. */
  136.   char unused[7];
  137. };
  138.  
  139. #endif _HEADER_H_
  140.