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
6a872c9e
Commit
6a872c9e
authored
Jun 05, 2020
by
Steven Murray
Committed by
Cedric Caffy
Jun 10, 2020
Browse files
RequestMessage::processMediaType_Add() now handles optional parameters, for example 'nbWraps'.
parent
264169d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
xroot_plugins/XrdSsiCtaRequestMessage.cpp
View file @
6a872c9e
...
...
@@ -1192,13 +1192,13 @@ void RequestMessage::processMediaType_Add(cta::xrd::Response &response)
using
namespace
cta
::
admin
;
// Bounds check unsigned integer options less than 64-bits in width
const
uint64_t
nbWraps
=
get
Required
(
OptionUInt64
::
NUMBER_OF_WRAPS
);
const
auto
nbWraps
=
get
Optional
(
OptionUInt64
::
NUMBER_OF_WRAPS
);
const
uint64_t
primaryDensityCode
=
getRequired
(
OptionUInt64
::
PRIMARY_DENSITY_CODE
);
const
uint64_t
secondaryDensityCode
=
getRequired
(
OptionUInt64
::
SECONDARY_DENSITY_CODE
);
if
(
nbWraps
>
std
::
numeric_limits
<
uint32_t
>::
max
())
{
if
(
nbWraps
&&
nbWraps
.
value
()
>
std
::
numeric_limits
<
uint32_t
>::
max
())
{
exception
::
UserError
ex
;
ex
.
getMessage
()
<<
"Number of wraps cannot be larger than "
<<
std
::
numeric_limits
<
uint32_t
>::
max
()
<<
": value="
<<
nbWraps
;
<<
nbWraps
.
value
()
;
throw
ex
;
}
if
(
primaryDensityCode
>
std
::
numeric_limits
<
uint8_t
>::
max
())
{
...
...
@@ -1218,11 +1218,11 @@ void RequestMessage::processMediaType_Add(cta::xrd::Response &response)
mediaType
.
name
=
getRequired
(
OptionString
::
MEDIA_TYPE
);
mediaType
.
cartridge
=
getRequired
(
OptionString
::
CARTRIDGE
);
mediaType
.
capacityInBytes
=
getRequired
(
OptionUInt64
::
CAPACITY
);
mediaType
.
primaryDensityCode
=
getRequired
(
OptionUInt64
::
PRIMARY_DENSITY_CODE
)
;
mediaType
.
secondaryDensityCode
=
getRequired
(
OptionUInt64
::
SECONDARY_DENSITY_CODE
)
;
mediaType
.
nbWraps
=
getRequired
(
OptionUInt64
::
NUMBER_OF_WRAPS
);
mediaType
.
minLPos
=
get
Required
(
OptionUInt64
::
MIN_LPOS
);
mediaType
.
maxLPos
=
get
Required
(
OptionUInt64
::
MAX_LPOS
);
mediaType
.
primaryDensityCode
=
primaryDensityCode
;
mediaType
.
secondaryDensityCode
=
secondaryDensityCode
;
if
(
nbWraps
)
mediaType
.
nbWraps
=
nbWraps
.
value
(
);
mediaType
.
minLPos
=
get
Optional
(
OptionUInt64
::
MIN_LPOS
);
mediaType
.
maxLPos
=
get
Optional
(
OptionUInt64
::
MAX_LPOS
);
mediaType
.
comment
=
getRequired
(
OptionString
::
COMMENT
);
m_catalogue
.
createMediaType
(
m_cliIdentity
,
mediaType
);
...
...
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