staging: unisys: refactor ULTRA_CONTROLVM_PARAMETERS_HEADER
Remove the typedef from ULTRA_CONTROLVM_PARAMETERS_HEADER, and use struct spar_controlvm_parameters_header instead. Fix CamelCase names in the structure, and update references to fixed names in other files and the comments. TotalLength => total_length HeaderLength => header_length ConnectionOffset => connection_offset ConnectionLength => connection_length InitiatorOffset => initiator_offset InitiatorLength => initiator_length TargetOffset => target_offset TargetLength => target_length ClientOffset => client_offset ClientLength => client_length NameOffset => name_offset NameLength => name_length Id => id Revision => revision Reserved => reserved Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d19642f656
commit
6242089330
@ -483,31 +483,29 @@ struct spar_controlvm_channel_protocol {
|
|||||||
offsetof(struct spar_controlvm_channel_protocol, saved_crash_msg)
|
offsetof(struct spar_controlvm_channel_protocol, saved_crash_msg)
|
||||||
|
|
||||||
/* The following header will be located at the beginning of PayloadVmOffset for
|
/* The following header will be located at the beginning of PayloadVmOffset for
|
||||||
* various ControlVm commands. The receiver of a ControlVm command with a
|
* various ControlVm commands. The receiver of a ControlVm command with a
|
||||||
* PayloadVmOffset will dereference this address and then use ConnectionOffset,
|
* PayloadVmOffset will dereference this address and then use connection_offset,
|
||||||
* InitiatorOffset, and TargetOffset to get the location of UTF-8 formatted
|
* initiator_offset, and target_offset to get the location of UTF-8 formatted
|
||||||
* strings that can be parsed to obtain command-specific information. The value
|
* strings that can be parsed to obtain command-specific information. The value
|
||||||
* of TotalLength should equal PayloadBytes. The format of the strings at
|
* of total_length should equal PayloadBytes. The format of the strings at
|
||||||
* PayloadVmOffset will take different forms depending on the message. See the
|
* PayloadVmOffset will take different forms depending on the message.
|
||||||
* following Wiki page for more information:
|
|
||||||
* https://ustr-linux-1.na.uis.unisys.com/spar/index.php/ControlVm_Parameters_Area
|
|
||||||
*/
|
*/
|
||||||
typedef struct _ULTRA_CONTROLVM_PARAMETERS_HEADER {
|
struct spar_controlvm_parameters_header {
|
||||||
u32 TotalLength;
|
u32 total_length;
|
||||||
u32 HeaderLength;
|
u32 header_length;
|
||||||
u32 ConnectionOffset;
|
u32 connection_offset;
|
||||||
u32 ConnectionLength;
|
u32 connection_length;
|
||||||
u32 InitiatorOffset;
|
u32 initiator_offset;
|
||||||
u32 InitiatorLength;
|
u32 initiator_length;
|
||||||
u32 TargetOffset;
|
u32 target_offset;
|
||||||
u32 TargetLength;
|
u32 target_length;
|
||||||
u32 ClientOffset;
|
u32 client_offset;
|
||||||
u32 ClientLength;
|
u32 client_length;
|
||||||
u32 NameOffset;
|
u32 name_offset;
|
||||||
u32 NameLength;
|
u32 name_length;
|
||||||
uuid_le Id;
|
uuid_le id;
|
||||||
u32 Revision;
|
u32 revision;
|
||||||
u32 Reserved; /* Natural alignment */
|
u32 reserved; /* Natural alignment */
|
||||||
} ULTRA_CONTROLVM_PARAMETERS_HEADER;
|
};
|
||||||
|
|
||||||
#endif /* __CONTROLVMCHANNEL_H__ */
|
#endif /* __CONTROLVMCHANNEL_H__ */
|
||||||
|
@ -48,7 +48,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
|
|||||||
PARSER_CONTEXT *rc = NULL;
|
PARSER_CONTEXT *rc = NULL;
|
||||||
PARSER_CONTEXT *ctx = NULL;
|
PARSER_CONTEXT *ctx = NULL;
|
||||||
MEMREGION *rgn = NULL;
|
MEMREGION *rgn = NULL;
|
||||||
ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL;
|
struct spar_controlvm_parameters_header *phdr = NULL;
|
||||||
|
|
||||||
if (tryAgain)
|
if (tryAgain)
|
||||||
*tryAgain = FALSE;
|
*tryAgain = FALSE;
|
||||||
@ -110,27 +110,29 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
|
|||||||
rc = ctx;
|
rc = ctx;
|
||||||
goto Away;
|
goto Away;
|
||||||
}
|
}
|
||||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||||
if (phdr->TotalLength != bytes) {
|
if (phdr->total_length != bytes) {
|
||||||
ERRDRV("%s - bad total length %lu (should be %lu)",
|
ERRDRV("%s - bad total length %lu (should be %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->TotalLength), (ulong) (bytes));
|
(ulong) (phdr->total_length), (ulong) (bytes));
|
||||||
rc = NULL;
|
rc = NULL;
|
||||||
goto Away;
|
goto Away;
|
||||||
}
|
}
|
||||||
if (phdr->TotalLength < phdr->HeaderLength) {
|
if (phdr->total_length < phdr->header_length) {
|
||||||
ERRDRV("%s - total length < header length (%lu < %lu)",
|
ERRDRV("%s - total length < header length (%lu < %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->TotalLength),
|
(ulong) (phdr->total_length),
|
||||||
(ulong) (phdr->HeaderLength));
|
(ulong) (phdr->header_length));
|
||||||
rc = NULL;
|
rc = NULL;
|
||||||
goto Away;
|
goto Away;
|
||||||
}
|
}
|
||||||
if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) {
|
if (phdr->header_length <
|
||||||
|
sizeof(struct spar_controlvm_parameters_header)) {
|
||||||
ERRDRV("%s - header is too small (%lu < %lu)",
|
ERRDRV("%s - header is too small (%lu < %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->HeaderLength),
|
(ulong) (phdr->header_length),
|
||||||
(ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)));
|
(ulong)(sizeof(
|
||||||
|
struct spar_controlvm_parameters_header)));
|
||||||
rc = NULL;
|
rc = NULL;
|
||||||
goto Away;
|
goto Away;
|
||||||
}
|
}
|
||||||
@ -159,7 +161,7 @@ parser_init(u64 addr, u32 bytes, BOOL isLocal, BOOL *tryAgain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call this instead of parser_init() if the payload area consists of just
|
/* Call this instead of parser_init() if the payload area consists of just
|
||||||
* a sequence of bytes, rather than a ULTRA_CONTROLVM_PARAMETERS_HEADER
|
* a sequence of bytes, rather than a struct spar_controlvm_parameters_header
|
||||||
* structures. Afterwards, you can call parser_simpleString_get() or
|
* structures. Afterwards, you can call parser_simpleString_get() or
|
||||||
* parser_byteStream_get() to obtain the data.
|
* parser_byteStream_get() to obtain the data.
|
||||||
*/
|
*/
|
||||||
@ -196,44 +198,44 @@ parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes)
|
|||||||
uuid_le
|
uuid_le
|
||||||
parser_id_get(PARSER_CONTEXT *ctx)
|
parser_id_get(PARSER_CONTEXT *ctx)
|
||||||
{
|
{
|
||||||
ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL;
|
struct spar_controlvm_parameters_header *phdr = NULL;
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
ERRDRV("%s (%s:%d) - no context",
|
ERRDRV("%s (%s:%d) - no context",
|
||||||
__func__, __FILE__, __LINE__);
|
__func__, __FILE__, __LINE__);
|
||||||
return NULL_UUID_LE;
|
return NULL_UUID_LE;
|
||||||
}
|
}
|
||||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||||
return phdr->Id;
|
return phdr->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string)
|
parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string)
|
||||||
{
|
{
|
||||||
ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL;
|
struct spar_controlvm_parameters_header *phdr = NULL;
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
ERRDRV("%s (%s:%d) - no context",
|
ERRDRV("%s (%s:%d) - no context",
|
||||||
__func__, __FILE__, __LINE__);
|
__func__, __FILE__, __LINE__);
|
||||||
goto Away;
|
goto Away;
|
||||||
}
|
}
|
||||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||||
switch (which_string) {
|
switch (which_string) {
|
||||||
case PARSERSTRING_INITIATOR:
|
case PARSERSTRING_INITIATOR:
|
||||||
ctx->curr = ctx->data + phdr->InitiatorOffset;
|
ctx->curr = ctx->data + phdr->initiator_offset;
|
||||||
ctx->bytes_remaining = phdr->InitiatorLength;
|
ctx->bytes_remaining = phdr->initiator_length;
|
||||||
break;
|
break;
|
||||||
case PARSERSTRING_TARGET:
|
case PARSERSTRING_TARGET:
|
||||||
ctx->curr = ctx->data + phdr->TargetOffset;
|
ctx->curr = ctx->data + phdr->target_offset;
|
||||||
ctx->bytes_remaining = phdr->TargetLength;
|
ctx->bytes_remaining = phdr->target_length;
|
||||||
break;
|
break;
|
||||||
case PARSERSTRING_CONNECTION:
|
case PARSERSTRING_CONNECTION:
|
||||||
ctx->curr = ctx->data + phdr->ConnectionOffset;
|
ctx->curr = ctx->data + phdr->connection_offset;
|
||||||
ctx->bytes_remaining = phdr->ConnectionLength;
|
ctx->bytes_remaining = phdr->connection_length;
|
||||||
break;
|
break;
|
||||||
case PARSERSTRING_NAME:
|
case PARSERSTRING_NAME:
|
||||||
ctx->curr = ctx->data + phdr->NameOffset;
|
ctx->curr = ctx->data + phdr->name_offset;
|
||||||
ctx->bytes_remaining = phdr->NameLength;
|
ctx->bytes_remaining = phdr->name_length;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERRDRV("%s - bad which_string %d", __func__, which_string);
|
ERRDRV("%s - bad which_string %d", __func__, which_string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user