FreeBSD/sys/dev/pms/freebsd/driver/common/lxosapi.c
/******************************************************************************
ostiGetTransportParam()
Purpose:
  Call back function from lower layer to get parameters.
Parameters:
  tiRoot_t *ptiRoot (IN)     Pointer to driver root data structure
  S08 *key (IN)              Pointer to 1st level parameter
  S08 *subkey1 (IN)          Pointer to 2nd level parameter
  S08 *subkey2 (IN)          Pointer to 3rd level parameter
  S08 *subkey3 (IN)          Pointer to 4th level parameter
  S08 *subkey4 (IN)          Pointer to 5th level parameter
  S08 *subkey5 (IN)          Pointer to 6th level parameter
  S08 *valueName (IN)        Pointer to name of the value under keys
  S08 *buffer (OUT)          Pointer to returned information buffer
  U32 bufferLen (OUT)        Buffer length
  U32 *lenReceived (OUT)     String length in the buffer
Return:
  tiSuccess - Success
  Other     - Failed
Note:
  The scheme of searching adjustable parameter tree is the following:
  key
    - subkey1
      - subkey2
        - subkey3
          - subkey4
            - subkey5
              - value
  If no match in any case, tiError will return with zero length.

  Where there is no indication of max key and subkey length,
  an upper limit guess of 200 is used.
  Perhaps a prudent revision would be to add some argument(s) to be
  able to manage/check these "key" string lengths.
  This function does no checking of buffer being a valid pointer.
*****************************************************************************/
ostiGetTransportParam()
Purpose:
Call back function from lower layer to get parameters.


ostiGetTransportParam () Purpose : Call back function from lower layer to get parameters .
U32 ostiGetTransportParam( tiRoot_t *ptiRoot,
                           S08      *key,
                           S08      *subkey1,
                           S08      *subkey2,
                           S08      *subkey3,
                           S08      *subkey4,
                           S08      *subkey5,
                           S08      *valueName,
                           S08      *buffer,
                           U32       bufferLen,
                           U32      *lenReceived )
{
  S08 lFullKey[200];
  U32 lLenFullKey = 0;
  *lenReceived = 0;
  if( bufferLen > 1 )
    strcpy( buffer, "" );
  else {
    printf( "ostiGetTransportParam: buffer too small at only %d",
            bufferLen );
    return tiError; 
  }
  ostiMakeParamString( key, subkey1, subkey2, subkey3, subkey4, subkey5,
                       valueName, lFullKey, &lLenFullKey );
  if( lLenFullKey )  
    TUNABLE_STR_FETCH( lFullKey, buffer, bufferLen );
  else
    return tiError;  
  *lenReceived = strlen( buffer );
  return tiSuccess;  
}
U32 ostiGetTransportParam ( tiRoot_t * ptiRoot , S08 * key , S08 * subkey1 , S08 * subkey2 , S08 * subkey3 , S08 * subkey4 , S08 * subkey5 , S08 * valueName , S08 * buffer , U32 bufferLen , U32 * lenReceived ) { S08 lFullKey [ 200 ] ; U32 lLenFullKey = 0 ; * lenReceived = 0 ; if ( bufferLen > 1 ) strcpy ( buffer , " " ) ; else { printf ( " " , bufferLen ) ; return tiError ; } ostiMakeParamString ( key , subkey1 , subkey2 , subkey3 , subkey4 , subkey5 , valueName , lFullKey , & lLenFullKey ) ; if ( lLenFullKey ) TUNABLE_STR_FETCH ( lFullKey , buffer , bufferLen ) ; else return tiError ; * lenReceived = strlen ( buffer ) ; return tiSuccess ; }
ostiGetTransportParam()
Purpose:
Call back function from lower layer to get parameters.
ostiGetTransportParam () Purpose : Call back function from lower layer to get parameters .
// not a reasonable buffer to work with // clean ParamString extraction // not working out, bail now //if( *lenReceived ) // handy debug print //  printf( "ostiGetTransportParam: sz%d val:%s hdl-str:%s\n", //          *lenReceived, buffer, lFullKey ); // ship it chief