FreeBSD/sys/cam/scsi/scsi_target.c
/* Process requests (descrs) via the periph-supplied CCBs */
Process requests (descrs) via the periph-supplied CCBs
Process requests ( descrs ) via the periph - supplied CCBs
static void
targstart(struct cam_periph *periph, union ccb *start_ccb)
{
	struct targ_softc *softc;
	struct targ_cmd_descr *descr, *next_descr;
	int error;
	softc = (struct targ_softc *)periph->softc;
	CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("targstart %p\n", start_ccb));
	descr = TAILQ_FIRST(&softc->work_queue);
	if (descr == NULL) {
		xpt_release_ccb(start_ccb);
	} else {
		TAILQ_REMOVE(&softc->work_queue, descr, tqe);
		next_descr = TAILQ_FIRST(&softc->work_queue);
		error = targusermerge(softc, descr, start_ccb);
		if (error == 0)
			error = targsendccb(softc, start_ccb, descr);
		if (error != 0) {
			xpt_print(periph->path,
			    "targsendccb failed, err %d\n", error);
			xpt_release_ccb(start_ccb);
			suword(&descr->user_ccb->ccb_h.status,
			       CAM_REQ_CMP_ERR);
			TAILQ_INSERT_TAIL(&softc->abort_queue, descr, tqe);
			notify_user(softc);
		}
		if (next_descr != NULL)
			xpt_schedule(periph, next_descr->priority);
	}
}
static void targstart ( struct cam_periph * periph , union ccb * start_ccb ) { struct targ_softc * softc ; struct targ_cmd_descr * descr , * next_descr ; int error ; softc = ( struct targ_softc * ) periph -> softc ; CAM_DEBUG ( softc -> path , CAM_DEBUG_PERIPH , ( " \n " , start_ccb ) ) ; descr = TAILQ_FIRST ( & softc -> work_queue ) ; if ( descr == NULL ) { xpt_release_ccb ( start_ccb ) ; } else { TAILQ_REMOVE ( & softc -> work_queue , descr , tqe ) ; next_descr = TAILQ_FIRST ( & softc -> work_queue ) ; error = targusermerge ( softc , descr , start_ccb ) ; if ( error == 0 ) error = targsendccb ( softc , start_ccb , descr ) ; if ( error != 0 ) { xpt_print ( periph -> path , " \n " , error ) ; xpt_release_ccb ( start_ccb ) ; suword ( & descr -> user_ccb -> ccb_h . status , CAM_REQ_CMP_ERR ) ; TAILQ_INSERT_TAIL ( & softc -> abort_queue , descr , tqe ) ; notify_user ( softc ) ; } if ( next_descr != NULL ) xpt_schedule ( periph , next_descr -> priority ) ; } }
Process requests (descrs) via the periph-supplied CCBs
Process requests ( descrs ) via the periph - supplied CCBs
/* Initiate a transaction using the descr and supplied CCB */ /* If we have more work to do, stay scheduled */