Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
abb09009
Commit
abb09009
authored
Aug 07, 2013
by
Eric Cano
Browse files
Added value of response code when sense fails ASC/ASCQ lookup.
parent
14da618a
Changes
2
Hide whitespace changes
Inline
Side-by-side
SCSI/Structures.hh
View file @
abb09009
...
...
@@ -776,7 +776,10 @@ namespace SCSI {
}
else
if
(
isDescriptorFormat
())
{
return
descriptorFormat
.
ASC
;
}
else
{
throw
Tape
::
Exception
(
"In senseData_t::getASC: no ACS with this response code or response code not supported"
);
std
::
stringstream
err
;
err
<<
"In senseData_t::getASC: no ACS with this response code or response code not supported ("
<<
std
::
hex
<<
std
::
showbase
<<
(
int
)
responseCode
<<
")"
;
throw
Tape
::
Exception
(
err
.
str
());
}
}
...
...
@@ -786,7 +789,10 @@ namespace SCSI {
}
else
if
(
isDescriptorFormat
())
{
return
descriptorFormat
.
ASCQ
;
}
else
{
throw
Tape
::
Exception
(
"In senseData_t::getASCQ: no ACSQ with this response code or response code not supported"
);
std
::
stringstream
err
;
err
<<
"In senseData_t::getASCQ: no ACSQ with this response code or response code not supported ("
<<
std
::
hex
<<
std
::
showbase
<<
(
int
)
responseCode
<<
")"
;
throw
Tape
::
Exception
(
err
.
str
());
}
}
/**
...
...
@@ -815,6 +821,7 @@ namespace SCSI {
snprintf
(
buff
,
sizeof
(
buff
),
"Unknown ASC/ASCQ:%02x/%02x"
,
asc
,
ascq
);
return
std
::
string
(
buff
);
}
/* TODO: add support for sense key */
};
template
<
size_t
n
>
...
...
SCSI/StructuresTest.cc
View file @
abb09009
...
...
@@ -537,6 +537,12 @@ namespace UnitTests {
ASSERT_THROW
(
sense
.
getASC
(),
Tape
::
Exception
);
ASSERT_THROW
(
sense
.
getACSString
(),
Tape
::
Exception
);
try
{
sense
.
getACSString
();
ASSERT_TRUE
(
false
);
}
catch
(
Tape
::
Exception
&
ex
)
{
std
::
string
what
(
ex
.
shortWhat
());
ASSERT_NE
(
std
::
string
::
npos
,
what
.
find
(
"response code not supported (0x74)"
));
}
}
TEST
(
SCSI_Structures
,
toU16
)
{
...
...
@@ -576,7 +582,7 @@ namespace UnitTests {
sense
.
fixedFormat
.
ASC
=
0x14
;
sense
.
fixedFormat
.
ASCQ
=
0x04
;
ASSERT_THROW
(
SCSI
::
ExceptionLauncher
(
sgio
),
SCSI
::
Exception
);
try
{
SCSI
::
ExceptionLauncher
(
sgio
,
"In exception validation:"
);
}
try
{
SCSI
::
ExceptionLauncher
(
sgio
,
"In exception validation:"
);
ASSERT_TRUE
(
false
);
}
catch
(
SCSI
::
Exception
&
ex
)
{
std
::
string
what
(
ex
.
shortWhat
());
ASSERT_NE
(
std
::
string
::
npos
,
what
.
find
(
"Block sequence error"
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment