home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / ftape / part01 / ftape.h < prev    next >
C/C++ Source or Header  |  1991-09-04  |  2KB  |  68 lines

  1. #ident "@(#)2.4    ftape.h 91/09/03 FAST TAPE"
  2. /*
  3.  * Original author: Kari Yli-Kuha, SQ Consulting Ltd.
  4.  * Address: Kanslerinkatu 8, 33720 Tampere, Finland
  5.  * Phone: (358) 31 165200 
  6.  *
  7.  * IPC for FAST TAPE
  8.  *
  9.  * Defines SHBUF structure and defaults
  10.  */
  11.  
  12. /* 
  13.  * defaults, change these if you prefer eg. other cpio options.
  14.  * Note: "-v" is default, if can be turned off with "ftape -s" (silent) option.
  15.  */
  16. #define TAPE            "/dev/tape"  /* tape device */
  17.  
  18. /*
  19.  * 
  20.  * Depending on the driver (and it's internal buffering) you're porting 
  21.  * this program to you should select the SHBUFSIZE accordingly.
  22.  * eg in SCO Unix 3.2v2 (ODT 1.1) default CTBUFSIZE=64 so SHBUFSIZE should 
  23.  * be the same to get optimum speed.
  24.  * 
  25.  * In ISC 2.0.2 wt-driver had no buffering so I've chosen 16*20 as default.
  26.  * I don't know about ISC 2.2 or any SCSI drivers, you'll have to find out..
  27.  *
  28.  * NOTE! If the driver you're porting this to has it's own buffering you
  29.  * should check what the driver does when the the tape ran to end and the
  30.  * tape device is closed. If it flushes it's buffers (like SCO ct), well,
  31.  * bye bye multi volume backup... In that case you'll have to find 
  32.  * something clever (or, if possible, disable the internal buffering)
  33.  * 
  34.  */
  35.  
  36. #define SHBUFS          16           /* number of shm buffers */
  37. #define SHBUFSIZE       20           /* size of one buffer * 512 bytes */
  38. #define CPIO_READOPTS   "-icdum"
  39. #define CPIO_WRITEOPTS  "-ocB"
  40. #define CPIO_LISTOPTS   "-ict"
  41.  
  42. typedef struct SHBUF {
  43.   int   nread;      /* # of bytes in the buffer */
  44.   char  buf[SHBUFSIZE*512];
  45. };
  46.  
  47. /* 
  48.  * normal semaphore handling:
  49.  *   sem 0 for free buffers
  50.  *   sem 1 for available buffers
  51.  */
  52. #define NSEMS           2
  53. #define BUFFERS_FREE    0
  54. #define BUFFERS_AVAIL    1
  55. void semup(), semdown();
  56.  
  57. /* debug to check the errno's (SLOW!!) */
  58. #define DEBUG if (debug) (void)
  59.  
  60. /* 
  61.  * Processes that read/write the tape to/from shared memory.
  62.  * Used by fork_tape_handling() 
  63.  */
  64. #define TAPEREAD "ftaperead"
  65. #define TAPEWRITE "ftapewrite"
  66.  
  67. extern key_t ftok();
  68.