From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> This patch adds bs_sg_init() that is called from existing usr/target.c:tgt_device_create() code via struct backingstore_template->bs_init() in order to setup the passthrough specific queue and completion handlers for struct scsi_lu->cmd_perform() and ->cmd_done(). Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx> --- usr/bs_sg.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/usr/bs_sg.c b/usr/bs_sg.c index 8baa480..2fcb0d2 100644 --- a/usr/bs_sg.c +++ b/usr/bs_sg.c @@ -192,6 +192,25 @@ static int init_sg_device(int fd) return 0; } +static int bs_sg_init(struct scsi_lu *lu) +{ + /* + * Setup struct scsi_lu->cmd_perform() passthrough pointer + * (if available) for the underlying device type. + */ + lu->cmd_perform = &target_cmd_perform_passthrough; + if (!(lu->cmd_perform)) { + eprintf("Unable to locate lu->cmd_perform() for bs_sg\n"); + return -1; + } + /* + * Setup struct scsi_lu->cmd_done() passthrough pointer using + * usr/target.c:__cmd_done_passthrough(). + */ + lu->cmd_done = &__cmd_done_passthrough; + return 0; +} + static int bs_sg_open(struct scsi_lu *lu, char *path, int *fd, uint64_t *size) { int sg_fd, err; @@ -238,6 +257,7 @@ static int bs_sg_cmd_done(struct scsi_cmd *cmd) static struct backingstore_template sg_bst = { .bs_name = "sg", .bs_datasize = 0, + .bs_init = bs_sg_init, .bs_open = bs_sg_open, .bs_close = bs_sg_close, .bs_cmd_submit = bs_sg_cmd_submit, -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html