OvmfPkg: Improve code style/formatting in BhyveFwCtlLib.c

The code style in Library/BhyveFwCtlLib/BhyveFwCtlLib.c was very
inconsistent. Fix it to pass the ECC tool checks by typedef'ing
structs, and improve indentation.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-3-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Rebecca Cran 2020-11-29 22:34:09 -07:00 committed by mergify[bot]
parent 666923359e
commit f2d262e402

View File

@ -12,9 +12,9 @@
#include "Uefi.h"
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BhyveFwCtlLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/BhyveFwCtlLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
@ -43,17 +43,17 @@ STATIC BOOLEAN mBhyveFwCtlSupported = FALSE;
STATIC INT32 mBhyveFwCtlTxid = 0xa5;
/* XXX Maybe a better inbuilt version of this ? */
struct BIoVec {
typedef struct {
VOID *Base;
UINT32 Len;
};
} BIO_VEC;
struct MsgRxHdr {
typedef struct {
UINT32 Sz;
UINT32 Op;
UINT32 TxId;
UINT32 Err;
};
} MSG_RX_HDR;
STATIC
RETURN_STATUS
@ -89,7 +89,7 @@ STATIC
UINT32
EFIAPI
BIov_WLen (
IN struct BIoVec b[]
IN BIO_VEC b[]
)
{
UINT32 i;
@ -163,7 +163,7 @@ BIov_Send (
STATIC
VOID
BIov_SendAll (
IN struct BIoVec b[]
IN BIO_VEC b[]
)
{
INT32 i;
@ -183,10 +183,10 @@ VOID
EFIAPI
BhyveFwCtl_MsgSend(
IN UINT32 OpCode,
IN struct BIoVec Data[]
IN BIO_VEC Data[]
)
{
struct BIoVec hIov[4];
BIO_VEC hIov[4];
UINT32 Hdr[3];
UINT32 i;
@ -215,18 +215,19 @@ STATIC
RETURN_STATUS
EFIAPI
BhyveFwCtl_MsgRecv(
OUT struct MsgRxHdr *Rhdr,
OUT struct BIoVec Data[]
OUT MSG_RX_HDR *Rhdr,
OUT BIO_VEC Data[]
)
{
RETURN_STATUS Status;
UINT32 *Dp;
UINT32 Rd;
UINT32 remLen;
INT32 oLen, xLen;
INT32 oLen;
INT32 xLen;
Rd = IoRead32 (FW_PORT);
if (Rd < sizeof(struct MsgRxHdr)) {
if (Rd < sizeof (MSG_RX_HDR)) {
;
}
@ -239,7 +240,7 @@ BhyveFwCtl_MsgRecv(
/* Convert transport errno into UEFI error status */
Status = BhyveFwCtl_CvtErr (Rhdr->Err);
remLen = Rd - sizeof(struct MsgRxHdr);
remLen = Rd - sizeof (MSG_RX_HDR);
xLen = 0;
/*
@ -284,11 +285,11 @@ RETURN_STATUS
EFIAPI
BhyveFwCtl_Msg(
IN UINT32 OpCode,
IN struct BIoVec Sdata[],
OUT struct BIoVec Rdata[]
IN BIO_VEC Sdata[],
OUT BIO_VEC Rdata[]
)
{
struct MsgRxHdr Rh;
MSG_RX_HDR Rh;
RETURN_STATUS Status;
Status = RETURN_SUCCESS;
@ -309,7 +310,7 @@ BhyveFwCtlGetLen (
IN OUT UINT32 *Size
)
{
struct BIoVec Req[2], Resp[2];
BIO_VEC Req[2], Resp[2];
RETURN_STATUS Status;
Req[0].Base = (VOID *)Name;
@ -340,7 +341,8 @@ BhyveFwCtlGetVal (
IN OUT UINT32 *Size
)
{
struct BIoVec Req[2], Resp[2];
BIO_VEC Req[2];
BIO_VEC Resp[2];
RETURN_STATUS Status;
/* Make sure temp buffer is larger than passed-in size */