next up previous
Next: Tapeserver Installation (Optional) Up: Tape Devices in MIDAS Previous: Unix system calls for

Writing and checking your tape interface

Below, you will find the procedure steps to follow if you have to change the tape interface.

1.
For the programmer the most difficult thing is to guess the status codes from ioctl system calls. And this is done easily uncommenting the printf lines of the iostat routine so the status of all commands will be printed in the console. The most important codes to be detected are:
     #define M_ST_SUCC  0??     /* Command Successed */ 
     #define M_ST_DATA  0??     /* Data Error */ 
     #define M_ST_BOT   0??     /* Beginning of Tape */ 
     #define M_ST_TAPEM 0??     /* Tape Mark Encountered */

If you are lucky enough to have an include file containing those definitions then most of the work is done for you. (e.g. some mVAX/ULTRIX define those values in </usr/sys/vax/tmscp.h>). If you are not so lucky, you will have some fun in the next steps!

The modifications for iodev.c are updated in the generic MIDAS library midaslib.a through the following sequence:

% vi iodev.c # or any other editor
% make SYS=-DDEBUG
% cd /midas/98NOV/lib
% make

2.
After compiling the iodev.c and its object being included in the midaslib.a MIDAS library, the next step is to link the first of the tape tests:

% cd /midas/98NOV/test/os
% make testtape.exe

This test is interactive and self explanatory. It will print on your terminal a menu containing options for exercising the iodev routines. Because you uncommented the printf lines of the iostat routine, you will get the tape status for each command executed.

Put a tape in the device for testing the "iodev", then type:

% testtape.exe

Using the different options of the testtape.exe menu you can exercise all the routines of iodev. Also you can force some known situations for getting the different codes. (e.g. trying to read some data where no data was written, or trying to read data where a File Mark was written, you will get the definitions (in error register mt.mt_erreg):

     #define M_ST_DATA  0??      /* Data Error */ 
     #define M_ST_TAPEM 0??      /* Tape Mark Encountered */

Playing with the test and modifying the iodev according to the behavior of your tape unit, you can tune your tape interface, ready for the next steps.

3.
Once you think iodev is ready and in accordance with the functionality defined, you could check the upper level ``osu''.

But before, you have to set-up the variable of the environment DEVCAPFILE which defines the location of the file devcap.dat. The contents of this file should define the name and hosts of your tapes (see the document Access to Devices, Section 2.4, or read the template file /midas/98NOV/incl/devcap.dat). You can do so by:

% setenv DEVCAPFILE /midas/98NOV/incl/devcap.dat # (C-Shell)
% DEVCAPFILE=/midas/98NOV/incl/devcap.dat #(Bourne-Shell)
% export DEVCAPFILE (Bourne-Shell)

Thereafter, proceed with:

% cd /midas/98NOV/test/os
% make testosu.exe
% testosu.exe

The script testosu.exe will display a menu for selection that will allow you to check the upper tape interface osu. It works with the same philosophy as the script testape.exe. Following the options in the menu you can:

open/close tape devices
write/close file on tape
skip over files backward/forward
etc...

When getting errors, you will have to go back to the previous step, and find out what was wrong or missed.

4.
There is still one more exhaustive osu test:

% cd /midas/98NOV/test/os
% make atestosu.exe
% atestosu.exe

This test will try to exercise most possible combinations of osu calling sequences, checking the return codes and writing and reading data in all possible modes. The test will exit if an error is detected, so you can then reproduce the error by running by hand the last commands before the fault with the testosu.exe test.

NOTE: Only when this last test atestosu.exe has been executed to the end with no error, can you be sure that all tape interfaces osu and iodev are ready to be used by MIDAS commands like INTAPE/OUTTAPE.

5.
Finally, you will need to compile the iodev.c file one more time but without the conditional flag DEBUG:

% vi iodev.c # or any other editor.
% make
% cd /midas/98NOV/lib
% make
% cd /midas/98NOV/prim/dio/src
% make


next up previous
Next: Tapeserver Installation (Optional) Up: Tape Devices in MIDAS Previous: Unix system calls for
Petra Nass
11/25/1998