Example #1
0
/*
 * until sgv4 is merged into mainline, we support sgv3 too.
 */
static void sgv3_handler(int fd, int events, void *data)
{
	int i, err;
	struct sg_io_hdr hdrs[64];
	struct tgt_device *dev = data;

	err = read(dev->fd, hdrs, sizeof(struct sg_io_hdr));
	if (err <= 0)
		return;

	for (i = 0; i < 1; i++) {
		struct scsi_cmd *cmd = (void *) (unsigned long) hdrs[i].usr_ptr;

		dprintf("%p %u %u %u %u %u\n", cmd,
			hdrs[i].status, hdrs[i].host_status, hdrs[i].driver_status,
			cmd->len, hdrs[i].resid);

		if (hdrs[i].status) {
			cmd->sense_len = hdrs[i].sb_len_wr;
			cmd->len = 0;
		} else
			cmd->len += hdrs[i].resid;

		target_cmd_io_done(cmd, hdrs[i].status);
	}
}
Example #2
0
File: bs_paio.c Project: wtnb75/tgt
static void bs_paio_endio(int fd, int events, void *data)
{
	struct bs_paio_info *info = data;
	int ret;
	while(1) {
		struct scsi_cmd *cmd;
		ret=read(info->efd[0], &cmd, sizeof(cmd));
		if(ret!=sizeof(cmd)){ break; }
		int result=SAM_STAT_GOOD;

		target_cmd_io_done(cmd, result);
	}
}