From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: stgt-devel <stgt@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Mike Christie <michaelc@cs.wisc.edu>, Boaz Harrosh <bharr>
Cc: James Bottomley <James.Bottomley@suse.de>,
Douglas Gilbert <dgilbert@interlog.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 2/2] [bs_sg]: Add bs_sg_init() for STGT LUN passthrough
Date: Tue, 1 Jun 2010 01:50:52 -0700 [thread overview]
Message-ID: <1275382252-17689-1-git-send-email-nab@linux-iscsi.org> (raw)
From: Nicholas Bellinger <nab@linux-iscsi.org>
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@linux-iscsi.org>
---
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
reply other threads:[~2010-06-01 8:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1275382252-17689-1-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@suse.de \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=stgt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).