FreeBSD/sys/cam/cam_xpt.c
/*
 * Schedule a device to run on a given queue.
 * If the device was inserted as a new entry on the queue,
 * return 1 meaning the device queue should be run. If we
 * were already queued, implying someone else has already
 * started the queue, return 0 so the caller doesn't attempt
 * to run the queue.
 */
Schedule a device to run on a given queue.
If the device was inserted as a new entry on the queue,
return 1 meaning the device queue should be run. If we
were already queued, implying someone else has already
started the queue, return 0 so the caller doesn't attempt
to run the queue.
Schedule a device to run on a given queue . If the device was inserted as a new entry on the queue return 1 meaning the device queue should be run . If we were already queued implying someone else has already started the queue return 0 so the caller doesn ' t attempt to run the queue .
static int
xpt_schedule_dev(struct camq *queue, cam_pinfo *pinfo,
		 u_int32_t new_priority)
{
	int retval;
	u_int32_t old_priority;
	CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_schedule_dev\n"));
	old_priority = pinfo->priority;
	if (pinfo->index != CAM_UNQUEUED_INDEX) {
		if (new_priority < old_priority) {
			camq_change_priority(queue, pinfo->index,
					     new_priority);
			CAM_DEBUG_PRINT(CAM_DEBUG_XPT,
					("changed priority to %d\n",
					 new_priority));
			retval = 1;
		} else
			retval = 0;
	} else {
		if (new_priority < old_priority)
			pinfo->priority = new_priority;
		CAM_DEBUG_PRINT(CAM_DEBUG_XPT,
				("Inserting onto queue\n"));
		pinfo->generation = ++queue->generation;
		camq_insert(queue, pinfo);
		retval = 1;
	}
	return (retval);
}
static int xpt_schedule_dev ( struct camq * queue , cam_pinfo * pinfo , u_int32_t new_priority ) { int retval ; u_int32_t old_priority ; CAM_DEBUG_PRINT ( CAM_DEBUG_XPT , ( " \n " ) ) ; old_priority = pinfo -> priority ; if ( pinfo -> index != CAM_UNQUEUED_INDEX ) { if ( new_priority < old_priority ) { camq_change_priority ( queue , pinfo -> index , new_priority ) ; CAM_DEBUG_PRINT ( CAM_DEBUG_XPT , ( " \n " , new_priority ) ) ; retval = 1 ; } else retval = 0 ; } else { if ( new_priority < old_priority ) pinfo -> priority = new_priority ; CAM_DEBUG_PRINT ( CAM_DEBUG_XPT , ( " \n " ) ) ; pinfo -> generation = ++ queue -> generation ; camq_insert ( queue , pinfo ) ; retval = 1 ; } return ( retval ) ; }
Schedule a device to run on a given queue.
Schedule a device to run on a given queue .
/*
	 * Are we already queued?
	 */ /* Simply reorder based on new priority */ /* New entry on the queue */