home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / 3b1 / volume02 / tprobe / part01 < prev    next >
Encoding:
Internet Message Format  |  1992-07-14  |  45.5 KB

  1. Path: comp-sources-3b1
  2. From: thad@btr.com (Thaddeus P. Floryan)
  3. Subject:  v02i020:  tprobe: tape saveset analyzer and duplicator, Part01/01
  4. Newsgroups: comp.sources.3b1
  5. Approved: dave@galaxia.network23.com
  6. X-Checksum-Snefru: f20c84c6 bb9657c6 a066ce14 8881e749
  7.  
  8. Submitted-by: thad@btr.com (Thaddeus P. Floryan)
  9. Posting-number: Volume 2, Issue 20
  10. Archive-name: tprobe/part01
  11.  
  12.  
  13. T P R O B E  -- Tape Saveset Analyzer and Duplicator, Version 1.0
  14.  
  15. tprobe is a utility which succeeds duplicating boot/install tapes that are not
  16. easily copied by other means.  One of its features is operation over a pipeline
  17. utilizing multiple tape drives whereever they exist on a network or a system.
  18.  
  19. tprobe can also (indirectly) perform media conversions, though the only
  20. verified conversions have been from QIC-120 and QIC-150 to QIC-24 and vice
  21. versa; there is no inherent limitation, so other conversions are definitely
  22. possible.
  23.  
  24. Another feature is that a tape may be processed without disk space being
  25. usurped for intermediate staging.  Thus, a full 150MB tape can be duplicated
  26. even if one's system has only, say, 20MB free.
  27.  
  28. tprobe's basic operation reveals a tape's existing saveset layout and stored
  29. capacity, and requires only a single tape drive for this analysis.
  30.  
  31. tprobe was intended to be a one-time-only program, but it is useful in its
  32. present incarnation and does solve others' immediate and present problems.
  33.  
  34. Systems on which tprobe has been installed and tested include CTIX, Sun-3,
  35. Sun-4, 3B1 (with QIC-02, *NOT* the /dev/rft3 floppy tape), and an AT&T 3B2
  36. (with a SCSI tapedrive).
  37.  
  38. Accompanying this source distribution is complete nroff-/troff-ready
  39. documentation and additional notes and anecdotes not appropriate for the "man"
  40. page.  Additional README.* files contain extracts from some of my recent Usenet
  41. postings concerning tapes, their formats, their setup and their handling per:
  42.  
  43. README.2150    concerning Archive 2060S/2150S jumper settings
  44. README.5945    concerning Archive 5945C, SCSI, and Emulex MT02 setup
  45. README.exb    concerning Exabyte EXB-8200 capacities and setup
  46. README.qic    concerning QIC compatibility
  47. README.tzk10    concerning DEC's TZK10 and Archive's ST525 drives
  48.  
  49. This program has functioned satisfactorily for the author, but no guarantees
  50. or warrantees are given or implied that tprobe will be suitable for your
  51. applications; this software is distributed "AS IS."
  52.  
  53. Any error detection and correction, such as may exist, is limited to that
  54. available with the standard system I/O calls open(2), read(2) and write(2).
  55.  
  56. By installing tprobe on your system, you assume all risks and liabilities
  57. for its use.
  58.  
  59. Thad Floryan [ thad@btr.com (OR) {decwrl, mips, fernwood}!btr!thad ]
  60.  
  61. ---- Cut Here and feed the following to sh ----
  62. #!/bin/sh
  63. # This is a shell archive (produced by shar 3.49)
  64. # To extract the files from this archive, save it to a file, remove
  65. # everything above the "!/bin/sh" line above, and type "sh file_name".
  66. #
  67. # made 02/18/1992 21:43 UTC by thad@cosmic
  68. # Source directory /usr/local/src/tprobe
  69. #
  70. # existing files will NOT be overwritten unless -c is specified
  71. #
  72. # This shar contains:
  73. # length  mode       name
  74. # ------ ---------- ------------------------------------------
  75. #   1211 -rw-r--r-- Makefile
  76. #   1140 -rw-r--r-- Makefile.3b1
  77. #   3465 -rw-r--r-- README
  78. #   1675 -rw-r--r-- README.2150
  79. #   2440 -rw-r--r-- README.5945
  80. #   1931 -rw-r--r-- README.exb
  81. #   2742 -rw-r--r-- README.qic
  82. #   1657 -rw-r--r-- README.tzk10
  83. #  11058 -rw-r--r-- tprobe.c
  84. #   9992 -rw-r--r-- tprobe.man
  85. #
  86. # ============= Makefile ==============
  87. if test -f 'Makefile' -a X"$1" != X"-c"; then
  88.     echo 'x - skipping Makefile (File already exists)'
  89. else
  90. echo 'x - extracting Makefile (Text)'
  91. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  92. X# Generic Makefile for tprobe
  93. X#
  94. X# make        will create the tprobe executable in the current directory
  95. X# make catman    will create catman-style documentation in the current directory
  96. X# make install    will mv(1) the executable to the specified $(DEST) directory
  97. X# make clean    will tidy-up the current directory after a link or install
  98. X# make lint    will check the source for programming irregularities
  99. X# make lintp    will check the source for portability considerations
  100. X#
  101. X# Several options can be uncommented for configuration on your system.
  102. X
  103. XCC    =    cc
  104. X
  105. X# Uncomment or change as appropriate for your system:
  106. X#
  107. XCOPT    =    -O
  108. X#CDBG    =    -g
  109. X#CPROF    =    -p -g
  110. X#
  111. XCFLAGS    =    $(COPT) $(CDBG) $(CPROF)
  112. X
  113. XLDFLAGS =    -s
  114. X
  115. X# Uncomment or change as appropriate for your system:
  116. X#
  117. X#LSVR3    =    -lc_s
  118. X#
  119. XLIBS    =    $(LSVR3)
  120. X
  121. XNAME    =    tprobe
  122. XOBJS    =    tprobe.o
  123. XSRCS    =    tprobe.c
  124. XMANF    =    tprobe.man
  125. XMANEXT    =    1
  126. X
  127. XDEST    =    /usr/local/bin
  128. XFMODE    =    555
  129. X
  130. X$(NAME)    :    $(OBJS)
  131. X        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  132. X
  133. Xinstall :    $(NAME)
  134. X        mv    $(NAME)  $(DEST)/
  135. X        chmod $(FMODE) $(DEST)/$(NAME)
  136. X
  137. Xcatman    :    $(NAME).$(MANEXT)
  138. X
  139. X$(NAME).$(MANEXT) : $(MANF)
  140. X        nroff -man $(MANF) > $(NAME).$(MANEXT)
  141. X
  142. Xclean    :
  143. X        rm -f core *~ $(OBJS)
  144. X
  145. Xlint    :
  146. X        lint $(SRCS)
  147. X
  148. Xlintp    :
  149. X        lint -p $(SRCS)
  150. SHAR_EOF
  151. chmod 0644 Makefile ||
  152. echo 'restore of Makefile failed'
  153. Wc_c="`wc -c < 'Makefile'`"
  154. test 1211 -eq "$Wc_c" ||
  155.     echo 'Makefile: original size 1211, current size' "$Wc_c"
  156. fi
  157. # ============= Makefile.3b1 ==============
  158. if test -f 'Makefile.3b1' -a X"$1" != X"-c"; then
  159.     echo 'x - skipping Makefile.3b1 (File already exists)'
  160. else
  161. echo 'x - extracting Makefile.3b1 (Text)'
  162. sed 's/^X//' << 'SHAR_EOF' > 'Makefile.3b1' &&
  163. X# 3B1 Makefile for tprobe
  164. X#
  165. X# make        will create the tprobe executable in the current directory
  166. X# make cat    will create catman-style documentation in the current directory
  167. X# make install    will mv(1) the executable to the specified $(DEST) directory
  168. X# make clean    will tidy-up the current directory after a link or install
  169. X# make lint    will check the source for programming irregularities
  170. X# make lintp    will check the source for portability considerations
  171. X#
  172. X# Several options can be uncommented for configuration on your system.
  173. X
  174. XCC    =    gcc
  175. X
  176. X# Uncomment or change as appropriate for your system:
  177. X#
  178. XCOPT    =    -O
  179. X#CDBG    =    -g
  180. X#CPROF    =    -p -g
  181. X#
  182. XCFLAGS    =    $(COPT) $(CDBG) $(CPROF)
  183. X
  184. XLDFLAGS =    -s
  185. X
  186. XLIBS    =    /lib/crt0s.o /lib/shlib.ifile
  187. X
  188. XNAME    =    tprobe
  189. XOBJS    =    tprobe.o
  190. XSRCS    =    tprobe.c
  191. XMANF    =    tprobe.man
  192. XMANEXT    =    1
  193. X
  194. XDEST    =    /usr/local/bin
  195. XFMODE    =    555
  196. X
  197. X$(NAME)    :    $(OBJS)
  198. X        $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  199. X
  200. Xinstall :    $(NAME)
  201. X        mv    $(NAME)  $(DEST)/
  202. X        chmod $(FMODE) $(DEST)/$(NAME)
  203. X
  204. Xcat    :    $(NAME).$(MANEXT)
  205. X
  206. X$(NAME).$(MANEXT) : $(MANF)
  207. X        nroff -man $(MANF) > $(NAME).$(MANEXT)
  208. X
  209. Xclean    :
  210. X        rm -f core *~ $(OBJS)
  211. X
  212. Xlint    :
  213. X        lint $(SRCS)
  214. X
  215. Xlintp    :
  216. X        lint -p $(SRCS)
  217. SHAR_EOF
  218. chmod 0644 Makefile.3b1 ||
  219. echo 'restore of Makefile.3b1 failed'
  220. Wc_c="`wc -c < 'Makefile.3b1'`"
  221. test 1140 -eq "$Wc_c" ||
  222.     echo 'Makefile.3b1: original size 1140, current size' "$Wc_c"
  223. fi
  224. # ============= README ==============
  225. if test -f 'README' -a X"$1" != X"-c"; then
  226.     echo 'x - skipping README (File already exists)'
  227. else
  228. echo 'x - extracting README (Text)'
  229. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  230. X                 T P R O B E
  231. X
  232. X         Tape Saveset Analyzer and Duplicator
  233. X
  234. X     @(#)README V1.0, 12-Feb-1992, Thad Floryan [ thad@btr.com ]
  235. X
  236. X
  237. Xtprobe is a utility which succeeds duplicating boot/install tapes that are not
  238. Xeasily copied by other means.  One of its features is operation over a pipeline
  239. Xutilizing multiple tape drives whereever they exist on a network or a system.
  240. X
  241. Xtprobe can also (indirectly) perform media conversions, though the only
  242. Xverified conversions have been from QIC-120 and QIC-150 to QIC-24 and vice
  243. Xversa; there is no inherent limitation, so other conversions are definitely
  244. Xpossible.
  245. X
  246. XAnother feature is that a tape may be processed without disk space being
  247. Xusurped for intermediate staging.  Thus, a full 150MB tape can be duplicated
  248. Xeven if one's system has only, say, 20MB free.
  249. X
  250. Xtprobe's basic operation reveals a tape's existing saveset layout and stored
  251. Xcapacity, and requires only a single tape drive for this analysis.
  252. X
  253. Xtprobe was intended to be a one-time-only program, but it is useful in its
  254. Xpresent incarnation and does solve immediate and present problems.
  255. X
  256. Xtprobe was conceived when it was realized the SunOS 4.1.1 Sun-3 SUNBIN install
  257. Xtape was to be the last ever from Sun for that architecture and that a backup
  258. Xwas essential to prevent disaster if the tape should be "bad" when most needed
  259. Xto boot into a miniroot.
  260. X
  261. XComplete nroff-/troff-ready documentation accompanies this distribution.
  262. XAdditional notes and anecdotes not appropriate for the "man" page follow.
  263. X
  264. Xtprobe began as a Kwik'N'Dirty program to ascertain the saveset layout of
  265. Xtapes to discover why "obvious" means of tape duplication were not successful;
  266. Xvarying record sizes were found to be the problem whose solution (for my
  267. Xpurposes) is the present release.
  268. X
  269. XAn obvious but often neglected fact is that tape drives need to be kept clean.
  270. XMany tape subsystem enclosures are poorly-designed, with fans sucking in dust
  271. Xand atmospheric contaminants over the heads and operating parts.  It's my
  272. Xopinion that tape drive housings should be constructed with fan(s) blowing
  273. Xfiltered air IN to maintain a positive pressure inside the enclosure as a
  274. Xbarrier to pollution (per the guidelines of clean rooms used in semiconductor
  275. Xmanufacture).  Systems with externally-replaceable filters are the best.
  276. X
  277. XFor optimum performance and reliability, tapes should also be retensioned
  278. Xprior to use.  Retensioning (one high speed rewind cycle from end to end)
  279. Xassures a even tape pack and facilitates accurate tape handling by the tape
  280. Xdrive transport.
  281. X
  282. XAlways, ALWAYS write-protect a tape after removing it from a drive.  All QIC
  283. Xand 1/2" cartridges have a tab that can be turned or flipped to a "SAFE"
  284. Xposition; DO IT!  The number of laments posted to Usenet after someone
  285. Xoverwrites a crucial backup is increasing; be SAFE, not SORRY.
  286. X
  287. XRemember: the most dangerous command on UNIX, or any system for that matter,
  288. Xis the RETURN.  Very few commands are retractable.  Be careful!
  289. X
  290. XAccompanying this README are extracts from some of my recent Usenet postings
  291. Xconcerning tapes, their formats, their setup and their handling per:
  292. X
  293. XREADME.qic    concerning QIC compatibility
  294. XREADME.2150    concerning Archive 2060S/2150S jumper settings
  295. XREADME.5945    concerning Archive 5945C, SCSI, and Emulex MT02 setup
  296. XREADME.exb    concerning Exabyte EXB-8200 capacities and setup
  297. XREADME.tzk10    concerning DEC's TZK10 and Archive's ST525 drives
  298. X
  299. X
  300. XThad Floryan [ thad@btr.com (OR) {decwrl, mips, fernwood}!btr!thad ]
  301. SHAR_EOF
  302. chmod 0644 README ||
  303. echo 'restore of README failed'
  304. Wc_c="`wc -c < 'README'`"
  305. test 3465 -eq "$Wc_c" ||
  306.     echo 'README: original size 3465, current size' "$Wc_c"
  307. fi
  308. # ============= README.2150 ==============
  309. if test -f 'README.2150' -a X"$1" != X"-c"; then
  310.     echo 'x - skipping README.2150 (File already exists)'
  311. else
  312. echo 'x - extracting README.2150 (Text)'
  313. sed 's/^X//' << 'SHAR_EOF' > 'README.2150' &&
  314. X         Viper 2060S and 2150S hardware setup
  315. X
  316. X
  317. XHardware setup amongst the 9 sets of jumpers includes:
  318. X
  319. X    SCSI ID:    3 sets of jumpers
  320. X    Serial:        this should NOT be set
  321. X    Diagnostic:    this should NOT be set
  322. X    Parity Enable:    setting depends on your interface; either EVERYTHING
  323. X            or NOTHING on the bus should be checking parity.
  324. X    Buffer Disc:    3 sets of jumpers select 2, 4, 6, 8, 12, 16, 24 and
  325. X            32K buffer sizes.  Factory default is 16K.  This is
  326. X            the number of bytes transferred over the bus in a
  327. X            single operation.  A mininum of 16K is required for
  328. X            the SCSI "COPY" command.
  329. X
  330. X
  331. XWhere to find all this at the back of the drive:
  332. X
  333. X    [OOOO]    TTTTTTTT TTTTTTTT TTTTTTTT
  334. X     [JJ]    SSSSSSSSSSSSSSSSSSSSSSSSSS
  335. X
  336. X    Where:    [OOOO]    is the power connector
  337. X         [JJ]    is the jumper block
  338. X        TTTTTT    are the three 8-pin terminators
  339. X        SSSSSS    is the 25x2 SCSI connector
  340. X
  341. X    The jumper block looks like this (in the orientation as above):
  342. X
  343. X    [ SERIAL ]    [  CF2    ]    [  ID2    ]
  344. X    [  DIAG. ]    [  CF1    ]    [  ID1    ]
  345. X    [ PARITY ]    [  CF0    ]    [  ID0    ]
  346. X
  347. X    SERIAL: no jumper
  348. X    DIAG:    no jumper
  349. X    PARITY: jumper to enable
  350. X
  351. X    ============================= BUFFER ==============================
  352. X
  353. X    SIZE:    2K    4K    6K    8K    12K    16K    24K    32K
  354. X
  355. X    CF2:    o o    o o    o o    o o    [o=o]   [o=o]   [o=o]   [o=o]
  356. X    CF1:    o o    o o    [o=o]   [o=o]    o o    o o    [o=o]   [o=o]
  357. X    CF0:    o o    [o=o]    o o    [o=o]    o o    [o=o]    o o    [o=o]
  358. X
  359. X
  360. X    ============================= SCSI ID =============================
  361. X
  362. X    ID:     0     1     2     3     4     5     6     7
  363. X
  364. X    ID2:    o o    o o    o o    o o    [o=o]   [o=o]   [o=o]   [o=o]
  365. X    ID1:    o o    o o    [o=o]   [o=o]    o o    o o    [o=o]   [o=o]
  366. X    ID0:    o o    [o=o]    o o    [o=o]    o o    [o=o]    o o    [o=o]
  367. X
  368. X    ===================================================================
  369. SHAR_EOF
  370. chmod 0644 README.2150 ||
  371. echo 'restore of README.2150 failed'
  372. Wc_c="`wc -c < 'README.2150'`"
  373. test 1675 -eq "$Wc_c" ||
  374.     echo 'README.2150: original size 1675, current size' "$Wc_c"
  375. fi
  376. # ============= README.5945 ==============
  377. if test -f 'README.5945' -a X"$1" != X"-c"; then
  378.     echo 'x - skipping README.5945 (File already exists)'
  379. else
  380. echo 'x - extracting README.5945 (Text)'
  381. sed 's/^X//' << 'SHAR_EOF' > 'README.5945' &&
  382. X>I have a surplus Archive 5945C QIC tape drive intended for an
  383. X>NCR Tower computer.  The drive assembly includes an interface
  384. X>board of some kind.  The adapter board, which is separate from
  385. X>the tape drive, has a 50 pin edge connector.
  386. X>
  387. X>Is this a SCSI assembly?
  388. X
  389. XNo, it is not a SCSI assembly.
  390. X
  391. XI have identical drives/cards on my Britton-Lee/ShareBase boxes, and on
  392. X3B1, CT MiniFrame, and CT MightyFrame systems.
  393. X
  394. XThe drive is QIC-02; the interface card accompanying it (assuming it's
  395. Xmfd by Archive) is most likely a QIC-36 to QIC-02 adapter/translator.
  396. X
  397. XOn the 50-wire edge connector, not many of the "pins" are used.  In fact,
  398. Xwhen used in external tape-drive-only shoeboxes, Archive has two interface
  399. Xcards which adapt an external connector to the 50-wire edge connector per:
  400. X
  401. X    D-37 connector to 50-wire edge: 80332-001
  402. X    DB25 connector to 50-wire edge: 80221-001
  403. X
  404. XThese connector-adapter cards are about 1" x 3", and are intended to be
  405. Xmounted on the "wall" of an enclosure case.
  406. X
  407. XWhen that tape-drive/card is (typically) mounted inside a computer, a 50-wire
  408. Xribbon connector is usually used to connect the drive to either a motherboard
  409. Xor an internal expansion card.  This is why "pulls" (a surplussed drive from
  410. Xan old computer) are often mistaken for being a SCSI drive.
  411. X
  412. XIf the accompanying card is an Emulex MT02 (as used on Sun3 systems, for
  413. Xexample), then you could use that drive on a SCSI bus.  The 25x2 SCSI connector
  414. Xand the two 14-PIN 220/330 Ohm terminator sockets would be obvious; the ID
  415. Xselection is not obvious (due to use of an unlabelled 8-pos'n DIP switch):
  416. X
  417. X    SW-1 thru SW-3 select SCSI ID per:
  418. X        SW-3 is bit "2", SW-2 is bit "1", SW-1 is bit "0"
  419. X
  420. X    SW-4 is not used.
  421. X
  422. X    SW-5 must be ON ("tach" rate), SW-6 and SW-7 must be OFF
  423. X
  424. X    SW-8 enables parity checking
  425. X
  426. XSUMMARY: if the card accompanying the drive is mfd by Archive, it's NOT SCSI,
  427. Xand you risk damage attempting to adapt a cable to plug it into a SCSI-based
  428. Xsystem.
  429. X
  430. XWITHOUT EXCEPTION, of the 100's of HDs, tape drives, and other peripherals
  431. XI've seen, SCSI ones will have a 25x2 dual-row pin connector whose pins are
  432. Xon 0.100" centers, and they'll also have an "obvious" location for SCSI
  433. Xterminators (either 14-/16-pin DIP sockets, several SIP sockets, or one
  434. Xlarge 24-DIP socket), and either a DIP switch or jumpers for selecting other
  435. XSCSI and mfr-specific parameters (such as parity, buffer sizes, delayed power-
  436. Xon, "PIN 26" TERMPWR selections, etc.).
  437. SHAR_EOF
  438. chmod 0644 README.5945 ||
  439. echo 'restore of README.5945 failed'
  440. Wc_c="`wc -c < 'README.5945'`"
  441. test 2440 -eq "$Wc_c" ||
  442.     echo 'README.5945: original size 2440, current size' "$Wc_c"
  443. fi
  444. # ============= README.exb ==============
  445. if test -f 'README.exb' -a X"$1" != X"-c"; then
  446.     echo 'x - skipping README.exb (File already exists)'
  447. else
  448. echo 'x - extracting README.exb (Text)'
  449. sed 's/^X//' << 'SHAR_EOF' > 'README.exb' &&
  450. X>Could someone tell me if an Exabyte 8200 puts 2.3GB on
  451. X>a 90 or 120 minute tape?
  452. X
  453. XDepends what cartridge TYPE you're using, and whether you're operating the
  454. Xdrive in "international mode" or not.
  455. X
  456. XFrom Exabyte's "Product Specification" manual, they identify the P5 and P6
  457. Xcartridges, and they list the track and total block capacities from which
  458. Xthe following table is an extract.  The block count represents the number
  459. Xof 1024-byte blocks.  Their table is in hex, but I just happen to have my
  460. XCasio fx-451 calculator handy for conversions to decimal!
  461. X
  462. XCartridge    Blocks (LBOT to LEOT)
  463. X
  464. XP5-15         5C100H =   377,088    * 1024 =   386,138,112 bytes
  465. XP5-30         BC2B8H =   770,744    * 1024 =   789,241,856 bytes
  466. XP5-60        172FF8H = 1,519,608    * 1024 = 1,556,078,592 bytes
  467. XP5-90        22C668H = 2,279,016    * 1024 = 2,333,712,384 bytes
  468. X
  469. XP6-15         407E0H =   264,160    * 1024 =   270,499,840 bytes
  470. XP6-30         80FC0H =   528,320    * 1024 =   540,999,680 bytes
  471. XP6-60        102020H = 1,056,800    * 1024 = 1,082,163,200 bytes
  472. XP6-90        182EA0H = 1,584,800    * 1024 = 1,622,835,200 bytes
  473. XP6-120        1FF0E0H = 2,093,280    * 1024 = 2,143,518,720 bytes
  474. X
  475. X--------------------
  476. X
  477. XSo far I've seen two styles of EXB-8200 drives whose external option jumperings
  478. Xdo NOT resemble those depicted in the Exabyte manuals (various forms of the
  479. XEXABYTE CORP EXB-8200 8MM Cartridge Tape Subsystem Product Specification,
  480. Xpart number MKT-015-03).
  481. X
  482. XAnother Exabyte manual is their "Interface User's Manual", MKT-016-04, which
  483. Xon pages 115-117 show how to set (or check) parity, even/odd byte disconnect,
  484. Xdomestic/international cartridges, fixed/variable block modes, etc.) on an
  485. XINTERNAL (to the drive) PC card [ and it's a bear to open the drive's card
  486. Xcage due to cheap tin (putty? :-) screws whose heads disintegrate even with a
  487. Xproper ISO metric screwdriver (same problem with Japanese audio gear;
  488. Xdifficult to believe that with the world's most modern steel mills, their
  489. Xsteel is the worse (too soft)) ]
  490. SHAR_EOF
  491. chmod 0644 README.exb ||
  492. echo 'restore of README.exb failed'
  493. Wc_c="`wc -c < 'README.exb'`"
  494. test 1931 -eq "$Wc_c" ||
  495.     echo 'README.exb: original size 1931, current size' "$Wc_c"
  496. fi
  497. # ============= README.qic ==============
  498. if test -f 'README.qic' -a X"$1" != X"-c"; then
  499.     echo 'x - skipping README.qic (File already exists)'
  500. else
  501. echo 'x - extracting README.qic (Text)'
  502. sed 's/^X//' << 'SHAR_EOF' > 'README.qic' &&
  503. X[concerning QIC compatibility]
  504. X
  505. XSeems some clarification is required here.  Irrespective of the drive's
  506. Xinterface (QIC-02, SCSI, etc.) there are several TRACK formats common to all
  507. XQIC (Quarter Inch Cartridge) tapes with several levels of upward-compatible
  508. XREAD conformance.
  509. X
  510. XAll the QIC drives perform "serpentine" (hence Archive's Viper, Cobra, etc.)
  511. Xrecording meaning one track at a time is recorded in one direction, then the
  512. Xheads move and subsequent recording occurs in the opposite direction, etc.
  513. X
  514. XMuch like the compatibility between {mono, stereo, quad} Philips "Compact
  515. XCassettes" (tm) for audio, the QIC manufacturers have agreed upon:
  516. X
  517. XQIC-11    4 tracks
  518. X
  519. XQIC-24    9 tracks. 60MB with DC600A tape.
  520. X    Tracks 0-3  are READ-compatible with the 4 tracks of QIC-11
  521. X
  522. XQIC-120    15 (??) tracks [see below] 120MB with DC6150 tape.
  523. X    Tracks 0-3  are READ-compatible with the 4 tracks of QIC-11
  524. X    Tracks 0-8  are READ-compatible with the 9 tracks of QIC-24
  525. X
  526. XHP    16 tracks.  Pre-formatted from H-P and incompatible with everything.
  527. X
  528. XQIC-150    18 tracks. 150MB with DC6150 tape; 250MB with DC6250 tape.
  529. X    Tracks 0-3  are READ-compatible with the  4 tracks of QIC-11
  530. X    Tracks 0-8  are READ-compatible with the  9 tracks of QIC-24
  531. X    Tracks 0-14 are READ-compatible with the 15 tracks of QIC-120
  532. X
  533. XQIC-525    ?? tracks. 525MB with DC6525 tape.
  534. X    Tracks 0-8  are READ-compatible with the  9 tracks of QIC-24
  535. X    Tracks 0-14 are READ-compatible with the 15 tracks of QIC-120
  536. X    Tracks 0-17 are READ-compatible with the 18 tracks of QIC-150
  537. X
  538. XNOTE that Sun publishes "A Tutorial on 1/4 Inch Tape Drives", Part Number
  539. X800-1315-02, which describes all the operational characteristics of such
  540. Xdrives and graphically depicts the track layouts illustrating the WHY and
  541. XHOW of the read compatibilities.
  542. X
  543. XNOTE the QIC-150 drive can write 250MB using a longer tape (DC6250) analogous
  544. Xto the difference between C-90 and C-120 audio cassettes.
  545. X
  546. XNOTE the QIC-525 drive is NOT read-compatible with QIC-11.
  547. X
  548. XNOTE it wasn't made clear to me by Maynard (Archive's end-user and support
  549. Xorganization) the "true" differences between QIC-120 and QIC-150 drives; it's
  550. Xeither or both the number of tracks and/or the recording density, so take the
  551. X"15-tracks of QIC-120" with a grain of salt until someone else posts the
  552. Xdefinitive answer.
  553. X
  554. XThe newer drives are able to automatically sense the recording density and
  555. Xmake internal adjustments for read-compatibility.
  556. X
  557. XBut, whew, the extra calendaring of the tape's surface and the exotic coating
  558. Xfor the DC6525 media have pushed its list price (from Archive) up to $79 (this
  559. Xfrom a price list at UniForum in January 1992) per cartridge.
  560. X
  561. XIf you want the info direct from THE manufacturer:
  562. X
  563. X    uunet!maynhbd!info (OR) info@maynhbd.UUCP
  564. X    1-800-821-8782
  565. SHAR_EOF
  566. chmod 0644 README.qic ||
  567. echo 'restore of README.qic failed'
  568. Wc_c="`wc -c < 'README.qic'`"
  569. test 2742 -eq "$Wc_c" ||
  570.     echo 'README.qic: original size 2742, current size' "$Wc_c"
  571. fi
  572. # ============= README.tzk10 ==============
  573. if test -f 'README.tzk10' -a X"$1" != X"-c"; then
  574.     echo 'x - skipping README.tzk10 (File already exists)'
  575. else
  576. echo 'x - extracting README.tzk10 (Text)'
  577. sed 's/^X//' << 'SHAR_EOF' > 'README.tzk10' &&
  578. X>[...]
  579. X>DEC now offers a 1/4" tape drive - TZK10, which can be used
  580. X>for backup, etc.  The tapes can hold up to 525Mb.  This is
  581. X>significantly more than SUN tape drives, but I heard that the
  582. X>drives are compatible, i.e. you can read SUN tapes on the TZK10 (tar).
  583. X>Is this true?  Also, does anyone know the type of tapes that hold
  584. X>up to 525Mb and their ballpark price.  I currently have a TK50 and
  585. X>would like to move to something with more capacity and not too much $$.
  586. X>[...]
  587. X
  588. XWhat you're describing sounds much like Archive's new ST525 series which
  589. Xuse the QIC-525 "format" for 525MB.
  590. X
  591. XIf this IS, in fact, the situation, then the drive would be READ compatible
  592. Xwith QIC-24 (60MB with DC600A tape, 9 tracks), QIC-120, and QIC-150(150MB with
  593. XDC6150 tapes or 250MB with DC6250 tapes, 18 tracks) as used on Sun (and other)
  594. Xsystems.
  595. X
  596. XFrom Archive's latest pricing sheet (just received last week from Maynard,
  597. XArchive's end-user and support subsidiary):
  598. X
  599. X    90507    DC6250 media        $69.00
  600. X    90509    DC6525 media        $79.00
  601. X
  602. XThose prices are their "US Retail."  Given that 3M DC6250 tapes are < $29
  603. Xlocally (Silicon Valley: Fry's Electronics, a "consumer"-type store), you
  604. Xshould be able to adjust the (expected) price for 3M DC6525 accordingly.
  605. X
  606. XArchive's/Maynard's "US Retail" pricing for a "raw" ST525 drive is $1,528
  607. Xfor their "ST525i internal 525MB SCSI drive kit" and $1,880 for their
  608. X"ST525e external 525MB SCSI drive kit."
  609. X
  610. XI dunno; as much as I like Archive drives (over 20 of them here), that
  611. X"list" pricing is comparable to Exabyte EXB-8200 drives which can store
  612. X4x more data (2.3GB on P5-90 cartridges).
  613. X
  614. X
  615. X[ NOTE: prices quoted above are circa January 1992 ]
  616. SHAR_EOF
  617. chmod 0644 README.tzk10 ||
  618. echo 'restore of README.tzk10 failed'
  619. Wc_c="`wc -c < 'README.tzk10'`"
  620. test 1657 -eq "$Wc_c" ||
  621.     echo 'README.tzk10: original size 1657, current size' "$Wc_c"
  622. fi
  623. # ============= tprobe.c ==============
  624. if test -f 'tprobe.c' -a X"$1" != X"-c"; then
  625.     echo 'x - skipping tprobe.c (File already exists)'
  626. else
  627. echo 'x - extracting tprobe.c (Text)'
  628. sed 's/^X//' << 'SHAR_EOF' > 'tprobe.c' &&
  629. X/*
  630. X *    tprobe    - tape analyzer and duplicator
  631. X *
  632. X *    usage: tprobe  [ -b N ] [ -r | -w ]  /dev/tapedevice
  633. X *
  634. X *    "-b N" specifies a buffersize N other than the default 65536 bytes.
  635. X *
  636. X *    "-r" reads tapedevice and writes to stdout in a special form designed
  637. X *    to be piped to another tprobe process (even across a net) for writing
  638. X *    (i.e. duplicating) a tape onto a second tape drive.
  639. X *
  640. X *    "-w" reads stdin specially formatted by another tprobe process and
  641. X *    writes (i.e. duplicates) to tapedevice.
  642. X *
  643. X *    with no options (other than -b), tprobe reads tapedevice and writes
  644. X *    a brief analysis its findings to stdout.
  645. X *
  646. X *    Adding switch "-d" for the read-side permits a file (instead of a tape)
  647. X *    to be used for testing purposes; only works if compiled with -DDEBUG.
  648. X *
  649. X *    In general, the tape should be rewound before the first use of tprobe.
  650. X *    And the tapedevice "should" be the no-rewind on close device; for
  651. X *    example:
  652. X *
  653. X *        3B1:        /dev/rmt4
  654. X *        CTIX:        /dev/rmt4
  655. X *        SunOS 4.1.1:    /dev/nrst8
  656. X *
  657. X *    To rewind the tape (before and) after using tprobe:
  658. X *
  659. X *        3B1:        qrewind            (Thad's QIC-02 program)
  660. X *        CTIX:        tsioctl -c rewind /dev/rmt0
  661. X *        SunOS 4.1.1:    mt -f /dev/rst8 rewind
  662. X *
  663. X * REVISION HISTORY:
  664. X *
  665. X * 1991        ----    T.Floryan, original Kwik'N'Dirty program for own use
  666. X * 12-Feb-1992    V1.0    T.Floryan, release to Usenet after lint-fixing, etc.
  667. X *            Comments, suggestions, complaints to thad@btr.com
  668. X *
  669. X */
  670. X
  671. X#include <stdio.h>
  672. X#include <fcntl.h>
  673. X#include <errno.h>
  674. X#include <malloc.h>        /* added to suppress some of lint's whining */
  675. X
  676. Xextern    void    exit();
  677. Xextern    char    *strncpy();
  678. Xextern    int    open();
  679. Xextern    int    read();
  680. Xextern    int    write();
  681. Xextern    int    atoi();
  682. X
  683. Xvoid    probe_tape();
  684. Xvoid    read_tape();
  685. Xvoid    write_tape();
  686. Xvoid    usage();
  687. X
  688. Xtypedef int        MWORD;
  689. Xtypedef int        LWORD;    /* sizeof(int) must be sizeof(long) */
  690. Xtypedef unsigned int    UWORD;
  691. X
  692. X#define STDIN    0        /* for read() device        */
  693. X#define STDOUT    1        /* for write() device        */
  694. X#define BLKSIZE    512        /* QIC tape physical blocking    */
  695. X#define TBUFSIZ    65536        /* default R/W buffer size    */
  696. X#define MINBUF    512        /* minimum R/W buffer size: 2^9    */
  697. X#define MAXBUF    1048576        /* maximum R/W buffer size: 2^20*/
  698. X#define UMASK    0666        /* needed for creat(2) usage    */
  699. X#define VERSKIP    4        /* skip displacement in version string */
  700. X
  701. X
  702. X/*    The following headers represent the control information passed
  703. X *    by a tape reader process to a tape writer process
  704. X */
  705. X#define HDRSIZE    10        /* size of a control header    */
  706. X
  707. X#define SCANSTR    "%8ld"
  708. X#define BUFHDR    "B%08ld\n"
  709. X#define DATHDR    "D%08ld\n"
  710. X#define SIZHDR    "S%08ld\n"
  711. X#define CLSHDR    "C00000000\n"
  712. X#define ERRHDR    "E00000000\n"
  713. X#define EOTHDR    "T00000000\n"
  714. X
  715. X
  716. X#define STATSTR    "SS%4d: %7ld blocks, %10ld bytes\n"
  717. X#define GTTLSTR    "GTotal: %7ld blocks, %10ld bytes\n"
  718. X
  719. X#ifdef DEBUG
  720. Xint debug = 0;
  721. Xchar *cmd_options = "b:rwd?hH";
  722. X#else
  723. Xchar *cmd_options = "b:rw?hH";
  724. X#endif
  725. X
  726. XLWORD    tbufsize = TBUFSIZ;
  727. X
  728. Xchar *version =
  729. X    "@(#)tprobe V1.0, 12-Feb-1992, Thad Floryan [ thad@btr.com ]";
  730. X
  731. Xchar *usage_text[] = {
  732. X    "usage:    tprobe [-b N] [-r] tapedev [ | tprobe [-b N] -w tapedev ]",
  733. X    "where:    -b  sets buffer size to N (overriding the default 65536)",
  734. X    "    -r  specifies \"this\" process to be the tape reader",
  735. X    "    -w  designates \"this\" process to be a tape writer",
  736. X    0
  737. X};
  738. X
  739. X
  740. Xmain(argc, argv)
  741. X    int    argc;
  742. X    char    *argv[];
  743. X{
  744. X    extern int     getopt();
  745. X    extern int     optind;
  746. X    extern char    *optarg;
  747. X
  748. X    MWORD    mode = 0;    /* 0=analysis, 1=read, 2=write    */
  749. X    MWORD    bufset = 0;    /* non-zero if "-b" specified */
  750. X    MWORD    optchr;
  751. X
  752. X
  753. X/*
  754. X *    Quick check to see if the program CAN run on this system due
  755. X *    to various assumptions.
  756. X */
  757. X    if (sizeof(int) != sizeof(long)) {
  758. X        (void) fprintf(stderr, "Program won't run on this system\n");
  759. X        exit(1);
  760. X    }
  761. X/*
  762. X *    Process options
  763. X */
  764. X
  765. X    while ( ( optchr = getopt( argc, argv, cmd_options ) ) != EOF ) {
  766. X
  767. X        switch (optchr) {
  768. X
  769. X        case 'b':    if (bufset != 0) {
  770. X                (void) fprintf(stderr,
  771. X                "%s: buffer size already set\n", argv[0]);
  772. X                usage();
  773. X            }
  774. X            ++bufset;
  775. X            tbufsize = atoi(optarg);
  776. X            if ((tbufsize < MINBUF) || (tbufsize > MAXBUF)) {
  777. X                (void) fprintf(stderr,
  778. X                "%s: unreasonable buffer size (%ld)\n",
  779. X                argv[0], tbufsize);
  780. X                usage();
  781. X            }
  782. X            if ((tbufsize % BLKSIZE) != 0) {
  783. X                (void) fprintf(stderr,
  784. X                "%s: buffer size (%ld) not multiple of 512\n",
  785. X                argv[0], tbufsize);
  786. X                usage();
  787. X            }
  788. X            break;
  789. X
  790. X        case 'r':    if (mode != 0) {
  791. X                (void) fprintf(stderr,"%s: too many options\n",
  792. X                argv[0]);
  793. X                usage();
  794. X            }
  795. X            mode = 1;
  796. X            break;
  797. X
  798. X        case 'w':    if (mode != 0) {
  799. X                (void) fprintf(stderr,"%s: too many options\n",
  800. X                argv[0]);
  801. X                usage();
  802. X            }
  803. X            mode = 2;
  804. X            break;
  805. X
  806. X#ifdef DEBUG
  807. X        case 'd':    if (mode != 1) {    /* must be spec'd after "-r" */
  808. X                usage();
  809. X            }
  810. X            ++debug;
  811. X            break;
  812. X#endif /* DEBUG */
  813. X
  814. X        case '?':
  815. X        case 'h':
  816. X        case 'H':
  817. X        default:    usage();
  818. X        }
  819. X    }
  820. X
  821. X    if ( optind == argc )
  822. X        usage();
  823. X
  824. X    if ( optind != (argc - 1)) {
  825. X        (void) fprintf(stderr,
  826. X        "%s: extraneous data on command line ``%s''\n",
  827. X        argv[0], argv[optind + 1]);
  828. X        usage();
  829. X    }
  830. X
  831. X    switch (mode) {
  832. X        case 0:    probe_tape(argv[optind]);
  833. X            break;
  834. X        case 1:    read_tape(argv[optind]);
  835. X            break;
  836. X        case 2:    write_tape(argv[optind]);
  837. X            break;
  838. X    }
  839. X
  840. X    return 0;
  841. X}
  842. X
  843. X
  844. Xvoid
  845. Xprobe_tape(tapedev)
  846. X    char    *tapedev;
  847. X{
  848. X    LWORD    grandttl = 0;
  849. X    LWORD    numread  = 0;
  850. X    MWORD    ssno     = 0;
  851. X    MWORD    td       = 0;
  852. X    LWORD    ttlread;
  853. X
  854. X    char    *bptr;
  855. X    char    errmsg[200];
  856. X
  857. X
  858. X    bptr = (char *) malloc(tbufsize + 4);
  859. X
  860. X    while (td >= 0) {
  861. X
  862. X        if ( (td = open(tapedev, O_RDONLY, 0)) < 0) {
  863. X        (void) sprintf(errmsg, "Cannot open tape unit %s", tapedev);
  864. X        perror(errmsg);
  865. X        exit(1);
  866. X        }
  867. X
  868. X        ttlread = 0;
  869. X
  870. X        for (;;) {
  871. X        numread = read(td, bptr, (UWORD) tbufsize);
  872. X        if (numread != tbufsize) {
  873. X            if (numread > 0) {
  874. X                ttlread += numread;
  875. X            }
  876. X            break;
  877. X        }
  878. X        ttlread += numread;
  879. X        }
  880. X
  881. X        (void) printf(STATSTR, ssno, ttlread/BLKSIZE, ttlread);
  882. X        ++ssno;
  883. X        grandttl += ttlread;
  884. X
  885. X        (void) close(td);
  886. X
  887. X        if (numread < 0) {
  888. X        (void) sprintf(errmsg, "Read error = %d", errno);
  889. X        perror(errmsg);
  890. X        td = -1;
  891. X        break;
  892. X        }
  893. X        if ((ttlread == 0) || (numread == 0)) {
  894. X        (void) printf("End of tape\n");
  895. X        td = -1;
  896. X        break;
  897. X        }
  898. X    }
  899. X
  900. X    (void) free(bptr);
  901. X
  902. X    (void) printf(GTTLSTR, grandttl/BLKSIZE, grandttl);
  903. X}
  904. X
  905. X
  906. Xvoid
  907. Xread_tape(tapedev)
  908. X    char    *tapedev;
  909. X{
  910. X    LWORD    grandttl = 0;
  911. X    LWORD    numread  = 0;
  912. X    MWORD    td       = 0;
  913. X    LWORD    ttlread;
  914. X
  915. X    char    *bptr;
  916. X    char    *dataptr;
  917. X    char    errmsg[200];
  918. X    char    header[HDRSIZE + 2];
  919. X
  920. X
  921. X    bptr = (char *) malloc(tbufsize + HDRSIZE + 2);
  922. X
  923. X    if (bptr == NULL) {
  924. X        (void) sprintf(errmsg,
  925. X            "Cannot allocate requested buffer size: %ld",
  926. X            tbufsize);
  927. X        perror(errmsg);
  928. X        exit(1);
  929. X    }
  930. X
  931. X    dataptr = bptr + HDRSIZE;
  932. X
  933. X    (void) sprintf(header, BUFHDR, tbufsize);
  934. X    (void) write(STDOUT, header, HDRSIZE);
  935. X
  936. X    while (td >= 0) {
  937. X
  938. X        if ( (td = open(tapedev, O_RDONLY, 0)) < 0) {
  939. X        (void) sprintf(errmsg, "Cannot open tape unit %s", tapedev);
  940. X        perror(errmsg);
  941. X        exit(1);
  942. X        }
  943. X
  944. X        ttlread = 0;
  945. X
  946. X        for (;;) {
  947. X        numread = read(td, dataptr, (UWORD) tbufsize);
  948. X        if (numread != tbufsize) {
  949. X            if (numread > 0) {
  950. X                ttlread += numread;
  951. X                (void) sprintf(header, DATHDR, numread);
  952. X                (void) strncpy(bptr, header, HDRSIZE);
  953. X                (void) write(STDOUT, bptr,
  954. X                     (UWORD) (numread + HDRSIZE));
  955. X            }
  956. X            break;
  957. X        }
  958. X        ttlread += numread;
  959. X        (void) sprintf(header, DATHDR, numread);
  960. X        (void) strncpy(bptr, header, HDRSIZE);
  961. X        (void) write(STDOUT, bptr, (UWORD) (numread + HDRSIZE));
  962. X        }
  963. X        grandttl += ttlread;
  964. X
  965. X        (void) close(td);
  966. X        (void) write(STDOUT, CLSHDR, HDRSIZE); /* close */
  967. X
  968. X#ifdef DEBUG
  969. X        if (debug)
  970. X        td = (-1);
  971. X#endif /* ifdef DEBUG */
  972. X
  973. X        if (numread < 0) {
  974. X        (void) write(STDOUT, ERRHDR, HDRSIZE); /* tape error */
  975. X        td = -1;
  976. X        break;
  977. X        }
  978. X        if ((ttlread == 0) || (numread == 0)) {
  979. X        (void) write(STDOUT, EOTHDR, HDRSIZE); /* end of tape */
  980. X        td = -1;
  981. X        break;
  982. X        }
  983. X    }
  984. X    (void) sprintf(header, SIZHDR, grandttl/BLKSIZE);
  985. X    (void) write(STDOUT, header, HDRSIZE);
  986. X
  987. X    (void) free(bptr);
  988. X}
  989. X
  990. X
  991. Xvoid
  992. Xwrite_tape(tapedev)
  993. X    char    *tapedev;
  994. X{
  995. X    LWORD    grandttl = 0;
  996. X    LWORD    hdrvalue;
  997. X    LWORD    numleft;
  998. X    LWORD    numread  = 0;
  999. X    LWORD    numwrote = 0;
  1000. X    MWORD    process  = 1;
  1001. X    MWORD    satis    = 0;
  1002. X    MWORD    td       = -1;
  1003. X    LWORD    ttlread  = 0;
  1004. X
  1005. X    char    *bptr;
  1006. X    char    *dataptr;
  1007. X    char    *readptr;
  1008. X    char    errmsg[200];
  1009. X
  1010. X
  1011. X
  1012. X    bptr = (char *) malloc(tbufsize + HDRSIZE + 2);
  1013. X
  1014. X    if (bptr == NULL) {
  1015. X        (void) sprintf(errmsg,
  1016. X            "Cannot allocate requested buffer size: %ld",
  1017. X            tbufsize);
  1018. X        perror(errmsg);
  1019. X        exit(1);
  1020. X    }
  1021. X
  1022. X    numread = read(STDIN, bptr, HDRSIZE);
  1023. X
  1024. X    if (numread != HDRSIZE) {
  1025. X        (void) sprintf(errmsg,
  1026. X            "We gotta problem; header size wrong: %ld",
  1027. X            numread);
  1028. X        perror(errmsg);
  1029. X        exit(1);
  1030. X    }
  1031. X
  1032. X    if (*bptr == 'B') {
  1033. X        (void) sscanf(bptr + 1, SCANSTR, &hdrvalue);
  1034. X        if (hdrvalue != tbufsize) {
  1035. X        (void) sprintf(errmsg, "Buffer disagreement: R=%ld, W=%ld",
  1036. X            hdrvalue, tbufsize);
  1037. X        perror(errmsg);
  1038. X        exit(1);
  1039. X        }
  1040. X    } else {
  1041. X        perror("First header not ``B''");
  1042. X        exit(1);
  1043. X    }
  1044. X
  1045. X    dataptr = bptr + HDRSIZE;
  1046. X
  1047. X    while (process != 0) {
  1048. X
  1049. X        numread = read(STDIN, bptr, HDRSIZE);
  1050. X
  1051. X        if (numread != HDRSIZE) {
  1052. X        (void) sprintf(errmsg,
  1053. X                "We gotta problem; header size wrong: %ld",
  1054. X                numread);
  1055. X        perror(errmsg);
  1056. X        exit(1);
  1057. X        }
  1058. X        (void) sscanf(bptr + 1, SCANSTR, &hdrvalue);
  1059. X
  1060. X        switch (*bptr) {
  1061. X        case 'D':    if (td < 0) {
  1062. X                if ( (td = creat(tapedev, UMASK)) < 0) {
  1063. X                (void) sprintf(errmsg,
  1064. X                           "Cannot open tape unit %s",
  1065. X                           tapedev);
  1066. X                perror(errmsg);
  1067. X                process = 0;
  1068. X                }
  1069. X            }
  1070. X
  1071. X            numleft = hdrvalue;
  1072. X            readptr = dataptr;
  1073. X            satis   = 0;
  1074. X
  1075. X            while (satis == 0) {
  1076. X                numread  = read(STDIN, readptr, (UWORD) numleft);
  1077. X                if (numread != numleft) {
  1078. X                numleft -= numread;
  1079. X                readptr += numread;
  1080. X                ttlread += numread;
  1081. X                } else {
  1082. X                ttlread += numread;
  1083. X                ++satis;
  1084. X                }
  1085. X            }
  1086. X
  1087. X            numwrote = write(td, dataptr, (UWORD) hdrvalue);
  1088. X            if (numwrote != hdrvalue) {
  1089. X                (void) fprintf(stderr,
  1090. X                "Tape size error: %ld should be %ld\n",
  1091. X                numwrote, hdrvalue);
  1092. X                (void) close(td);
  1093. X                process = 0;
  1094. X            } else {
  1095. X                grandttl += numwrote;
  1096. X            }
  1097. X            break;
  1098. X        case 'C':    if (td < 0) {
  1099. X                if ( (td = creat(tapedev, UMASK)) < 0) {
  1100. X                (void) sprintf(errmsg,
  1101. X                           "Cannot open tape unit %s",
  1102. X                           tapedev);
  1103. X                perror(errmsg);
  1104. X                process = 0;
  1105. X                }
  1106. X            }
  1107. X            (void) close(td);
  1108. X            td = -1;
  1109. X            break;
  1110. X        case 'T':    process = 0;    /* Remote End-Of-Tape; all done */
  1111. X            break;
  1112. X        case 'S':    if (hdrvalue != (grandttl/BLKSIZE)) {
  1113. X                (void) fprintf(stderr,
  1114. X                "Grand total mismatch: %ld should be %ld\n",
  1115. X                grandttl, ttlread);
  1116. X            }
  1117. X            td = -1;
  1118. X            process = 0;
  1119. X            break;
  1120. X        case 'E':    (void) fprintf(stderr, "Remote error detected\n");
  1121. X            break;
  1122. X        default:    (void) fprintf(stderr, "Header error: %c\n", *bptr);
  1123. X            if (td >= 0) {
  1124. X                (void) close(td);
  1125. X                td = -1;
  1126. X            }
  1127. X            process = 0;
  1128. X        }
  1129. X    }
  1130. X
  1131. X    (void) free(bptr);
  1132. X}
  1133. X
  1134. Xvoid
  1135. Xusage()
  1136. X{
  1137. X    int    ndx = 0;
  1138. X
  1139. X    while ( usage_text[ndx] != 0 ) {
  1140. X
  1141. X        (void) fprintf( stderr, "%s\n", usage_text[ndx++] );
  1142. X    }
  1143. X    (void) fprintf( stderr, "%s\n", version + VERSKIP );
  1144. X    exit(1);
  1145. X}
  1146. SHAR_EOF
  1147. chmod 0644 tprobe.c ||
  1148. echo 'restore of tprobe.c failed'
  1149. Wc_c="`wc -c < 'tprobe.c'`"
  1150. test 11058 -eq "$Wc_c" ||
  1151.     echo 'tprobe.c: original size 11058, current size' "$Wc_c"
  1152. fi
  1153. # ============= tprobe.man ==============
  1154. if test -f 'tprobe.man' -a X"$1" != X"-c"; then
  1155.     echo 'x - skipping tprobe.man (File already exists)'
  1156. else
  1157. echo 'x - extracting tprobe.man (Text)'
  1158. sed 's/^X//' << 'SHAR_EOF' > 'tprobe.man' &&
  1159. X.TH TPROBE L "12-Feb-1992"
  1160. X.\"@(#)tprobe.man V1.0, 12-Feb-1992, Thad Floryan [ thad@btr.com ]
  1161. X.SH NAME
  1162. Xtprobe \- tape saveset analyzer and duplicator
  1163. X.SH SYNOPSIS
  1164. Xtprobe [-b
  1165. X.I n]
  1166. X.I /dev/NRTD
  1167. X.LP
  1168. Xtprobe [-b
  1169. X.I n]
  1170. X-r
  1171. X.I /dev/NRTD0
  1172. X| tprobe [-b
  1173. X.I n]
  1174. X-w
  1175. X.I /dev/NRTD1
  1176. X.LP
  1177. X.I [host]
  1178. Xtprobe [-b
  1179. X.I n]
  1180. X-r
  1181. X.I /dev/NRTD0
  1182. X|
  1183. X.ti +23
  1184. X.I [host]
  1185. Xtprobe [-b
  1186. X.I n]
  1187. X-w
  1188. X.I /dev/NRTD1
  1189. X.sp
  1190. X.ta +0.3i
  1191. X.in +0.3i
  1192. X.ti -0.3i
  1193. X\(bu
  1194. X.I    ``/dev/NRTDn''
  1195. Xis typically the "no-rewind-on-close" tape device [See
  1196. X.I OPERATING NOTES]
  1197. X.sp
  1198. X.ti -0.3i
  1199. X\(bu
  1200. X.I    ``host''
  1201. Xis the system-dependent clause signifying remote tape
  1202. Xoperation [See
  1203. X.I OPERATING NOTES]
  1204. X.in -0.3i
  1205. X.SH DESCRIPTION
  1206. X.I tprobe
  1207. Xis a utility which succeeds duplicating boot/install tapes that are not
  1208. Xeasily copied by other means.  One of its features is operation over a
  1209. Xpipeline utilizing multiple tape drives whereever they exist on a network
  1210. Xor a system.
  1211. X.sp
  1212. X.I tprobe
  1213. Xcan also (indirectly) perform media conversions, though the
  1214. Xonly verified conversions have been from QIC-120 and QIC-150 to QIC-24
  1215. Xand vice versa; there is no inherent limitation, so other conversions
  1216. Xare definitely possible.
  1217. X.sp
  1218. XAnother feature is that a tape may be processed without disk space being
  1219. Xusurped for intermediate staging.  Thus, a full 150MB tape can be duplicated
  1220. Xeven if one's system has only, say, 20MB free.
  1221. X.sp
  1222. X.I tprobe's
  1223. Xbasic operation reveals a tape's existing saveset layout and stored capacity,
  1224. Xand requires only a single tape drive for this analysis.
  1225. X.sp
  1226. X.I tprobe
  1227. Xwas intended to be a one-time-only program, but it is useful in its present
  1228. Xincarnation and does solve immediate and present problems.
  1229. XFor
  1230. X.I tprobe's
  1231. Xraison d'etre and anecdotes, see the
  1232. X.I BACKGROUND
  1233. Xsection.
  1234. X.SH OPTIONS
  1235. X.TP 8
  1236. X.I -b
  1237. XSpecifies the buffering size to help maintain streaming operation.  The
  1238. Xdefault is 65536 bytes.  A value must be stated in bytes; no abbreviations
  1239. Xare recognized in this version.  The buffer must be the same size at both
  1240. Xends of the pipe else the "write" process will diagnose the error and abort.
  1241. X.sp
  1242. XFor 8mm EXB-8200 drives, 262144 (256KB) appears to be an optimal size.
  1243. XExperiment!
  1244. X.TP 8
  1245. X.I -r
  1246. XDesignates "this" process to be the tape reader and head of the pipeline.
  1247. X.TP 8
  1248. X.I -w
  1249. XDesignates "this" process to be a tape writer and a tail of the pipeline
  1250. X(see
  1251. X.IB tee(1)).
  1252. X.SH OPERATING NOTES
  1253. XWith no options (other than -b),
  1254. X.I tprobe
  1255. Xreads a tape and writes a brief analysis of its findings to stdout.
  1256. X.sp
  1257. XThe tape device should be a "no-rewind-on-close" device per the following
  1258. Xexamples:
  1259. X.sp
  1260. X.nf
  1261. X.RS
  1262. X/dev/nrst8      SunOS 4.1.1 with a SCSI tape
  1263. X.br
  1264. X/dev/rmt4       CTIX or 3B1 with a QIC-02 drive
  1265. X.RE
  1266. X.fi
  1267. X.sp
  1268. XIn general, a tape should be rewound before use.
  1269. XSeveral examples of rewinding a tape on some systems are:
  1270. X.sp
  1271. X.nf
  1272. X.RS
  1273. XSunOS 4.1.1:    mt -f /dev/rst8 rewind
  1274. X.br
  1275. XCTIX:           tsioctl -c rewind /dev/rmt0
  1276. X.br
  1277. X3B1:            qrewind   # (Thad's QIC-02 program)
  1278. X.RE
  1279. X.fi
  1280. X.sp
  1281. XThe "[host]" as shown in the
  1282. X.I SYNOPSIS
  1283. Xtakes the forms:
  1284. X.sp
  1285. X.RS
  1286. X[rsh | remsh | rcmd] hostname
  1287. X.RE
  1288. X.sp
  1289. Xas appropriate for the system on which the command is issued.
  1290. XSpecification simply as "hostname" is permitted if /usr/hosts/MAKEHOSTS has
  1291. Xbeen previously executed and "/usr/hosts" is present in $PATH.
  1292. X.sp
  1293. XNote that for remote system operation, the /etc/hosts.equiv and/or
  1294. Xthe ~/.rhosts authentication file(s) must be previously established.
  1295. X.I tprobe
  1296. Xmust exist within the directories specified in all one's $PATH's, especially
  1297. Xso for remote operation.
  1298. X.sp
  1299. XNote that not all systems' and/or applications' install tapes have two
  1300. Xconsecutive file-marks to designate end-of-tape;
  1301. X.I tprobe
  1302. Xwill still correctly duplicate such tapes.
  1303. X.SH EXAMPLES
  1304. XTo duplicate a tape mounted on a remote Sun named "faraway" onto the local
  1305. XSun, assuring that all tapes are rewound before and after the operation:
  1306. X.sp
  1307. X.in +0.5i
  1308. Xrsh faraway mt -f /dev/rst8 rewind
  1309. X.br
  1310. Xmt -f /dev/rst8 rewind
  1311. X.br
  1312. Xrsh faraway tprobe -r /dev/nrst8 | tprobe -w /dev/nrst8
  1313. X.br
  1314. Xrsh faraway mt -f /dev/rst8 rewind
  1315. X.br
  1316. Xmt -f /dev/rst8 rewind
  1317. X.in -0.5i
  1318. X.sp
  1319. XTo duplicate a tape on a local Sun having two tape drives:
  1320. X.sp
  1321. X.ti +0.5i
  1322. Xtprobe -r /dev/nrst8 | tprobe -w /dev/nrst9
  1323. X.sp
  1324. XTo duplicate a tape between two remote Sun systems ("proxy" mode)
  1325. Xwhere both remote systems have link entries in /usr/hosts:
  1326. X.sp
  1327. X.ti +0.5i
  1328. Xhost1 tprobe -r /dev/nrst8 | host2 tprobe -w /dev/nrst8
  1329. X.SH BACKGROUND
  1330. XIt appears there's confusion surrounding the "difficulty" making [legally
  1331. Xpermissible] backup copies of one's boot/install tapes to assure continued
  1332. Xoperation of one's system(s).
  1333. X.sp
  1334. XMany people's attempts with
  1335. X.IB dd(1),
  1336. X.IB cat(1),
  1337. Xetc. have failed (even though such
  1338. Xattempts have worked duplicating, say, "pure" tar- or cpio-written tapes).
  1339. X.sp
  1340. XThe reason for the difficulty is due to the varying record sizes typically
  1341. Xfound on boot/install tapes.  In other words, it's difficult to specify an
  1342. X.I efficient
  1343. Xleast-common-denominator (LCD) block/record size to
  1344. X.IB dd(1)
  1345. Xfor a "raw" duplication [ although an intelligent shell script can get around
  1346. Xthis, using
  1347. X.IB dd(1)'s
  1348. Xstats ]; note programs such as
  1349. X.IB cat(1)
  1350. Xtend to assume constantly-fixed record sizes.
  1351. X.sp
  1352. XFor the record, the LCD for QIC tapes is 512-bytes, which is the physical
  1353. Xblocking size.  But if you attempt to use that size, your data will be
  1354. X``Shoe Shined'' into oblivion!  :-)
  1355. X.sp
  1356. XThree representative samplings of the beginning layout of boot tapes
  1357. Xanalyzed by
  1358. X.I tprobe
  1359. Xfor a Sun, a CTIX, and an AT&T boot/install tape are shown below.
  1360. X"SS n" is the save-set number (a save-set being the data
  1361. Xbetween file-marks on a tape).
  1362. X"blocks" are the 512-byte physical records as written on QIC tapes.
  1363. XThese examples show
  1364. X.I tprobe
  1365. Xoperation from a Sun system console:
  1366. X.sp
  1367. X.RS
  1368. X% # SunOS 4.1.1 Sun-3 SUNBIN, tape 1 of 2
  1369. X.br
  1370. X% #
  1371. X.br
  1372. X% tprobe /dev/nrst8
  1373. X.br
  1374. XSS   0:     64 blocks,     32768 bytes
  1375. X.br
  1376. XSS   1:     16 blocks,      8192 bytes
  1377. X.br
  1378. XSS   2:   1425 blocks,    729600 bytes
  1379. X.br
  1380. XSS   3:   3200 blocks,   1638400 bytes
  1381. X.br
  1382. XSS   4:  14000 blocks,   7168000 bytes
  1383. X.br
  1384. XSS   5:    146 blocks,     74752 bytes
  1385. X.br
  1386. XSS   6:  22674 blocks,  11609088 bytes
  1387. X.br
  1388. X[...]
  1389. X.sp
  1390. X% # CTIX 6.2 MightyFrame RUNTIME/INSTALL
  1391. X.br
  1392. X% #
  1393. X.br
  1394. X% tprobe /dev/nrst8
  1395. X.br
  1396. XSS   0:    128 blocks,     65536 bytes
  1397. X.br
  1398. XSS   1:    768 blocks,    393216 bytes
  1399. X.br
  1400. XSS   2:   1888 blocks,    966656 bytes
  1401. X.br
  1402. XSS   3:   2176 blocks,   1114112 bytes
  1403. X.br
  1404. XSS   4:    320 blocks,    163840 bytes
  1405. X.br
  1406. XSS   5:    384 blocks,    196608 bytes
  1407. X.br
  1408. XSS   6:    256 blocks,    131072 bytes
  1409. X.br
  1410. X[...]
  1411. X.sp
  1412. X% # AT&T 3B2 SVR3.2.2 LOAD 19 OS & UTILS
  1413. X.br
  1414. X% #
  1415. X.br
  1416. X% tprobe /dev/nrst8
  1417. X.br
  1418. XSS   0:   4099 blocks,   2098688 bytes
  1419. X.br
  1420. XSS   1:   8610 blocks,   4408320 bytes
  1421. X.br
  1422. XSS   2:      3 blocks,      1536 bytes
  1423. X.br
  1424. XSS   3:   1422 blocks,    728064 bytes
  1425. X.br
  1426. XSS   4:   1422 blocks,    728064 bytes
  1427. X.br
  1428. XSS   5:   1422 blocks,    728064 bytes
  1429. X.br
  1430. XSS   6:   1422 blocks,    728064 bytes
  1431. X.br
  1432. X[...]
  1433. X.RE
  1434. X.sp
  1435. X.I tprobe
  1436. Xwas conceived when it was realized the SunOS 4.1.1 Sun-3 SUNBIN install tape
  1437. Xwas to be the last ever from Sun for that architecture and that a backup was
  1438. Xessential to prevent disaster if the tape should be "bad" when most needed
  1439. Xto boot into a miniroot.
  1440. X.sp
  1441. X.I tprobe's
  1442. Xmain purpose is to read one tape and write to another over Ethernet since
  1443. Xsystems typically possess only one tape drive.
  1444. X.sp
  1445. X.I tprobe
  1446. Xduplicates tapes
  1447. X.I without consuming disk space
  1448. Xand, as a side benefit,
  1449. Xindirectly converts tape media between QIC-11/-24/-120/-150/-525 within
  1450. Xthe storage capability of the output tape.
  1451. X.sp
  1452. XThe first test of
  1453. X.I tprobe
  1454. Xwas the duplication of a SunOS install tape by reading the original on a 3B1
  1455. Xwhile writing the duplicate on a CT MightyFrame, then booting and
  1456. Xsuninstall'ing from the duplicated tape on a Sun-3/60.
  1457. X.sp
  1458. XSystems on which
  1459. X.I tprobe
  1460. Xhas been installed and tested include 3B1, CTIX, Sun-3, Sun-4, and an AT&T 3B2.
  1461. X.SH AUTHOR
  1462. XThad Floryan
  1463. X.br
  1464. Xthad@btr.com (OR) {decwrl,mips,fernwood}!btr!thad
  1465. X.br
  1466. X.ne 3
  1467. X.SH VERSION
  1468. XThe present release of
  1469. X.I tprobe
  1470. Xis 1.0, dated 12-Feb-1992.
  1471. X.SH FUTURE DEVELOPMENT
  1472. X.ta +0.3i
  1473. X.in +0.3i
  1474. X.ti -0.3i
  1475. X\(bu    Add double buffering (for speed) along the lines of the
  1476. X.IB ddd(1)
  1477. Xprogram posted to comp.sources.unix/Volume15 by Tapani Lindgren, with two
  1478. Xchild processes alternating pipe I/O with tape I/O.
  1479. X.sp
  1480. X.ti -0.3i
  1481. X\(bu    Devise a method of truly copying, say, a full 150MB tape onto
  1482. Xthree 60MB tapes.  Would require more tape "smarts" to detect EOM (end
  1483. Xof media) and prompting for media change.  Not certain of feasibility
  1484. Xdue to unknown source media's genesis (e.g. tar, cpio, whatever).
  1485. X.SH CAVEATS
  1486. X.PP
  1487. XThis program has functioned satisfactorily for the author, but no guarantees
  1488. Xor warrantees are given or implied that
  1489. X.I tprobe
  1490. Xwill be suitable for your applications; this software is distributed
  1491. X.I AS IS.
  1492. X.sp
  1493. XAny error detection and correction, such as may exist, is limited to that
  1494. Xavailable with the standard system I/O calls
  1495. X.IB open(2),
  1496. X.IB read(2)
  1497. Xand
  1498. X.IB write(2).
  1499. X.sp
  1500. XBy installing
  1501. X.I tprobe
  1502. Xon your system, you assume all risks and liabilities for its use.
  1503. X.SH BUGS
  1504. X.PP
  1505. XInternal counters and statistics are kept as "long" data;
  1506. Xnewer tape drives whose media capacity exceeds a system's ability to
  1507. Xretain a tally that large will definitely be troublesome.
  1508. X.sp
  1509. X.I tprobe
  1510. Xassumes the user has specified a tape device as its object; anything else
  1511. Xas
  1512. X.I tprobe's
  1513. Xobject will probably trigger unknown and bizarre side-effects.
  1514. X.SH SEE ALSO
  1515. XAll pertinent tape, mt, mtio, tsioctl, etc. commands as appropriate for
  1516. Xyour system(s) to ascertain the correct tape device syntax and semantics
  1517. Xfor your drive(s) operated per "no-rewind-on-close."
  1518. X.sp
  1519. XThe
  1520. X.IB copytape(1)
  1521. Xprogram by David S. Hayes (April 1985/July 1986) is also
  1522. Xworthy of your consideration.   On a system with one tape drive, it
  1523. Xcreates a specially-formatted intermediate file whose size reflects the
  1524. Xtape's contents; on a two-tape-drive system it can duplicate a tape in
  1525. Xone pass.  Because of its intermediate file,
  1526. X.IB copytape(1)
  1527. Xeasily produces multiple copies after a single read of the master tape.
  1528. SHAR_EOF
  1529. chmod 0644 tprobe.man ||
  1530. echo 'restore of tprobe.man failed'
  1531. Wc_c="`wc -c < 'tprobe.man'`"
  1532. test 9992 -eq "$Wc_c" ||
  1533.     echo 'tprobe.man: original size 9992, current size' "$Wc_c"
  1534. fi
  1535. exit 0
  1536. -- 
  1537. David H. Brierley
  1538. Home: dave@galaxia.network23.com; Work: dhb@quahog.ssd.ray.com
  1539. Send comp.sources.3b1 submissions to comp-sources-3b1@galaxia.network23.com
  1540. %% Can I be excused, my brain is full. **
  1541.