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
19142144
Commit
19142144
authored
Aug 05, 2013
by
Victor Kotlyar
Browse files
added exception for an overflow in getPositionInfo
(CASTOR way was just to fill everything with 0)
parent
b6ec11f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Drive/Drive.hh
View file @
19142144
...
...
@@ -166,7 +166,7 @@ namespace Tape {
*/
virtual
void
positionToLogicalObject
(
uint32_t
blockId
)
throw
(
Exception
)
{
SCSI
::
Structures
::
locate10CDB_t
cdb
;
uint32_t
blkId
=
ntohl
(
blockId
);
uint32_t
blkId
=
SCSI
::
Structures
::
fromLtoB32
(
blockId
);
memcpy
(
cdb
.
logicalObjectID
,
&
blkId
,
sizeof
(
cdb
.
logicalObjectID
));
...
...
@@ -220,10 +220,13 @@ namespace Tape {
posInfo
.
dirtyObjectsCount
=
SCSI
::
Structures
::
toU32
(
positionData
.
blocksInBuffer
);
posInfo
.
dirtyBytesCount
=
SCSI
::
Structures
::
toU32
(
positionData
.
bytesInBuffer
);
}
else
{
posInfo
.
currentPosition
=
0
;
posInfo
.
oldestDirtyObject
=
0
;
posInfo
.
dirtyObjectsCount
=
0
;
posInfo
.
dirtyBytesCount
=
0
;
/* An overflow has occurred in at least one of the returned position
* data fields. The application should use the LONG FORM to obtain the
* current position or the application should use the EXTENDED FORM to
* obtain the current position and number of bytes in the object buffer.
* (note) For T10000 we have only SHORT FORM.
*/
throw
Tape
::
Exception
(
std
::
string
(
"An overflow has occurred in getPostitionInfo"
));
}
return
posInfo
;
}
...
...
SCSI/Structures.hh
View file @
19142144
...
...
@@ -133,6 +133,17 @@ namespace SCSI {
return
(
int32_t
)(
ntohl
(
*
((
uint32_t
*
)
t
)));
}
/**
* Helper function to convert from little-endian to big-endian.
* @param t a 32 bit number in the little-endian form
* @return a 32 bit number in the big-endian form
*/
inline
uint32_t
fromLtoB32
(
uint32_t
t
)
{
/* Like network, SCSI is BigEndian */
return
htonl
(
t
);
}
/**
* Helper function to deal with endianness.
* @param t byte array in SCSI order representing a 16 bits number
...
...
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