FreeBSD/sys/dev/isci/isci_io_request.c
/**
 * @brief This callback method asks the user to provide the address
 *        to where the next Scatter-Gather Element is located.
 *
 * Details regarding usage:
 *   - Regarding the first SGE: the user should initialize an index,
 *     or a pointer, prior to construction of the request that will
 *     reference the very first scatter-gather element.  This is
 *     important since this method is called for every scatter-gather
 *     element, including the first element.
 *   - Regarding the last SGE: the user should return NULL from this
 *     method when this method is called and the SGL has exhausted
 *     all elements.
 *
 * @param[in] scif_user_io_request This parameter points to the user's
 *            IO request object.  It is a cookie that allows the user to
 *            provide the necessary information for this callback.
 * @param[in] current_sge_address This parameter specifies the address for
 *            the current SGE (i.e. the one that has just processed).
 * @param[out] next_sge An address specifying the location for the next scatter
 *             gather element to be processed.
 *
 * @return None.
 */
@brief This callback method asks the user to provide the address
to where the next Scatter-Gather Element is located.

Details regarding usage:
- Regarding the first SGE: the user should initialize an index,
or a pointer, prior to construction of the request that will
reference the very first scatter-gather element.  This is
important since this method is called for every scatter-gather
element, including the first element.
- Regarding the last SGE: the user should return NULL from this
method when this method is called and the SGL has exhausted
all elements.

@param[in] scif_user_io_request This parameter points to the user's
IO request object.  It is a cookie that allows the user to
provide the necessary information for this callback.
@param[in] current_sge_address This parameter specifies the address for
the current SGE .
@param[out] next_sge An address specifying the location for the next scatter
gather element to be processed.

@return None.
@brief This callback method asks the user to provide the address to where the next Scatter - Gather Element is located . Details regarding usage : - Regarding the first SGE : the user should initialize an index or a pointer prior to construction of the request that will reference the very first scatter - gather element . This is important since this method is called for every scatter - gather element including the first element . - Regarding the last SGE : the user should return NULL from this method when this method is called and the SGL has exhausted all elements . @param [ in ] scif_user_io_request This parameter points to the user ' s IO request object . It is a cookie that allows the user to provide the necessary information for this callback . @param [ in ] current_sge_address This parameter specifies the address for the current SGE . @param [ out ] next_sge An address specifying the location for the next scatter gather element to be processed . @return None .
void
scif_cb_io_request_get_next_sge(void * scif_user_io_request,
    void * current_sge_address, void ** next_sge)
{
	struct ISCI_IO_REQUEST *isci_request =
	    (struct ISCI_IO_REQUEST *)scif_user_io_request;
	if (isci_request->current_sge_index == isci_request->num_segments)
		*next_sge = NULL;
	else {
		bus_dma_segment_t *sge =
		    &isci_request->sge[isci_request->current_sge_index];
		isci_request->current_sge_index++;
		*next_sge = sge;
	}
}
void scif_cb_io_request_get_next_sge ( void * scif_user_io_request , void * current_sge_address , void * * next_sge ) { struct ISCI_IO_REQUEST * isci_request = ( struct ISCI_IO_REQUEST * ) scif_user_io_request ; if ( isci_request -> current_sge_index == isci_request -> num_segments ) * next_sge = NULL ; else { bus_dma_segment_t * sge = & isci_request -> sge [ isci_request -> current_sge_index ] ; isci_request -> current_sge_index ++ ; * next_sge = sge ; } }
@brief This callback method asks the user to provide the address
        to where the next Scatter-Gather Element is located.
@brief This callback method asks the user to provide the address to where the next Scatter - Gather Element is located .