Commit cf87edc6 authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger

target/user: Update example code for new ABI requirements

We now require that the userspace handler set a bit if the command is not
handled.

Update calls to tcmu_hdr_get_op for v2.
Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
Reviewed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 5a7125c6
...@@ -324,7 +324,7 @@ int handle_device_events(int fd, void *map) ...@@ -324,7 +324,7 @@ int handle_device_events(int fd, void *map)
/* Process events from cmd ring until we catch up with cmd_head */ /* Process events from cmd ring until we catch up with cmd_head */
while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) { while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) {
if (tcmu_hdr_get_op(&ent->hdr) == TCMU_OP_CMD) { if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) {
uint8_t *cdb = (void *)mb + ent->req.cdb_off; uint8_t *cdb = (void *)mb + ent->req.cdb_off;
bool success = true; bool success = true;
...@@ -339,8 +339,12 @@ int handle_device_events(int fd, void *map) ...@@ -339,8 +339,12 @@ int handle_device_events(int fd, void *map)
ent->rsp.scsi_status = SCSI_CHECK_CONDITION; ent->rsp.scsi_status = SCSI_CHECK_CONDITION;
} }
} }
else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) {
/* Tell the kernel we didn't handle unknown opcodes */
ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP;
}
else { else {
/* Do nothing for PAD entries */ /* Do nothing for PAD entries except update cmd_tail */
} }
/* update cmd_tail */ /* update cmd_tail */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment