device = stgt_device_find(target, cmnd->lun); if (!device) { switch (cmnd->scb[0]) { case INQUIRY: case REPORT_LUNS: break; default: eprintk("FIXME: access to nonexistent lun %u\n", cmnd->lun); cmnd_done(cmnd); break; } }
static void queuecommand(void *data){	int err;	enum stgt_cmnd_type type = STGT_CMND_USPACE;	struct stgt_cmnd *cmnd = (struct stgt_cmnd *) data;	struct stgt_target *target = cmnd->session->target;	struct stgt_device *device;	dprintk("%x\n", cmnd->scb[0]);	/* Should we do this earlier? */	device = stgt_device_find(target, cmnd->lun);	if (!device) {		switch (cmnd->scb[0]) {		case INQUIRY:		case REPORT_LUNS:			break;		default:			eprintk("FIXME: access to nonexistent lun %u\n",				cmnd->lun);			cmnd_done(cmnd);			break;		}	}	/*	 * seperate vsd (virtual disk from sd (real sd))	 * call scsi_device_temaplte->prepcommand to see if they want it	 * and allow them to setup.	 *	 * Then call queuecommand	 */	if (device)		dprintk("found %u\n", cmnd->lun);	if (device && device->sdt->prepcommand)		type = device->sdt->prepcommand(device, cmnd);	switch (type) {	case STGT_CMND_KSPACE:		err = device->sdt->queuecommand(device, cmnd);		cmnd_done(cmnd);		break;	case STGT_CMND_USPACE:		err = uspace_cmnd_send(cmnd);		break;	default:		break;	}}