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
9e73dffd
Commit
9e73dffd
authored
Oct 28, 2014
by
Victor Kotlyar
Browse files
Revert "Revert "added TEST_UNIT_READY CDB""
This reverts commit
97bd05cb
.
parent
97bd05cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/SCSI/Structures.hpp
View file @
9e73dffd
...
...
@@ -725,6 +725,32 @@ namespace SCSI {
unsigned
char
control
;
// Control byte
};
/**
* TEST UNIT READY as described in SPC-4.
*/
class
testUnitReadyCDB_t
{
public:
testUnitReadyCDB_t
()
{
zeroStruct
(
this
);
opCode
=
SCSI
::
Commands
::
TEST_UNIT_READY
;
}
// byte 0
unsigned
char
opCode
;
// OPERATION CODE (00h)
// byte 1
unsigned
char
:
8
;
// Reserved
// byte 2
unsigned
char
EDCC
:
1
;
// Enable Deferred CHECK CONDITION (IBM only)
unsigned
char
:
7
;
// Reserved
// byte 3-4
unsigned
char
reserverd
[
2
];
// Reserved
// byte 5
unsigned
char
control
;
// Control byte
};
/**
* Part of a tape alert log page.
* This structure does not need to be initialized, as the containing structure
...
...
castor/tape/tapeserver/SCSI/StructuresTest.cpp
View file @
9e73dffd
...
...
@@ -705,5 +705,33 @@ namespace unitTests {
ASSERT_EQ
(
0x04U
,
logParam
.
header
.
parameterLength
);
ASSERT_EQ
(
4280431428ULL
,
logParam
.
getU64Value
());
ASSERT_EQ
(
-
14535868LL
,
logParam
.
getS64Value
());
}
TEST
(
castor_tape_SCSI_Structures
,
testUnitReadyCDB_t
)
{
castor
::
tape
::
SCSI
::
Structures
::
testUnitReadyCDB_t
testUnitReadyCDB
;
unsigned
char
*
buff
=
(
unsigned
char
*
)
&
testUnitReadyCDB
;
/*
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ
(
6U
,
sizeof
(
testUnitReadyCDB
));
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
ASSERT_EQ
(
castor
::
tape
::
SCSI
::
Commands
::
TEST_UNIT_READY
,
testUnitReadyCDB
.
opCode
);
buff
[
0
]
=
0xAB
;
ASSERT_EQ
(
0xABU
,
testUnitReadyCDB
.
opCode
);
buff
[
1
]
=
0xFF
;
ASSERT_EQ
(
0
,
testUnitReadyCDB
.
EDCC
);
buff
[
2
]
|=
(
0x01
&
0xFF
)
<<
0
;
ASSERT_EQ
(
0x1U
,
testUnitReadyCDB
.
EDCC
);
buff
[
3
]
=
buff
[
4
]
=
0xFF
;
ASSERT_EQ
(
0U
,
testUnitReadyCDB
.
control
);
buff
[
5
]
|=
0xCD
;
ASSERT_EQ
(
0xCDU
,
testUnitReadyCDB
.
control
);
}
}
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