mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
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)
|
||||
|
||||
/* The following header will be located at the beginning of PayloadVmOffset for
|
||||
* various ControlVm commands. The receiver of a ControlVm command with a
|
||||
* PayloadVmOffset will dereference this address and then use ConnectionOffset,
|
||||
* InitiatorOffset, and TargetOffset to get the location of UTF-8 formatted
|
||||
* strings that can be parsed to obtain command-specific information. The value
|
||||
* of TotalLength should equal PayloadBytes. The format of the strings at
|
||||
* PayloadVmOffset will take different forms depending on the message. See the
|
||||
* following Wiki page for more information:
|
||||
* https://ustr-linux-1.na.uis.unisys.com/spar/index.php/ControlVm_Parameters_Area
|
||||
* various ControlVm commands. The receiver of a ControlVm command with a
|
||||
* PayloadVmOffset will dereference this address and then use connection_offset,
|
||||
* 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
|
||||
* of total_length should equal PayloadBytes. The format of the strings at
|
||||
* PayloadVmOffset will take different forms depending on the message.
|
||||
*/
|
||||
typedef struct _ULTRA_CONTROLVM_PARAMETERS_HEADER {
|
||||
u32 TotalLength;
|
||||
u32 HeaderLength;
|
||||
u32 ConnectionOffset;
|
||||
u32 ConnectionLength;
|
||||
u32 InitiatorOffset;
|
||||
u32 InitiatorLength;
|
||||
u32 TargetOffset;
|
||||
u32 TargetLength;
|
||||
u32 ClientOffset;
|
||||
u32 ClientLength;
|
||||
u32 NameOffset;
|
||||
u32 NameLength;
|
||||
uuid_le Id;
|
||||
u32 Revision;
|
||||
u32 Reserved; /* Natural alignment */
|
||||
} ULTRA_CONTROLVM_PARAMETERS_HEADER;
|
||||
struct spar_controlvm_parameters_header {
|
||||
u32 total_length;
|
||||
u32 header_length;
|
||||
u32 connection_offset;
|
||||
u32 connection_length;
|
||||
u32 initiator_offset;
|
||||
u32 initiator_length;
|
||||
u32 target_offset;
|
||||
u32 target_length;
|
||||
u32 client_offset;
|
||||
u32 client_length;
|
||||
u32 name_offset;
|
||||
u32 name_length;
|
||||
uuid_le id;
|
||||
u32 revision;
|
||||
u32 reserved; /* Natural alignment */
|
||||
};
|
||||
|
||||
#endif /* __CONTROLVMCHANNEL_H__ */
|
||||
|
@ -48,7 +48,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
|
||||
PARSER_CONTEXT *rc = NULL;
|
||||
PARSER_CONTEXT *ctx = NULL;
|
||||
MEMREGION *rgn = NULL;
|
||||
ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL;
|
||||
struct spar_controlvm_parameters_header *phdr = NULL;
|
||||
|
||||
if (tryAgain)
|
||||
*tryAgain = FALSE;
|
||||
@ -110,27 +110,29 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
|
||||
rc = ctx;
|
||||
goto Away;
|
||||
}
|
||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
||||
if (phdr->TotalLength != bytes) {
|
||||
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||
if (phdr->total_length != bytes) {
|
||||
ERRDRV("%s - bad total length %lu (should be %lu)",
|
||||
__func__,
|
||||
(ulong) (phdr->TotalLength), (ulong) (bytes));
|
||||
(ulong) (phdr->total_length), (ulong) (bytes));
|
||||
rc = NULL;
|
||||
goto Away;
|
||||
}
|
||||
if (phdr->TotalLength < phdr->HeaderLength) {
|
||||
if (phdr->total_length < phdr->header_length) {
|
||||
ERRDRV("%s - total length < header length (%lu < %lu)",
|
||||
__func__,
|
||||
(ulong) (phdr->TotalLength),
|
||||
(ulong) (phdr->HeaderLength));
|
||||
(ulong) (phdr->total_length),
|
||||
(ulong) (phdr->header_length));
|
||||
rc = NULL;
|
||||
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)",
|
||||
__func__,
|
||||
(ulong) (phdr->HeaderLength),
|
||||
(ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)));
|
||||
(ulong) (phdr->header_length),
|
||||
(ulong)(sizeof(
|
||||
struct spar_controlvm_parameters_header)));
|
||||
rc = NULL;
|
||||
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
|
||||
* 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
|
||||
* parser_byteStream_get() to obtain the data.
|
||||
*/
|
||||
@ -196,44 +198,44 @@ parser_byteStream_get(PARSER_CONTEXT *ctx, ulong *nbytes)
|
||||
uuid_le
|
||||
parser_id_get(PARSER_CONTEXT *ctx)
|
||||
{
|
||||
ULTRA_CONTROLVM_PARAMETERS_HEADER *phdr = NULL;
|
||||
struct spar_controlvm_parameters_header *phdr = NULL;
|
||||
|
||||
if (ctx == NULL) {
|
||||
ERRDRV("%s (%s:%d) - no context",
|
||||
__func__, __FILE__, __LINE__);
|
||||
return NULL_UUID_LE;
|
||||
}
|
||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
||||
return phdr->Id;
|
||||
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||
return phdr->id;
|
||||
}
|
||||
|
||||
void
|
||||
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) {
|
||||
ERRDRV("%s (%s:%d) - no context",
|
||||
__func__, __FILE__, __LINE__);
|
||||
goto Away;
|
||||
}
|
||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
||||
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
|
||||
switch (which_string) {
|
||||
case PARSERSTRING_INITIATOR:
|
||||
ctx->curr = ctx->data + phdr->InitiatorOffset;
|
||||
ctx->bytes_remaining = phdr->InitiatorLength;
|
||||
ctx->curr = ctx->data + phdr->initiator_offset;
|
||||
ctx->bytes_remaining = phdr->initiator_length;
|
||||
break;
|
||||
case PARSERSTRING_TARGET:
|
||||
ctx->curr = ctx->data + phdr->TargetOffset;
|
||||
ctx->bytes_remaining = phdr->TargetLength;
|
||||
ctx->curr = ctx->data + phdr->target_offset;
|
||||
ctx->bytes_remaining = phdr->target_length;
|
||||
break;
|
||||
case PARSERSTRING_CONNECTION:
|
||||
ctx->curr = ctx->data + phdr->ConnectionOffset;
|
||||
ctx->bytes_remaining = phdr->ConnectionLength;
|
||||
ctx->curr = ctx->data + phdr->connection_offset;
|
||||
ctx->bytes_remaining = phdr->connection_length;
|
||||
break;
|
||||
case PARSERSTRING_NAME:
|
||||
ctx->curr = ctx->data + phdr->NameOffset;
|
||||
ctx->bytes_remaining = phdr->NameLength;
|
||||
ctx->curr = ctx->data + phdr->name_offset;
|
||||
ctx->bytes_remaining = phdr->name_length;
|
||||
break;
|
||||
default:
|
||||
ERRDRV("%s - bad which_string %d", __func__, which_string);
|
||||
|
Loading…
Reference in New Issue
Block a user