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
fa14810e
Commit
fa14810e
authored
Jun 26, 2020
by
Cedric Caffy
Browse files
[lto_rao] Corrected the readEndOfWrapPositionDataLongForm_t::getNbWrapsReturned()
parent
cad4ea91
Changes
3
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/SCSI/Structures.hpp
View file @
fa14810e
...
...
@@ -1218,7 +1218,7 @@ namespace SCSI {
unsigned
char
reserved
[
2
];
// Reserved
// bytes 4-n
struct
{
struct
WrapDescriptor
{
unsigned
char
wrapNumber
[
2
];
// Wrap number
unsigned
char
partition
[
2
];
// The partition number of the above wrap
unsigned
char
reserved
[
2
];
// Reserved
...
...
@@ -1226,7 +1226,7 @@ namespace SCSI {
}
wrapDescriptor
[
maxLTOTapeWraps
];
// Array of wrap descriptiors
uint16_t
getNbWrapsReturned
(){
return
(
SCSI
::
Structures
::
toU16
(
responseDataLength
)
/
sizeof
(
w
rapDescriptor
));
return
(
(
SCSI
::
Structures
::
toU16
(
responseDataLength
)
-
sizeof
(
reserved
))
/
sizeof
(
W
rapDescriptor
));
}
};
...
...
tapeserver/castor/tape/tapeserver/SCSI/StructuresTest.cpp
View file @
fa14810e
...
...
@@ -971,8 +971,9 @@ namespace unitTests {
// Check proper initialization and location of struct members match the bit/byte locations defined in LTO-8 reference
ASSERT_EQ
(
0U
,
castor
::
tape
::
SCSI
::
Structures
::
toU16
(
readEndOfWrapPositionDataLongForm
.
responseDataLength
));
buff
[
0
]
=
0x0A
;
buff
[
1
]
=
0xB0
;
ASSERT_EQ
(
0xAB0
,
castor
::
tape
::
SCSI
::
Structures
::
toU16
(
readEndOfWrapPositionDataLongForm
.
responseDataLength
));
//Assume we have maxLTOTapeWraps returned * 12 bytes = 3362 = 0x0D22
buff
[
0
]
=
0x0D
;
buff
[
1
]
=
0x22
;
ASSERT_EQ
(
0x0D22
,
castor
::
tape
::
SCSI
::
Structures
::
toU16
(
readEndOfWrapPositionDataLongForm
.
responseDataLength
));
for
(
unsigned
int
wrap
=
0
;
wrap
<
castor
::
tape
::
SCSI
::
maxLTOTapeWraps
;
++
wrap
)
{
int
offset
=
4
+
(
wrap
*
12
);
...
...
@@ -996,6 +997,8 @@ namespace unitTests {
buff
[
offset
+
9
]
=
0x12
;
buff
[
offset
+
10
]
=
0x34
;
buff
[
offset
+
11
]
=
0x56
;
ASSERT_EQ
(
0xABCDEF123456
,
castor
::
tape
::
SCSI
::
Structures
::
toU64
(
readEndOfWrapPositionDataLongForm
.
wrapDescriptor
[
wrap
].
logicalObjectIdentifier
));
}
ASSERT_EQ
(
castor
::
tape
::
SCSI
::
maxLTOTapeWraps
,
readEndOfWrapPositionDataLongForm
.
getNbWrapsReturned
());
}
TEST
(
castor_tape_SCSI_Structures
,
requestSenseCDB_t
)
{
...
...
tapeserver/castor/tape/tapeserver/drive/FakeDrive.cpp
View file @
fa14810e
...
...
@@ -99,7 +99,13 @@ castor::tape::tapeserver::drive::physicalPositionInfo castor::tape::tapeserver::
}
std
::
vector
<
castor
::
tape
::
tapeserver
::
drive
::
endOfWrapPosition
>
castor
::
tape
::
tapeserver
::
drive
::
FakeDrive
::
getEndOfWrapPositions
()
{
return
std
::
vector
<
castor
::
tape
::
tapeserver
::
drive
::
endOfWrapPosition
>
();
endOfWrapPosition
eowp
;
eowp
.
blockId
=
1
;
eowp
.
partition
=
1
;
eowp
.
wrapNumber
=
1
;
std
::
vector
<
endOfWrapPosition
>
ret
;
ret
.
push_back
(
eowp
);
return
ret
;
}
std
::
vector
<
uint16_t
>
castor
::
tape
::
tapeserver
::
drive
::
FakeDrive
::
getTapeAlertCodes
()
{
...
...
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