FreeBSD/sys/cam/scsi/scsi_target.c
/*
 * Create softc and initialize it.  There is no locking here because a
 * periph doesn't get created until an ioctl is issued to do so, and
 * that can't happen until this method returns.
 */
Create softc and initialize it.  There is no locking here because a
periph doesn't get created until an ioctl is issued to do so, and
that can't happen until this method returns.
Create softc and initialize it . There is no locking here because a periph doesn ' t get created until an ioctl is issued to do so and that can ' t happen until this method returns .
static int
targopen(struct cdev *dev, int flags, int fmt, struct thread *td)
{
	struct targ_softc *softc;
	softc = malloc(sizeof(*softc), M_TARG,
	       M_WAITOK | M_ZERO);
	softc->state = TARG_STATE_OPENED;
	softc->periph = NULL;
	softc->path = NULL;
	TAILQ_INIT(&softc->pending_ccb_queue);
	TAILQ_INIT(&softc->work_queue);
	TAILQ_INIT(&softc->abort_queue);
	TAILQ_INIT(&softc->user_ccb_queue);
	knlist_init_mtx(&softc->read_select.si_note, NULL);
	devfs_set_cdevpriv(softc, targcdevdtor);
	return (0);
}
static int targopen ( struct cdev * dev , int flags , int fmt , struct thread * td ) { struct targ_softc * softc ; softc = malloc ( sizeof ( * softc ) , M_TARG , M_WAITOK | M_ZERO ) ; softc -> state = TARG_STATE_OPENED ; softc -> periph = NULL ; softc -> path = NULL ; TAILQ_INIT ( & softc -> pending_ccb_queue ) ; TAILQ_INIT ( & softc -> work_queue ) ; TAILQ_INIT ( & softc -> abort_queue ) ; TAILQ_INIT ( & softc -> user_ccb_queue ) ; knlist_init_mtx ( & softc -> read_select . si_note , NULL ) ; devfs_set_cdevpriv ( softc , targcdevdtor ) ; return ( 0 ) ; }
Create softc and initialize it.
Create softc and initialize it .
/* Allocate its softc, initialize it */