Fermi Tape Tools (ftt) Library User's Guide

Valery Sergeev
Computation and Communications Fabric Department

Abstract

The Fermi Tape Tools library is a C subroutine package that provides consistent, platform-independent tape I/O for a variety of tape drives  on a variety of platforms .  In the most recent releases of FTT, function are available which allow users to store the history of various statistics during the tape usage. This FTT Appendix C provides descriptions of these FTT calls and also provides a complete call reference of the routines.

Additional Tape Statistics Functions

  • ftt_statdb_buf* ftt_alloc_statdbs (void)
  • ftt_statdb_buf ftt_alloc_statdb (void)
  • int ftt_free_statdbs (ftt_statdb_buf *stbuff)
  • ftt_statdb_buf* ftt_init_statdb (ftt_descriptor d)
  • int ftt_update_statdb (ftt_descriptor d, ftt_statdb_buf *stbuff)
  • int ftt_get_statdb (ftt_descriptor d, ftt_statdb_buf stbuff)
  • int ftt_extract_statdb (ftt_stat_buf *b, FILE *pf, int stat)
  • int ftt_dump_statdb (ftt_stat_buf b, FILE *pf)
  • int ftt_dump_statdbs (ftt_stat_buf b, FILE *pf)
  • int ftt_dump_rsdata (ftt_stat_buf b, FILE *pf)
  • TABLE 6. ftt database statistics

    stat Description Notes Origin
    FTT_VENDOR_ID Vendor id data string Drive:SCSI Inquiry
    FTT_PRODUCT_ID Product id string Drive:SCSI Inquiry
    FTT_FIRMWARE Firmware rev level string Drive:SCSI Inquiry
    FTT_SERIAL_NUM Device serial number string Drive:SCSI2 Inquiry
    FTT_READ_COUNT KB read since rewind/reset counter Drive:SCSI ReqSense(EXB spec)
    FTT_WRITE_COUNT KB written since rewind/reset counter (see above)
    FTT_READ_ERRORS Read errors - drive corrected counter (see above)
    FTT_WRITE_ERRORS Write errors - drive corrected counter (see above)
    FTT_REMAIN_TAPE Remaining KB of tape counter Drive: SCSI ReqSense
    FTT_USER_READ KB read since open/unload counter Ftt: d->readkb
    FTT_USER_WRITE KB written since open/unload counter Ftt: d->writekb
    FTT_DENSITY Tape density numeric Drive:SCSI Mode Sense
    FTT_UNDERRUN Stop/start counter numeric (see above)
    FTT_MOTION_HOUR Hours tape drive is in motion counter Drive:SCSI ReqSense(DLT spec)
    FTT_POWER_HOURS Hours device has been on counter Drive:SCSI ReqSense(DLT spec)
    FTT_COUNT_ORIGIN Origin of read/write kb string Ftt
    FTT_N_READS Number of read calls counter Ftt: d->nreads
    FTT_N_WRITES Number of write and writefm calls counter Ftt: d->nwrites
    FTT_RETRIES Total ftt_retry() repeats counter Ftt:
    FTT_FAIL_RETRIES Total ftt_retry() failures counter Ftt
    FTT_RESETS Unexpected BOT discoveries counter Ftt
    FTT_HARD_ERRORS Counter of recovered errors counter Ftt
    FTT_UNC_READ Non_compressed bytes read counter Ftt
    FTT_UNC_WRITE Non_compressed bytes written counter Ftt
    FTT_CMP_READ Compressed bytes read counter Ftt
    FTT_CMP_WRITE Compressed bytes written counter Ftt

    ftt_alloc_statdbs (void)

    allocates a whole statistical database buffer for use with the other ftt statistics routines.

    Example:

    #include "ftt.h"
    ftt_statdb_buf *stbuff;
    
    stbuff = ftt_alloc_statdbs();
    

    ftt_alloc_statdb (void)

    allocates one time slice of the statistical database buffer for use with the other ftt statistics routines.

    Example:

    #include "ftt.h"
    ftt_statdb_buf stbuff;
    
    stbuff = ftt_alloc_statdb();
    

    int ftt_free_statdbs(ftt_statdb_buf* stbuff)

    frees a statistical database buffer indicated by stbuff.

    Example:

    #include "ftt.h"
    int status;
    ftt_statdb_buf* stbuff;
    
    status = ftt_free_statdbs(stbuff);
    

    ftt_statdb_buf *stbuff ftt_init_statdb(ftt_descriptor d)

    Allocate statistical database space, set initial statistical value using the global variable ftt_descriptor.

    Example:

    #include "ftt.h"
    ftt_statdb_buf *stbuff;
    
    stbuff = ftt_init_statdb(ftt_descriptor d);
    

    int ftt_update_statdb(ftt_descriptor d, ftt_stat_buf *stbuff)

    update the status of all statistical database records anp puts current statistics in to bp[0]. Note that because this functions uses ftt_get_stats call, on some platforms we will always put filemarks on your tape if you have been writing (see ftt_close_dev).

    Example:

    #include "ftt.h"
    ftt_statdb_buf *bp;
    ftt_descriptor d
    int            status;
    
    bp = ftt_init_statdb(d);
    /* do some i/o tape operations */
    
    status = ftt_update_statdb(d, bp);
    

    int ftt_get_statdb(ftt_descriptor d, ftt_stat_buf stbuff)

    extracts current database statistics (Table 6.) and packs it into an ftt_stat_buf structure, stbuff. Note that because this functions uses ftt_get_stats call, on some platforms we will always put filemarks on your tape if you have been writing (see ftt_close_dev).

    Example:

    #include "ftt.h"
    int status;
    ftt_descriptor d;
    ftt_statdb_buf stbuff;
    stbuff = ftt_alloc_statdb();
    status = ftt_get_statdb(d,stbuff);
    

    int ftt_extract_statdb(ftt_statdb_buf *b,FILE *pf, int stat)

    extracts a string describing history of a named statistic of tape data, indicated by stat. Acceptable values for stat are listed in Table 6. ftt_extract_statdb performs no tape operations.

    Example:

    #include <stdio.h>
    #include "ftt.h"
    char          *name;                    /* name of extracted stat */
    ftt_stat_buf *stbuff;                   /* statistic's database buffer */
    FILE         *outfile;
    int status, ftt_status;                 /* status of ftt calls */
    char         *estring;                  /* error string */
    
    stbuff = ftt_init_statdb(d);
    /* do some i/o tape operation here */
    
    status = ftt_update_statdb(d,stbuff);
    /* update statistical database (as often as needed) */
    outfile = fopen (filename,"w");
    status = ftt_extract_statdb(stbuff, outfile, FTT_REMAIN_TAPE);
    fclose(outfile);
    

    int ftt_dump_statdb (ftt_stat_buf b, FILE *pf)

    prints statistics from the statistics ftt_statdb_buf buffer b on file descriptor pf after execution ftt_get_statdb function. ftt_dump_statdb performs no tape I/O.

    Example:

    #include <stdio.h>
    #include "ftt.h"
    int status;
    ftt_descriptor d;
    ftt_stat_buf stbuff;
    FILE = *outfile;
    stbuff = ftt_alloc_statdb();
    status = ftt_get_statdb(d,stbuff);
    status status = ftt_dump_statdb (stbuff, outfile);
    

    int ftt_dump_statdbs (ftt_stat_buf *b, FILE *pf)

    prints statistics from the statistics database buffer b on file descriptor pf after execution ftt_init_statdb and ftt_update_statdb functions. ftt_dump_statdbs performs no tape I/O.

    Example:

    #include <stdio.h>
    #include "ftt.h"
    int status;
    ftt_descriptor d;
    ftt_stat_buf *stbuff;
    FILE = *outfile;
    stbuff = ftt_init_statdb(d);
    status = ftt_update_statdb(d,stbuff);
    status = ftt_dump_statdbs (stbuff, outfile);
    

    int ftt_dump_rsdata (ftt_descriptor d, FILE *pf)

    prints raw information returned from execution of SCSI command Request Sense. ftt_dump_rsdata performs no I/O tape operations.

    Example:

    #include <stdio.h>
    #include "ftt.h"
    int status;
    ftt_descriptor d;
    FILE = *outfile;
    
    status = ftt_dump_rsdata (d, outfile);