HELPLIB.HLB  —  MRD Library, mrd_initialize
    mrd_initialize - Send a SCSI Initialize Element Status command.

    Windows NT         mrd.dll
    UNIX               /usr/lib/libmrd.a
    OpenVMS            MRD$RTL.EXE

    #include <mrd_common.h>
    #include <mrd_message.h>

    int mrd_initialize(
        const char   *robot_name,
        char         *log_info) ;

1  –  Parameters

    o  robot_name - The name of the robot device to be opened. On
       Digital UNIX, if the leading character of the name is not a
       slash (/), /dev/ will be prepended to the name.

    o  log_info - This is a character array that should be at least
       MRD_MAX_LOG_STRING in length. If this function fails as the
       result of a SCSI error, this will be filled with the formatted
       request sense data. If this function fails as the result
       of an operating system error, the operating system message
       particular to the error will be copied into the array.

2  –  Description

    The function sends a SCSI Initialize Element Status command to
    the specified robot. This command is not supported by the TA and
    TF loaders. On robots where this command is supported, it forces
    a physical reinventory of the library or loader. On some library
    systems this may take a long time.

    Most library subsystems will perform an inventory when they are
    powered on or have detected that the configuration may have
    changed (doors opened, panels removed, etc). For this reason,
    this routine is rarely needed.

3  –  Example

    /*
     *   Example of mrd_initialize(3mrd).  The command usage is:
     *
     *      mrd_init robot_name
     *
     *   It has been observed on an empty TL820 with all the
     *   bin-packs in place that this command takes just under
     *   23 minutes.
     */
    #ifndef   lint
    static   char   SccsId[] = "@(#)mrd_init.c   1.2 3/5/97" ;
    #endif

    #include <stdio.h>
    #include <stdlib.h>

    #include <mrd_common.h>
    #include <mrd_message.h>

    main(int argc, char *argv[])
    {
       int   status ;      /* Status from mrd_inject(3mrd) */
       char   *robot ;      /* The name of the robot */
       char   log_info[MRD_MAX_LOG_STRING+1] ;  /* error string */

       /*
        *   Accept one required argument; robot name
        */
       if( argc < 2 ) {
          printf("usage: %s robot\n", argv[0]) ;
          exit(1) ;
       }

       /*
        *   Just use this directly from the command line.
        */
       robot = argv[1] ;

       /*
        *   Because this routine can take a long time we'll
        *   provide some positive feed-back that is doing
        *   something.
        */
       printf("Reinventory library %s...", robot); fflush(stdout) ;

       /*
        *   Call the function.  Because this routine can take a
        */
       status = mrd_initialize(robot, log_info) ;

       /*
        *   Done.
        */
       putchar('\n') ;

       /*
        *   Print an error message if there is a failure.  The
        *   routine mrd_strstatus(3mrd) will accept an MRD
        *   error status and return the corresponding string.
        *   If the log_info data has something other than a
        *   NULL as the first character print it as well.  It
        *   typically be the SCSI sense data or a operating
        *   system specific message for the error.
        */
       if( status != MRD_STATUS_SUCCESS )
          printf("Initialize failed: %s: %s.\n", mrd_strstatus(status),
             log_info[0] ? log_info : "none") ;

       return 0 ;
    }

4  –  Return Values

    Upon successful completion, the mrd_initialize(3mrd) function
    returns the value MRD_STATUS_SUCCESS. If the mrd_initialize(3mrd)
    fails the returned status value may be set to one of the
    following values. Other values that correspond to specific SCSI
    errors may also be possible, but these are the most likely.

4.1  –  MRD_STATUS_PARAM

    This error is returned if the robot_name or log_info arguments
    are NULL pointers.

4.2  –  MRD_STATUS_ROBOT_COMM_ERROR

    This error code is used when an OpenVMS system service, such as
    $ASSIGN or $QIO, fails with a status of SS$_DRVERR. Generally
    SS$_DRVERR indicates a failure in the underlying device and the
    MRD can get the detailed device failure and return the correct
    MRD status code instead.

    This error is also returned when a SCSI Test Unit Ready command
    fails. The cause of the error can be determined by called mrd_
    request_sense(3mrd). This error also occurs as the result of a
    SCSI command failure, when the ASC is set to one of:

    o  0x08 - Logical unit communcation errors.

    o  0x43 - Message error

    o  0x45 - Select or Reselect failure

    o  0x47 - SCSI parity error

    o  0x48 - Initiator detected error message received

    o  0x49 - Invalid message error

    o  0x4A - Command phase error

    o  0x4B - Data phase error

    o  0x4E - Overlapped commands attempted

    o  0x54 - SCSI to host system interface failure

5  –  Related Functions

    o  mrd(3mrd)

    o  mrd_initialize_element(3mrd)
Close Help