[stgt] [PATCH] SBC add support for removable SBC devices
ronnie sahlberg
ronniesahlberg at gmail.com
Fri Jan 27 05:51:44 CET 2012
On Fri, Jan 27, 2012 at 3:11 PM, FUJITA Tomonori
<fujita.tomonori at lab.ntt.co.jp> wrote:
> On Fri, 27 Jan 2012 15:01:27 +1100
> ronnie sahlberg <ronniesahlberg at gmail.com> wrote:
>
>> From 9875346857c9d1c383c5da91b0f9cb097fe068cf Mon Sep 17 00:00:00 2001
>> From: Ronnie Sahlberg <ronniesahlberg at gmail.com>
>> Date: Thu, 26 Jan 2012 11:05:09 +1100
>> Subject: [PATCH] SBC: Support removable devices for SBC
>>
>> SBC supports removable devices.
>> See SBC 4.3.1 REMOVABLE MEDIUM OVERVIEW
>>
>> TEST UNIT READY, START STOP UNIT and PREVENT ALLOW MEDIUM REMOVAL
>> already provide the required behaviour described in 4.3.1
>>
>> This patch adds support for the SBC medium access opcodes to return
>> check condition/not ready/medium not present
>> for any calls when the devie is set in offline mode.
>>
>> regards
>> ronnie sahlberg
>>
>> Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
>> ---
>> usr/sbc.c | 35 ++++++++++++++++++++++++++++++++++-
>> 1 files changed, 34 insertions(+), 1 deletions(-)
>>
>> diff --git a/usr/sbc.c b/usr/sbc.c
>> index 8330291..b96cc7a 100644
>> --- a/usr/sbc.c
>> +++ b/usr/sbc.c
>> @@ -154,6 +154,12 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
>> if (ret)
>> return SAM_STAT_RESERVATION_CONFLICT;
>>
>> + if (cmd->dev->attrs.removable && !cmd->dev->attrs.online) {
>
> Only if cmd->dev->attrs.removable is true, cmd->dev->attrs.online can
> be true? No?
For SBC I think it makes sense to have this extra check.
.removable is used in the INQUIRY command to tell the initiator that
this is a removable device.
SSC and MMC I think all initiators know already/assume that all such
devices are always removable
so maybe they dont even look at the standard inquiry data.
For SBC I think we should only allow it to become "no media loaded" if
the removable flag is set.
I think of it as "if removable flag is set, I already told you this is
a removable device, so you should not be 'surprised'
once/if a command starts to fail with 'no medium in device'"
Maybe we should add the extra check for .removable to MMC and SSC too?
but those devices should always be removable==1 anyway.
regards
ronnie sahlberg
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list