[Stgt-devel] [PATCH 3/4] block/primary separation
Ming Zhang
blackmagic02881
Mon Jan 22 20:26:25 CET 2007
On Mon, 2007-01-22 at 14:04 -0500, Pete Wyckoff wrote:
<snip>
>
> + /*
> + * Generic SPC commands
> + */
> switch (scb[0]) {
> case INQUIRY:
> + data = get_zeroed_page();
> result = inquiry(lid, dev, host_no, lun_buf, scb, data, len);
> - break;
> + goto out;
> case REPORT_LUNS:
> *len = datalen;
> + data = get_zeroed_page();
> result = report_luns(lid, dev_list, lun_buf, scb, data, len);
> - break;
> - case READ_CAPACITY:
> - result = read_capacity(dev, scb, data, len);
> - break;
> - case MODE_SENSE:
> - result = mode_sense(dev, scb, data, len);
> - break;
> + goto out;
> case REQUEST_SENSE:
> + data = get_zeroed_page();
> result = request_sense(data, len);
> - break;
> - case SERVICE_ACTION_IN:
> - result = sevice_action(dev, scb, data, len);
> - break;
> - case SYNCHRONIZE_CACHE:
> - result = sync_cache(dev, data, len);
> - break;
> - case START_STOP:
> + goto out;
> case TEST_UNIT_READY:
> - case VERIFY:
> *len = 0;
> - break;
> - case READ_6:
> - case READ_10:
> - case READ_16:
> - case WRITE_6:
> - case WRITE_10:
> - case WRITE_16:
> - case WRITE_VERIFY:
> - *offset = scsi_cmd_data_offset(scb);
> - result = submit(dev, scb, *rw, datalen, uaddr, *offset, async, key);
> - if (result == SAM_STAT_GOOD) {
> - *len = datalen;
> - *try_map = 1;
> - } else {
> - *rw = READ;
> - *offset = 0;
> - if (!data)
> - data = valloc(PAGE_SIZE);
> - *len = sense_data_build(data, 0x70, ILLEGAL_REQUEST,
> - 0x25, 0);
> - }
> - break;
> + goto out;
> case RESERVE:
> case RESERVE_10:
> result = device_reserve(nid, dev->lun, nid);
> if (result)
> result = SAM_STAT_RESERVATION_CONFLICT;
> *len = 0;
> - break;
> + goto out;
> case RELEASE:
> case RELEASE_10:
> result = device_release(nid, dev->lun, host_no, 0);
> if (result)
> result = SAM_STAT_RESERVATION_CONFLICT;
> *len = 0;
> - break;
> - default:
> - eprintf("unknown command %x %u\n", scb[0], datalen);
> - *len = 0;
> - break;
> + goto out;
from switch will goto out and then return? when this target specific
command processing will be called?
> }
>
> + /*
> + * Specific device command set
> + */
> + if (target_type == SCSI_TARGET_SBC)
> + result = block_cmd_perform(scb, len, datalen, uaddr, rw,
> + try_map, offset, dev, async, key,
> + submit);
> + else
> + eprintf("unknown target type %d\n", target_type);
> +
> out:
> if (data)
> *uaddr = (unsigned long) data;
>
> return result;
> }
> +
--
http://blackmagic02881.wordpress.com/
More information about the stgt
mailing list