DLT package - stack of files on a pool of tapes

Authors:
        Ruben   Baghshetsyan  YerPhI - Yerevan, Armenia
        Serguei Moukhine      JINR   - Dubna,   Russia


DLT package is intended for writing and reading files to and from magnetic (e.g. DLT) tapes. The package implements a stack of files on a pool of tapes.

There should be a pool description file with a information about drives and tapes, e.g.

DEVICE /dev/nrmt0 device_comment0
DEVICE /dev/nrmt1 device_comment1
TAPE TapeNumberOne 40000 tape_comment1
TAPE TapeNumberTwo 40000 tape_comment2
TAPE TapeNumberThree 40000 tape_comment3

Each word in this file has to be separated by one space simbol.

For devices necessary information is: name of device, comment.
For tape : name of tape, size of tape in Mb, comment.

For each tape, package creates a catalogue file where the folowing information is kept: number of files, maximum number of files (it is counted from a tape size and expected average file size which is passed by argument to MtInit function) and structures

typedef struct
  {
    int  fileSize;              /* size of file                     */
    int  totalSizeOfFiles;      /* total size of files on this tape */
    char fileName[MAXPATHLEN];  /* name of file                     */
  } FilesInfo;

for each file written on a tape. After reading from a tape the number of files in the catalogue is decreased.
This means that the package realizes a stack.

The package contains the following functions.

int  MtStkInit( char* mtPool, char* catalogRoot, int averageFileSize );
int  MtStkPush( char* fileName );
int  MtStkPop( );
char *MtStkMessage( );
 
 

Functions description
 
Function
int  MtStkInit( char* mtPool, char* catalogRoot, int averageFileSize );
 
Description
Read information about devices and tapes from "mtPool" file and fill in coresponding structures. Create catalogue files for each tape (if they are not exist) and calculate expected number of files.
The averageFileSize must be in Mb.
 
Note
This function should be used before MtStkPush or MtStkPop functions.
 
Return value


   0 - OK
  -1 - failure



 
Function


int  MtStkPush( char* fileName );
 

Description


Write "fileName" file to the tape.
 
 

Return value


   0 - OK
  -1 - failure



 
Function


int  MtStkPop( );
 

Description


Read the last written file from a tape to a disk and remove it from the catalogue.
 

Return value


   0 - OK
  -1 - failure



 
Function


char *MtStkMessage( );
 

Description


This function can be used for reading the error messages returned by previous functions.
 

Return value


Pointer to internal array containing current error message.