FreeBSD/sys/cam/scsi/scsi_target.c
/* Disable LUN if enabled and teardown softc */
Disable LUN if enabled and teardown softc
Disable LUN if enabled and teardown softc
static void
targcdevdtor(void *data)
{
	struct targ_softc *softc;
	struct cam_periph *periph;
	softc = data;
	if (softc->periph == NULL) {
		printf("%s: destroying non-enabled target\n", __func__);
		free(softc, M_TARG);
		return;
	}
	periph = softc->periph;
	cam_periph_acquire(periph);
	cam_periph_lock(periph);
	(void)targdisable(softc);
	if (softc->periph != NULL) {
		cam_periph_invalidate(softc->periph);
		softc->periph = NULL;
	}
	cam_periph_unlock(periph);
	cam_periph_release(periph);
	free(softc, M_TARG);
}
static void targcdevdtor ( void * data ) { struct targ_softc * softc ; struct cam_periph * periph ; softc = data ; if ( softc -> periph == NULL ) { printf ( " \n " , __func__ ) ; free ( softc , M_TARG ) ; return ; } periph = softc -> periph ; cam_periph_acquire ( periph ) ; cam_periph_lock ( periph ) ; ( void ) targdisable ( softc ) ; if ( softc -> periph != NULL ) { cam_periph_invalidate ( softc -> periph ) ; softc -> periph = NULL ; } cam_periph_unlock ( periph ) ; cam_periph_release ( periph ) ; free ( softc , M_TARG ) ; }
Disable LUN if enabled and teardown softc
Disable LUN if enabled and teardown softc
/*
	 * Acquire a hold on the periph so that it doesn't go away before
	 * we are ready at the end of the function.
	 */