[stgt] [PATCH 4/8] In sbc.c implementation of synchronize cache, set resid to 0 unconditionally and remove unused len=0, as const zero is used in set resid
nezhinsky at gmail.com
nezhinsky at gmail.com
Wed Apr 25 16:52:17 CEST 2012
- Previous message: [stgt] [PATCH 3/8] Store iscsi initiator alias in connection, copy it to iscsi session, show it in session info
- Next message: [stgt] [PATCH 5/8] Improve str_to_int() There is a potential problem when a user-supplied value overflows the accepting variable; to cope with this the string is converted to a 64-bit value first then assigned to the variable, then the macro checks if they represent the same value. Thus the natural type boundaries are automatically guarded. This means that there is no need to use type's range limits (e.g. 0 and USHRT_MAX for unsigned short). Thus the range limit parameters are removed from str_to_int() -- it's enough for the (most frequent) cases when any value fitting a certain integer type is admissible. When the min/max values are relevant they can be passed to one of the new macros str_to_int_gt, str_to_int_ge, str_to_int_lt, str_to_int_range, requiring that the int value should be greater than, greater or equal, less than, or within a range, correspondingly.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
From: Alexander Nezhinsky <alexandern at mellanox.com>
Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
usr/sbc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr/sbc.c b/usr/sbc.c
index 55145cf..7312c5d 100644
--- a/usr/sbc.c
+++ b/usr/sbc.c
@@ -439,13 +439,15 @@ sense:
static int sbc_sync_cache(int host_no, struct scsi_cmd *cmd)
{
- int ret, len;
+ int ret;
uint8_t key = ILLEGAL_REQUEST;
uint16_t asc = ASC_LUN_NOT_SUPPORTED;
if (device_reserved(cmd))
return SAM_STAT_RESERVATION_CONFLICT;
+ scsi_set_in_resid_by_actual(cmd, 0);
+
if (cmd->dev->attrs.removable && !cmd->dev->attrs.online) {
key = NOT_READY;
asc = ASC_MEDIUM_NOT_PRESENT;
@@ -466,12 +468,10 @@ static int sbc_sync_cache(int host_no, struct scsi_cmd *cmd)
asc = ASC_INTERNAL_TGT_FAILURE;
goto sense;
default:
- len = 0;
return SAM_STAT_GOOD;
}
sense:
- scsi_set_in_resid_by_actual(cmd, 0);
sense_data_build(cmd, key, asc);
return SAM_STAT_CHECK_CONDITION;
}
--
1.7.9.6
--
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
- Previous message: [stgt] [PATCH 3/8] Store iscsi initiator alias in connection, copy it to iscsi session, show it in session info
- Next message: [stgt] [PATCH 5/8] Improve str_to_int() There is a potential problem when a user-supplied value overflows the accepting variable; to cope with this the string is converted to a 64-bit value first then assigned to the variable, then the macro checks if they represent the same value. Thus the natural type boundaries are automatically guarded. This means that there is no need to use type's range limits (e.g. 0 and USHRT_MAX for unsigned short). Thus the range limit parameters are removed from str_to_int() -- it's enough for the (most frequent) cases when any value fitting a certain integer type is admissible. When the min/max values are relevant they can be passed to one of the new macros str_to_int_gt, str_to_int_ge, str_to_int_lt, str_to_int_range, requiring that the int value should be greater than, greater or equal, less than, or within a range, correspondingly.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the stgt
mailing list