staging: unisys: refactor ULTRA_check_channel_server()

Rename spar_check_channel_server() to spar_check_channel_server(),
remove unused parameters fileName, lineNumber, and logCtx, update
references to the function and remove unused parameters in macros that
call it, and fix CamelCase names:

typeGuid => typeuuid
channelName => name
expectedMinBytes => expected_min_bytes
actualBytes => actual_bytes

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Benjamin Romer 2014-10-23 14:30:11 -04:00 committed by Greg Kroah-Hartman
parent c11cf5fd0f
commit 10c5ef6948
5 changed files with 46 additions and 6 deletions

View file

@ -348,6 +348,26 @@ spar_check_channel_client(void __iomem *ch,
return 1;
}
/* Generic function useful for validating any type of channel when it is about
* to be initialized by the server of the channel.
* Note that <logCtx> is only needed for callers in the EFI environment, and
* is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
*/
static inline int spar_check_channel_server(uuid_le typeuuid, char *name,
u64 expected_min_bytes,
u64 actual_bytes)
{
if (expected_min_bytes > 0) /* caller wants us to verify
* channel size */
if (actual_bytes < expected_min_bytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n",
name, &typeuuid, expected_min_bytes,
actual_bytes);
return 0;
}
return 1;
}
/* Given a file pathname <s> (with '/' or '\' separating directory nodes),
* returns a pointer to the beginning of a node within that pathname such
* that the number of nodes from that pointer to the end of the string is

View file

@ -52,6 +52,11 @@ static const uuid_le UltraControlvmChannelProtocolGuid =
sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_CONTROLVM_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(UltraControlvmChannelProtocolGuid, \
"controlvm", \
sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
actualBytes))
#define MY_DEVICE_INDEX 0
#define MAX_MACDATA_LEN 8 /* number of bytes for MAC address in config packet */

View file

@ -65,11 +65,11 @@ static const uuid_le UltraDiagChannelProtocolGuid =
sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \
ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_DIAG_CHANNEL_OK_SERVER(actualBytes, logCtx) \
(ULTRA_check_channel_server(UltraDiagChannelProtocolGuid, \
"diag", \
sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \
actualBytes, __FILE__, __LINE__, logCtx))
#define ULTRA_DIAG_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(UltraDiagChannelProtocolGuid, \
"diag", \
sizeof(ULTRA_DIAG_CHANNEL_PROTOCOL), \
actualBytes))
#define MAX_MODULE_NAME_SIZE 128 /* Maximum length of module name... */
#define MAX_ADDITIONAL_INFO_SIZE 256 /* Maximum length of any additional info
* accompanying event... */

View file

@ -65,17 +65,26 @@
"vhba", MIN_IO_CHANNEL_SIZE, \
ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_VHBA_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(spar_vhba_channel_protocol_uuid, \
"vhba", MIN_IO_CHANNEL_SIZE, actualBytes))
#define SPAR_VNIC_CHANNEL_OK_CLIENT(pChannel, logCtx) \
(spar_check_channel_client(pChannel, spar_vnic_channel_protocol_uuid, \
"vnic", MIN_IO_CHANNEL_SIZE, \
ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_VNIC_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(spar_vnic_channel_protocol_uuid, \
"vnic", MIN_IO_CHANNEL_SIZE, actualBytes))
#define SPAR_VSWITCH_CHANNEL_OK_CLIENT(pChannel, logCtx) \
(spar_check_channel_client(pChannel, UltraVswitchChannelProtocolGuid, \
"vswitch", MIN_IO_CHANNEL_SIZE, \
ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE))
#define ULTRA_VSWITCH_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(UltraVswitchChannelProtocolGuid, \
"vswitch", MIN_IO_CHANNEL_SIZE, \
actualBytes))
/*
* Everything necessary to handle SCSI & NIC traffic between Guest Partition and
* IO Partition is defined below. */

View file

@ -51,6 +51,12 @@ static const uuid_le UltraVbusChannelProtocolGuid =
ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE)) \
#define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes) \
(spar_check_channel_server(UltraVbusChannelProtocolGuid, \
"vbus", \
sizeof(struct ultra_vbus_channel_protocol),\
actualBytes))
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
typedef struct _ULTRA_VBUS_HEADERINFO {
u32 structBytes; /* size of this struct in bytes */