RedfishPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the RedfishPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:11 -08:00
committed by mergify[bot]
parent 5220bd211d
commit 39de741e2d
56 changed files with 6067 additions and 4616 deletions

View File

@ -17,22 +17,22 @@ EFI_EVENT gEfiRedfishDiscoverProtocolEvent = NULL;
//
// Variables for using RFI Redfish Discover Protocol
//
VOID *gEfiRedfishDiscoverRegistration;
EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL;
EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL;
BOOLEAN gRedfishDiscoverActivated = FALSE;
BOOLEAN gRedfishServiceDiscovered = FALSE;
VOID *gEfiRedfishDiscoverRegistration;
EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL;
EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL;
BOOLEAN gRedfishDiscoverActivated = FALSE;
BOOLEAN gRedfishServiceDiscovered = FALSE;
//
// Network interfaces discovered by EFI Redfish Discover Protocol.
//
UINTN gNumberOfNetworkInterfaces;
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *gNetworkInterfaceInstances = NULL;
EFI_REDFISH_DISCOVERED_TOKEN *gRedfishDiscoveredToken = NULL;
EFI_REDFISH_DISCOVERED_TOKEN *gRedfishDiscoveredToken = NULL;
///
/// Driver Binding Protocol instance
///
EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = {
RedfishConfigDriverBindingSupported,
RedfishConfigDriverBindingStart,
RedfishConfigDriverBindingStop,
@ -48,7 +48,7 @@ EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = {
VOID
RedfishConfigStopRedfishDiscovery (
VOID
)
)
{
if (gRedfishDiscoverActivated) {
//
@ -57,6 +57,7 @@ RedfishConfigStopRedfishDiscovery (
if (gEfiRedfishDiscoverProtocolEvent != NULL) {
gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
}
//
// Stop Redfish service discovery.
//
@ -65,9 +66,9 @@ RedfishConfigStopRedfishDiscovery (
gNetworkInterfaceInstances
);
gEfiRedfishDiscoverControllerHandle = NULL;
gEfiRedfishDiscoverProtocol = NULL;
gRedfishDiscoverActivated = FALSE;
gRedfishServiceDiscovered = FALSE;
gEfiRedfishDiscoverProtocol = NULL;
gRedfishDiscoverActivated = FALSE;
gRedfishServiceDiscovered = FALSE;
}
}
@ -138,9 +139,9 @@ RedfishConfigDriverBindingSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_REST_EX_PROTOCOL *RestEx;
EFI_STATUS Status;
EFI_HANDLE ChildHandle;
EFI_REST_EX_PROTOCOL *RestEx;
EFI_STATUS Status;
EFI_HANDLE ChildHandle;
ChildHandle = NULL;
@ -161,10 +162,10 @@ RedfishConfigDriverBindingSupported (
//
// Test if REST EX protocol is ready.
//
Status = gBS->OpenProtocol(
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiRestExProtocolGuid,
(VOID**) &RestEx,
(VOID **)&RestEx,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@ -172,6 +173,7 @@ RedfishConfigDriverBindingSupported (
if (EFI_ERROR (Status)) {
Status = EFI_UNSUPPORTED;
}
NetLibDestroyServiceChild (
ControllerHandle,
This->ImageHandle,
@ -222,19 +224,19 @@ RedfishConfigDriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
VOID *ConfigHandlerRegistration;
VOID *ConfigHandlerRegistration;
if (gRedfishConfigData.Event != NULL) {
return EFI_ALREADY_STARTED;
}
gRedfishConfigData.Event = EfiCreateProtocolNotifyEvent (
&gEdkIIRedfishConfigHandlerProtocolGuid,
TPL_CALLBACK,
RedfishConfigHandlerInstalledCallback,
(VOID *)&gRedfishConfigData,
&ConfigHandlerRegistration
);
&gEdkIIRedfishConfigHandlerProtocolGuid,
TPL_CALLBACK,
RedfishConfigHandlerInstalledCallback,
(VOID *)&gRedfishConfigData,
&ConfigHandlerRegistration
);
return EFI_SUCCESS;
}
@ -278,6 +280,7 @@ RedfishConfigDriverBindingStop (
if (ControllerHandle == gEfiRedfishDiscoverControllerHandle) {
RedfishConfigStopRedfishDiscovery ();
}
gBS->CloseProtocol (
ControllerHandle,
&gEfiRedfishDiscoverProtocolGuid,
@ -294,6 +297,7 @@ RedfishConfigDriverBindingStop (
gBS->CloseEvent (gRedfishConfigData.Event);
gRedfishConfigData.Event = NULL;
}
return EFI_SUCCESS;
}
@ -311,8 +315,8 @@ RedfishServiceDiscoveredCallback (
OUT VOID *Context
)
{
EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstance;
EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstance;
if (gRedfishServiceDiscovered) {
//
@ -322,7 +326,7 @@ RedfishServiceDiscoveredCallback (
}
RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances;
RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances;
//
// Only pick up the first found Redfish service.
//
@ -336,7 +340,7 @@ RedfishServiceDiscoveredCallback (
gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct = RedfishInstance->Information.Product;
gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer = RedfishInstance->Information.ProductVer;
gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = RedfishInstance->Information.UseHttps;
gRedfishServiceDiscovered = TRUE;
gRedfishServiceDiscovered = TRUE;
}
//
@ -361,76 +365,79 @@ RedfishDiscoverProtocolInstalled (
OUT VOID *Context
)
{
EFI_STATUS Status;
UINTN BufferSize;
EFI_HANDLE HandleBuffer;
UINTN NetworkInterfaceIndex;
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface;
EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken;
EFI_STATUS Status;
UINTN BufferSize;
EFI_HANDLE HandleBuffer;
UINTN NetworkInterfaceIndex;
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface;
EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken;
DEBUG((DEBUG_INFO, "%a: New network interface is installed on system by EFI Redfish discover driver.\n", __FUNCTION__));
DEBUG ((DEBUG_INFO, "%a: New network interface is installed on system by EFI Redfish discover driver.\n", __FUNCTION__));
BufferSize = sizeof (EFI_HANDLE);
Status = gBS->LocateHandle (
ByRegisterNotify,
NULL,
gEfiRedfishDiscoverRegistration,
&BufferSize,
&HandleBuffer
);
Status = gBS->LocateHandle (
ByRegisterNotify,
NULL,
gEfiRedfishDiscoverRegistration,
&BufferSize,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "%a: Can't locate handle with EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __FUNCTION__));
DEBUG ((DEBUG_ERROR, "%a: Can't locate handle with EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __FUNCTION__));
}
gRedfishDiscoverActivated = TRUE;
if (gEfiRedfishDiscoverProtocol == NULL) {
gEfiRedfishDiscoverControllerHandle = HandleBuffer;
gEfiRedfishDiscoverControllerHandle = HandleBuffer;
//
// First time to open EFI_REDFISH_DISCOVER_PROTOCOL.
//
Status = gBS->OpenProtocol(
gEfiRedfishDiscoverControllerHandle,
&gEfiRedfishDiscoverProtocolGuid,
(VOID **)&gEfiRedfishDiscoverProtocol,
gRedfishConfigData.Image,
gRedfishConfigData.Image,
EFI_OPEN_PROTOCOL_BY_DRIVER
Status = gBS->OpenProtocol (
gEfiRedfishDiscoverControllerHandle,
&gEfiRedfishDiscoverProtocolGuid,
(VOID **)&gEfiRedfishDiscoverProtocol,
gRedfishConfigData.Image,
gRedfishConfigData.Image,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
gEfiRedfishDiscoverProtocol = NULL;
gRedfishDiscoverActivated = FALSE;
DEBUG((DEBUG_ERROR, "%a: Can't locate EFI_REDFISH_DISCOVER_PROTOCOL.\n", __FUNCTION__));
gRedfishDiscoverActivated = FALSE;
DEBUG ((DEBUG_ERROR, "%a: Can't locate EFI_REDFISH_DISCOVER_PROTOCOL.\n", __FUNCTION__));
return;
}
}
//
// Check the new found network interface.
//
if (gNetworkInterfaceInstances != NULL) {
FreePool (gNetworkInterfaceInstances);
}
Status = gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList(
Status = gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList (
gEfiRedfishDiscoverProtocol,
gRedfishConfigData.Image,
&gNumberOfNetworkInterfaces,
&gNetworkInterfaceInstances
);
if (EFI_ERROR (Status) || gNumberOfNetworkInterfaces == 0) {
DEBUG((DEBUG_ERROR, "%a: No network interfaces found on the handle.\n", __FUNCTION__));
if (EFI_ERROR (Status) || (gNumberOfNetworkInterfaces == 0)) {
DEBUG ((DEBUG_ERROR, "%a: No network interfaces found on the handle.\n", __FUNCTION__));
return;
}
gRedfishDiscoveredToken = AllocateZeroPool (gNumberOfNetworkInterfaces * sizeof (EFI_REDFISH_DISCOVERED_TOKEN));
if (gRedfishDiscoveredToken == NULL) {
DEBUG((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __FUNCTION__));
DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __FUNCTION__));
return;
}
ThisNetworkInterface = gNetworkInterfaceInstances;
ThisNetworkInterface = gNetworkInterfaceInstances;
ThisRedfishDiscoveredToken = gRedfishDiscoveredToken;
//
// Loop to discover Redfish service on each network interface.
//
for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < gNumberOfNetworkInterfaces; NetworkInterfaceIndex ++) {
for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < gNumberOfNetworkInterfaces; NetworkInterfaceIndex++) {
//
// Initial this Redfish Discovered Token
//
@ -440,37 +447,40 @@ RedfishDiscoverProtocolInstalled (
RedfishServiceDiscoveredCallback,
(VOID *)ThisRedfishDiscoveredToken,
&ThisRedfishDiscoveredToken->Event
);
);
if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __FUNCTION__));
DEBUG ((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __FUNCTION__));
goto ErrorReturn;
}
ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE;
ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE;
ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound = 0;
ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances = NULL;
ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances = NULL;
//
// Acquire for Redfish service which is reported by
// Redfish Host Interface.
//
Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService(
gEfiRedfishDiscoverProtocol,
gRedfishConfigData.Image,
ThisNetworkInterface,
EFI_REDFISH_DISCOVER_HOST_INTERFACE,
ThisRedfishDiscoveredToken
);
ThisNetworkInterface ++;
ThisRedfishDiscoveredToken ++;
Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService (
gEfiRedfishDiscoverProtocol,
gRedfishConfigData.Image,
ThisNetworkInterface,
EFI_REDFISH_DISCOVER_HOST_INTERFACE,
ThisRedfishDiscoveredToken
);
ThisNetworkInterface++;
ThisRedfishDiscoveredToken++;
}
if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "%a: Acquire Redfish service fail.\n", __FUNCTION__));
DEBUG ((DEBUG_ERROR, "%a: Acquire Redfish service fail.\n", __FUNCTION__));
goto ErrorReturn;
}
return;
ErrorReturn:
if (gRedfishDiscoveredToken != NULL) {
FreePool(gRedfishDiscoveredToken);
FreePool (gRedfishDiscoveredToken);
}
}
@ -488,23 +498,26 @@ RedfishConfigHandlerDriverUnload (
IN EFI_HANDLE ImageHandle
)
{
EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken;
UINTN NumberOfNetworkInterfacesIndex;
EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken;
UINTN NumberOfNetworkInterfacesIndex;
RedfishConfigDriverCommonUnload (ImageHandle);
RedfishConfigStopRedfishDiscovery ();
if (gRedfishDiscoveredToken != NULL) {
ThisRedfishDiscoveredToken = gRedfishDiscoveredToken;
for (NumberOfNetworkInterfacesIndex = 0; NumberOfNetworkInterfacesIndex < gNumberOfNetworkInterfaces; NumberOfNetworkInterfacesIndex ++) {
for (NumberOfNetworkInterfacesIndex = 0; NumberOfNetworkInterfacesIndex < gNumberOfNetworkInterfaces; NumberOfNetworkInterfacesIndex++) {
if (ThisRedfishDiscoveredToken->Event != NULL) {
gBS->CloseEvent (ThisRedfishDiscoveredToken->Event);
}
FreePool (ThisRedfishDiscoveredToken);
ThisRedfishDiscoveredToken ++;
ThisRedfishDiscoveredToken++;
}
gRedfishDiscoveredToken = NULL;
}
return EFI_SUCCESS;
}
@ -526,7 +539,7 @@ RedfishConfigHandlerDriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
ZeroMem ((VOID *)&gRedfishConfigData, sizeof (REDFISH_CONFIG_DRIVER_DATA));
gRedfishConfigData.Image = ImageHandle;
@ -546,11 +559,12 @@ RedfishConfigHandlerDriverEntryPoint (
DEBUG ((DEBUG_ERROR, "%a: Fail to create event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__));
return Status;
}
Status = gBS->RegisterProtocolNotify (
&gEfiRedfishDiscoverProtocolGuid,
gEfiRedfishDiscoverProtocolEvent,
&gEfiRedfishDiscoverRegistration
);
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Fail to register event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__));
return Status;
@ -582,6 +596,6 @@ RedfishConfigHandlerDriverEntryPoint (
DEBUG ((DEBUG_ERROR, "%a: Fail to install EFI Binding Protocol of EFI Redfish Config driver.", __FUNCTION__));
return Status;
}
return Status;
}