summaryrefslogtreecommitdiffstats
path: root/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:11 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit39de741e2dcb8f11e9b4438e37224797643d8451 (patch)
treeddf957e0b215e0918dc53ad756c6bd047c9b7b16 /RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
parent5220bd211df890f2672c23c050082862cd1e82d6 (diff)
downloadedk2-39de741e2dcb8f11e9b4438e37224797643d8451.tar.gz
edk2-39de741e2dcb8f11e9b4438e37224797643d8451.tar.bz2
edk2-39de741e2dcb8f11e9b4438e37224797643d8451.zip
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>
Diffstat (limited to 'RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c')
-rw-r--r--RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c442
1 files changed, 246 insertions, 196 deletions
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
index a3f4cd3c9a..404866fb31 100644
--- a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
@@ -13,8 +13,8 @@
#include <Protocol/RestJsonStructure.h>
#include "RestJsonStructureInternal.h"
-LIST_ENTRY mRestJsonStructureList;
-EFI_HANDLE mProtocolHandle;
+LIST_ENTRY mRestJsonStructureList;
+EFI_HANDLE mProtocolHandle;
/**
This function registers Restful resource interpreter for the
@@ -34,63 +34,66 @@ EFI_HANDLE mProtocolHandle;
EFI_STATUS
EFIAPI
RestJsonStructureRegister (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported,
- IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
- IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
- IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
-)
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported,
+ IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
+ IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
+ IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
+ )
{
- UINTN NumberOfNS;
- UINTN Index;
- LIST_ENTRY *ThisList;
- REST_JSON_STRUCTURE_INSTANCE *Instance;
- EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *CloneSupportedInterpId;
- EFI_REST_JSON_STRUCTURE_SUPPORTED *ThisSupportedInterp;
-
- if (This == NULL ||
- ToStructure == NULL ||
- ToJson == NULL ||
- DestroyStructure == NULL ||
- JsonStructureSupported == NULL
- ) {
+ UINTN NumberOfNS;
+ UINTN Index;
+ LIST_ENTRY *ThisList;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *CloneSupportedInterpId;
+ EFI_REST_JSON_STRUCTURE_SUPPORTED *ThisSupportedInterp;
+
+ if ((This == NULL) ||
+ (ToStructure == NULL) ||
+ (ToJson == NULL) ||
+ (DestroyStructure == NULL) ||
+ (JsonStructureSupported == NULL)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
//
// Check how many name space interpreter can interpret.
//
- ThisList = &JsonStructureSupported->NextSupportedRsrcInterp;
+ ThisList = &JsonStructureSupported->NextSupportedRsrcInterp;
NumberOfNS = 1;
while (TRUE) {
if (ThisList->ForwardLink == &JsonStructureSupported->NextSupportedRsrcInterp) {
break;
} else {
ThisList = ThisList->ForwardLink;
- NumberOfNS ++;
+ NumberOfNS++;
}
- };
+ }
Instance =
(REST_JSON_STRUCTURE_INSTANCE *)AllocateZeroPool (sizeof (REST_JSON_STRUCTURE_INSTANCE) + NumberOfNS * sizeof (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
if (Instance == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
InitializeListHead (&Instance->NextRestJsonStructureInstance);
Instance->NumberOfNameSpaceToConvert = NumberOfNS;
- Instance->SupportedRsrcIndentifier = (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *)((REST_JSON_STRUCTURE_INSTANCE *)Instance + 1);
+ Instance->SupportedRsrcIndentifier = (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *)((REST_JSON_STRUCTURE_INSTANCE *)Instance + 1);
//
// Copy supported resource identifer interpreter.
//
CloneSupportedInterpId = Instance->SupportedRsrcIndentifier;
- ThisSupportedInterp = JsonStructureSupported;
- for (Index = 0; Index < NumberOfNS; Index ++) {
+ ThisSupportedInterp = JsonStructureSupported;
+ for (Index = 0; Index < NumberOfNS; Index++) {
CopyMem ((VOID *)CloneSupportedInterpId, (VOID *)&ThisSupportedInterp->RestResourceInterp, sizeof (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
ThisSupportedInterp = (EFI_REST_JSON_STRUCTURE_SUPPORTED *)ThisSupportedInterp->NextSupportedRsrcInterp.ForwardLink;
- CloneSupportedInterpId ++;
+ CloneSupportedInterpId++;
}
- Instance->JsonToStructure = ToStructure;
- Instance->StructureToJson = ToJson;
+
+ Instance->JsonToStructure = ToStructure;
+ Instance->StructureToJson = ToJson;
Instance->DestroyStructure = DestroyStructure;
InsertTailList (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
return EFI_SUCCESS;
@@ -111,23 +114,24 @@ RestJsonStructureRegister (
**/
EFI_STATUS
InterpreterInstanceToStruct (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
- IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
- IN CHAR8 *ResourceRaw,
- OUT EFI_REST_JSON_STRUCTURE_HEADER **RestJSonHeader
- )
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
+ IN CHAR8 *ResourceRaw,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **RestJSonHeader
+ )
{
- UINTN Index;
- EFI_STATUS Status;
- EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
-
- if (This == NULL ||
- InterpreterInstance == NULL ||
- ResourceRaw == NULL ||
- RestJSonHeader == NULL
- ) {
- return EFI_INVALID_PARAMETER;
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+
+ if ((This == NULL) ||
+ (InterpreterInstance == NULL) ||
+ (ResourceRaw == NULL) ||
+ (RestJSonHeader == NULL)
+ )
+ {
+ return EFI_INVALID_PARAMETER;
}
Status = EFI_UNSUPPORTED;
@@ -137,62 +141,72 @@ InterpreterInstanceToStruct (
// Interpreter may recognize this resource.
//
Status = InterpreterInstance->JsonToStructure (
- This,
- NULL,
- ResourceRaw,
- RestJSonHeader
- );
+ This,
+ NULL,
+ ResourceRaw,
+ RestJSonHeader
+ );
} else {
//
// Check if the namesapce and version is supported by this interpreter.
//
ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
- for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
if (AsciiStrCmp (
RsrcTypeIdentifier->NameSpace.ResourceTypeName,
- ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0){
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
+ ) == 0)
+ {
if ((RsrcTypeIdentifier->NameSpace.MajorVersion == NULL) &&
(RsrcTypeIdentifier->NameSpace.MinorVersion == NULL) &&
(RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL)
- ) {
+ )
+ {
//
// Don't check version of this resource type identifier.
//
Status = InterpreterInstance->JsonToStructure (
- This,
- RsrcTypeIdentifier,
- ResourceRaw,
- RestJSonHeader
- );
+ This,
+ RsrcTypeIdentifier,
+ ResourceRaw,
+ RestJSonHeader
+ );
break;
} else {
//
// Check version.
//
if ((AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.MajorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ RsrcTypeIdentifier->NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.MinorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ RsrcTypeIdentifier->NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.ErrataVersion,
- ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ RsrcTypeIdentifier->NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
+ ) == 0))
+ {
Status = InterpreterInstance->JsonToStructure (
- This,
- RsrcTypeIdentifier,
- ResourceRaw,
- RestJSonHeader
- );
+ This,
+ RsrcTypeIdentifier,
+ ResourceRaw,
+ RestJSonHeader
+ );
break;
}
}
}
- ThisSupportedRsrcTypeId ++;
+
+ ThisSupportedRsrcTypeId++;
}
}
+
return Status;
}
+
/**
This function converts JSON C structure to JSON property.
@@ -207,65 +221,76 @@ InterpreterInstanceToStruct (
**/
EFI_STATUS
InterpreterEfiStructToInstance (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
- IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
- OUT CHAR8 **ResourceRaw
-)
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
+ OUT CHAR8 **ResourceRaw
+ )
{
- UINTN Index;
- EFI_STATUS Status;
- EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
- EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier;
-
- if (This == NULL ||
- InterpreterInstance == NULL ||
- RestJSonHeader == NULL ||
- ResourceRaw == NULL
- ) {
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier;
+
+ if ((This == NULL) ||
+ (InterpreterInstance == NULL) ||
+ (RestJSonHeader == NULL) ||
+ (ResourceRaw == NULL)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
+
RsrcTypeIdentifier = &RestJSonHeader->JsonRsrcIdentifier;
- if (RsrcTypeIdentifier == NULL ||
- RsrcTypeIdentifier->NameSpace.ResourceTypeName == NULL ||
- RsrcTypeIdentifier->NameSpace.MajorVersion == NULL ||
- RsrcTypeIdentifier->NameSpace.MinorVersion == NULL ||
- RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL
- ) {
+ if ((RsrcTypeIdentifier == NULL) ||
+ (RsrcTypeIdentifier->NameSpace.ResourceTypeName == NULL) ||
+ (RsrcTypeIdentifier->NameSpace.MajorVersion == NULL) ||
+ (RsrcTypeIdentifier->NameSpace.MinorVersion == NULL) ||
+ (RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
//
// Check if the namesapce and version is supported by this interpreter.
//
- Status = EFI_UNSUPPORTED;
+ Status = EFI_UNSUPPORTED;
ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
- for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
if (AsciiStrCmp (
RsrcTypeIdentifier->NameSpace.ResourceTypeName,
- ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0){
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
+ ) == 0)
+ {
//
// Check version.
//
if ((AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.MajorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ RsrcTypeIdentifier->NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.MinorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ RsrcTypeIdentifier->NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RsrcTypeIdentifier->NameSpace.ErrataVersion,
- ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ RsrcTypeIdentifier->NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
+ ) == 0))
+ {
Status = InterpreterInstance->StructureToJson (
- This,
- RestJSonHeader,
- ResourceRaw
- );
+ This,
+ RestJSonHeader,
+ ResourceRaw
+ );
break;
}
}
- ThisSupportedRsrcTypeId ++;
+
+ ThisSupportedRsrcTypeId++;
}
+
return Status;
}
@@ -282,19 +307,20 @@ InterpreterEfiStructToInstance (
**/
EFI_STATUS
InterpreterInstanceDestoryJsonStruct (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
- IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
- )
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
+ )
{
- UINTN Index;
- EFI_STATUS Status;
- EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
-
- if (This == NULL ||
- InterpreterInstance == NULL ||
- RestJSonHeader == NULL
- ) {
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+
+ if ((This == NULL) ||
+ (InterpreterInstance == NULL) ||
+ (RestJSonHeader == NULL)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
@@ -303,45 +329,54 @@ InterpreterInstanceDestoryJsonStruct (
// Check if the namesapce and version is supported by this interpreter.
//
ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
- for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
if (AsciiStrCmp (
RestJSonHeader->JsonRsrcIdentifier.NameSpace.ResourceTypeName,
- ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0) {
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
+ ) == 0)
+ {
if ((RestJSonHeader->JsonRsrcIdentifier.NameSpace.MajorVersion == NULL) &&
(RestJSonHeader->JsonRsrcIdentifier.NameSpace.MinorVersion == NULL) &&
(RestJSonHeader->JsonRsrcIdentifier.NameSpace.ErrataVersion == NULL)
- ) {
+ )
+ {
//
// Don't check version of this resource type identifier.
//
Status = InterpreterInstance->DestroyStructure (
- This,
- RestJSonHeader
- );
+ This,
+ RestJSonHeader
+ );
break;
} else {
//
// Check version.
//
if ((AsciiStrCmp (
- RestJSonHeader->JsonRsrcIdentifier.NameSpace.MajorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ RestJSonHeader->JsonRsrcIdentifier.NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RestJSonHeader->JsonRsrcIdentifier.NameSpace.MinorVersion,
- ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ RestJSonHeader->JsonRsrcIdentifier.NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion
+ ) == 0) &&
(AsciiStrCmp (
- RestJSonHeader->JsonRsrcIdentifier.NameSpace.ErrataVersion,
- ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ RestJSonHeader->JsonRsrcIdentifier.NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
+ ) == 0))
+ {
Status = InterpreterInstance->DestroyStructure (
- This,
- RestJSonHeader
- );
+ This,
+ RestJSonHeader
+ );
break;
}
}
}
- ThisSupportedRsrcTypeId ++;
+
+ ThisSupportedRsrcTypeId++;
}
+
return Status;
}
@@ -360,44 +395,49 @@ InterpreterInstanceDestoryJsonStruct (
EFI_STATUS
EFIAPI
RestJsonStructureToStruct (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
- IN CHAR8 *ResourceJsonText,
- OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
-)
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
+ IN CHAR8 *ResourceJsonText,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
+ )
{
- EFI_STATUS Status;
- REST_JSON_STRUCTURE_INSTANCE *Instance;
-
- if (This == NULL ||
- ResourceJsonText == NULL ||
- JsonStructure == NULL
- ) {
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+
+ if ((This == NULL) ||
+ (ResourceJsonText == NULL) ||
+ (JsonStructure == NULL)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
if (IsListEmpty (&mRestJsonStructureList)) {
return EFI_UNSUPPORTED;
}
- Status = EFI_SUCCESS;
+
+ Status = EFI_SUCCESS;
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
while (TRUE) {
Status = InterpreterInstanceToStruct (
- This,
- Instance,
- RsrcTypeIdentifier,
- ResourceJsonText,
- JsonStructure
- );
+ This,
+ Instance,
+ RsrcTypeIdentifier,
+ ResourceJsonText,
+ JsonStructure
+ );
if (!EFI_ERROR (Status)) {
break;
}
- if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+
+ if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
Status = EFI_UNSUPPORTED;
break;
}
+
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
- };
+ }
+
return Status;
}
@@ -415,37 +455,41 @@ RestJsonStructureToStruct (
EFI_STATUS
EFIAPI
RestJsonStructureDestroyStruct (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
-)
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
+ )
{
- EFI_STATUS Status;
- REST_JSON_STRUCTURE_INSTANCE *Instance;
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
- if (This == NULL || RestJSonHeader == NULL) {
+ if ((This == NULL) || (RestJSonHeader == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (IsListEmpty (&mRestJsonStructureList)) {
return EFI_UNSUPPORTED;
}
- Status = EFI_SUCCESS;
+
+ Status = EFI_SUCCESS;
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
while (TRUE) {
Status = InterpreterInstanceDestoryJsonStruct (
- This,
- Instance,
- RestJSonHeader
- );
+ This,
+ Instance,
+ RestJSonHeader
+ );
if (!EFI_ERROR (Status)) {
break;
}
- if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+
+ if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
Status = EFI_UNSUPPORTED;
break;
}
+
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
- };
+ }
+
return Status;
}
@@ -463,43 +507,47 @@ RestJsonStructureDestroyStruct (
EFI_STATUS
EFIAPI
RestJsonStructureToJson (
- IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
- IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
- OUT CHAR8 **ResourceRaw
-)
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
+ OUT CHAR8 **ResourceRaw
+ )
{
- EFI_STATUS Status;
- REST_JSON_STRUCTURE_INSTANCE *Instance;
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
- if (This == NULL || RestJSonHeader == NULL || ResourceRaw == NULL) {
+ if ((This == NULL) || (RestJSonHeader == NULL) || (ResourceRaw == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (IsListEmpty (&mRestJsonStructureList)) {
return EFI_UNSUPPORTED;
}
- Status = EFI_SUCCESS;
+
+ Status = EFI_SUCCESS;
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
while (TRUE) {
Status = InterpreterEfiStructToInstance (
- This,
- Instance,
- RestJSonHeader,
- ResourceRaw
- );
+ This,
+ Instance,
+ RestJSonHeader,
+ ResourceRaw
+ );
if (!EFI_ERROR (Status)) {
break;
}
- if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+
+ if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
Status = EFI_UNSUPPORTED;
break;
}
+
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
- };
+ }
+
return Status;
}
-EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol = {
+EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol = {
RestJsonStructureRegister,
RestJsonStructureToStruct,
RestJsonStructureToJson,
@@ -522,19 +570,19 @@ RestJsonStructureEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
InitializeListHead (&mRestJsonStructureList);
//
// Install the Restful Resource Interpreter Protocol.
//
mProtocolHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &mProtocolHandle,
- &gEfiRestJsonStructureProtocolGuid,
- EFI_NATIVE_INTERFACE,
- (VOID *)&mRestJsonStructureProtocol
- );
+ Status = gBS->InstallProtocolInterface (
+ &mProtocolHandle,
+ &gEfiRestJsonStructureProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID *)&mRestJsonStructureProtocol
+ );
return Status;
}
@@ -553,12 +601,12 @@ RestJsonStructureEntryPoint (
EFI_STATUS
EFIAPI
RestJsonStructureUnload (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- REST_JSON_STRUCTURE_INSTANCE *Instance;
- REST_JSON_STRUCTURE_INSTANCE *NextInstance;
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+ REST_JSON_STRUCTURE_INSTANCE *NextInstance;
Status = gBS->UninstallProtocolInterface (
mProtocolHandle,
@@ -569,15 +617,17 @@ RestJsonStructureUnload (
if (IsListEmpty (&mRestJsonStructureList)) {
return Status;
}
+
//
// Free memory of REST_JSON_STRUCTURE_INSTANCE instance.
//
Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
do {
NextInstance = NULL;
- if (!IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+ if (!IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
NextInstance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
}
+
FreePool ((VOID *)Instance);
Instance = NextInstance;
} while (Instance != NULL);