FreeBSD/sys/dev/isci/scil/sati_util.c
/**
 * @brief This method will set data bytes in the user data area.  If the
 *        caller requests it, the data written will be forced to ascii
 *        printable characters if it isn't already a printable character.
 *        A printable character is considered to be >= 0x20 and <= 0x70.
 *
 * @param[in]  sequence This parameter specifies the translation sequence
 *             for which to copy and swap the data.
 * @param[out] destination_scsi_io This parameter specifies the SCSI IO
 *             request containing the destination buffer into which to copy.
 * @param[in]  destination_offset This parameter specifies the offset into
 *             the data buffer where the information will be copied to.
 * @param[in]  source_value This parameter specifies the value retrieved
 *             from the source buffer that is to be copied into the user
 *             buffer area.
 * @param[in]  use_printable_chars This parameter indicates if the copy should
 *             ensure that the value copied is considered an ASCII printable
 *             character (e.g. A, B, " ", etc.).  These characters reside
 *             in the 0x20 - 0x7E ASCII range.
 *
 * @return none
 */
@brief This method will set data bytes in the user data area.  If the
caller requests it, the data written will be forced to ascii
printable characters if it isn't already a printable character.
A printable character is considered to be >= 0x20 and <= 0x70.

@param[in]  sequence This parameter specifies the translation sequence
for which to copy and swap the data.
@param[out] destination_scsi_io This parameter specifies the SCSI IO
request containing the destination buffer into which to copy.
@param[in]  destination_offset This parameter specifies the offset into
the data buffer where the information will be copied to.
@param[in]  source_value This parameter specifies the value retrieved
from the source buffer that is to be copied into the user
buffer area.
@param[in]  use_printable_chars This parameter indicates if the copy should
ensure that the value copied is considered an ASCII printable
character .  These characters reside
in the 0x20 - 0x7E ASCII range.

@return none
@brief This method will set data bytes in the user data area . If the caller requests it the data written will be forced to ascii printable characters if it isn ' t already a printable character . A printable character is considered to be > = 0x20 and < = 0x70 . @param [ in ] sequence This parameter specifies the translation sequence for which to copy and swap the data . @param [ out ] destination_scsi_io This parameter specifies the SCSI IO request containing the destination buffer into which to copy . @param [ in ] destination_offset This parameter specifies the offset into the data buffer where the information will be copied to . @param [ in ] source_value This parameter specifies the value retrieved from the source buffer that is to be copied into the user buffer area . @param [ in ] use_printable_chars This parameter indicates if the copy should ensure that the value copied is considered an ASCII printable character . These characters reside in the 0x20 - 0x7E ASCII range . @return none
static
void sati_set_ascii_data_byte(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * destination_scsi_io,
   U32                          destination_offset,
   U8                           source_value,
   BOOL                         use_printable_chars
)
{
   if((use_printable_chars == TRUE)
     && ((source_value < 0x20) || (source_value > 0x7E)))
   {
      source_value = 0x20;
   }
   sati_set_data_byte(
      sequence, destination_scsi_io, destination_offset, source_value
   );
}
static void sati_set_ascii_data_byte ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * destination_scsi_io , U32 destination_offset , U8 source_value , BOOL use_printable_chars ) { if ( ( use_printable_chars == TRUE ) && ( ( source_value < 0x20 ) || ( source_value > 0x7E ) ) ) { source_value = 0x20 ; } sati_set_data_byte ( sequence , destination_scsi_io , destination_offset , source_value ) ; }
@brief This method will set data bytes in the user data area.
@brief This method will set data bytes in the user data area .
// if the user requests that the copied data be ascii printable, then // default to " " (i.e. 0x20) for all non-ascii printable characters.