mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
Parse errors processing cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4215 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -199,12 +199,16 @@ static int cdrom_get_block_shift(struct scst_cmd *cmd)
|
||||
|
||||
static int cdrom_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_cdrom_generic_parse(cmd, cdrom_get_block_shift);
|
||||
rc = scst_cdrom_generic_parse(cmd, cdrom_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +122,16 @@ void changer_detach(struct scst_device *dev)
|
||||
|
||||
static int changer_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_changer_generic_parse(cmd, NULL);
|
||||
rc = scst_changer_generic_parse(cmd, NULL);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,12 +291,16 @@ static int disk_get_block_shift(struct scst_cmd *cmd)
|
||||
|
||||
static int disk_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_sbc_generic_parse(cmd, disk_get_block_shift);
|
||||
rc = scst_sbc_generic_parse(cmd, disk_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,12 +297,16 @@ static int modisk_get_block_shift(struct scst_cmd *cmd)
|
||||
|
||||
static int modisk_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_modisk_generic_parse(cmd, modisk_get_block_shift);
|
||||
rc = scst_modisk_generic_parse(cmd, modisk_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +122,16 @@ void processor_detach(struct scst_device *dev)
|
||||
|
||||
static int processor_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_processor_generic_parse(cmd, NULL);
|
||||
rc = scst_processor_generic_parse(cmd, NULL);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +122,16 @@ void raid_detach(struct scst_device *dev)
|
||||
|
||||
static int raid_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_raid_generic_parse(cmd, NULL);
|
||||
rc = scst_raid_generic_parse(cmd, NULL);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,12 +284,16 @@ static int tape_get_block_size(struct scst_cmd *cmd)
|
||||
|
||||
static int tape_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
scst_tape_generic_parse(cmd, tape_get_block_size);
|
||||
rc = scst_tape_generic_parse(cmd, tape_get_block_size);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->retries = SCST_PASSTHROUGH_RETRIES;
|
||||
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -788,8 +788,10 @@ static int dev_user_parse(struct scst_cmd *cmd)
|
||||
case SCST_USER_PARSE_STANDARD:
|
||||
TRACE_DBG("PARSE STANDARD: ucmd %p", ucmd);
|
||||
rc = dev->generic_parse(cmd, dev_user_get_block);
|
||||
if (rc != 0)
|
||||
goto out_invalid;
|
||||
if (rc != 0) {
|
||||
PRINT_ERROR("PARSE failed (ucmd %p, rc %d)", ucmd, rc);
|
||||
goto out_error;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCST_USER_PARSE_EXCEPTION:
|
||||
@@ -855,10 +857,6 @@ out:
|
||||
TRACE_EXIT_RES(res);
|
||||
return res;
|
||||
|
||||
out_invalid:
|
||||
PRINT_ERROR("PARSE failed (ucmd %p, rc %d)", ucmd, rc);
|
||||
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode));
|
||||
|
||||
out_error:
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
|
||||
@@ -1282,21 +1282,45 @@ static int vdisk_get_block_shift(struct scst_cmd *cmd)
|
||||
|
||||
static int vdisk_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
scst_sbc_generic_parse(cmd, vdisk_get_block_shift);
|
||||
return fileio_alloc_and_parse(cmd);
|
||||
int res, rc;
|
||||
|
||||
rc = scst_sbc_generic_parse(cmd, vdisk_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
res = fileio_alloc_and_parse(cmd);
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
static int vcdrom_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
scst_cdrom_generic_parse(cmd, vdisk_get_block_shift);
|
||||
return fileio_alloc_and_parse(cmd);
|
||||
int res, rc;
|
||||
rc = scst_cdrom_generic_parse(cmd, vdisk_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
res = fileio_alloc_and_parse(cmd);
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* blockio and nullio */
|
||||
static int non_fileio_parse(struct scst_cmd *cmd)
|
||||
{
|
||||
scst_sbc_generic_parse(cmd, vdisk_get_block_shift);
|
||||
return SCST_CMD_STATE_DEFAULT;
|
||||
int res = SCST_CMD_STATE_DEFAULT, rc;
|
||||
|
||||
rc = scst_sbc_generic_parse(cmd, vdisk_get_block_shift);
|
||||
if (rc != 0) {
|
||||
res = scst_get_cmd_abnormal_done_state(cmd);
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
|
||||
Reference in New Issue
Block a user