public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] Use RedfishPkg libraries
@ 2021-08-11  6:03 Abner Chang
  2021-08-11  6:03 ` [PATCH 1/3] RedfishClientPkg/Crt: Add CRT header files Abner Chang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Abner Chang @ 2021-08-11  6:03 UTC (permalink / raw)
  To: devel; +Cc: Nickle Wang, Liming Gao

Add private header files that are used by the drivers/libraries under
RedfishClientPkg for using JsonLib and RedfishCrtLib in RedfishPkg.
Currently we refer to the RedfishCrtLib under RedfishPkg/PrivateLibrary,
however RedfishCrtLib would be public for other packages later.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Abner Chang (3):
  RedfishClientPkg/Crt: Add CRT header files
  RedfishClientPkg/PrivateInclude: Private header file of JsonLib
  RedfishClientPkg: Add external libraries

 RedfishClientPkg/RedfishClientPkg.dec        |  4 +-
 RedfishClientPkg/RedfishClientPkg.dsc        |  4 ++
 RedfishClientPkg/PrivateInclude/Crt/stdarg.h | 14 ++++
 RedfishClientPkg/PrivateInclude/Crt/stdio.h  | 14 ++++
 RedfishClientPkg/PrivateInclude/Crt/stdlib.h | 15 +++++
 RedfishClientPkg/PrivateInclude/Crt/string.h | 15 +++++
 RedfishClientPkg/PrivateInclude/jansson.h    | 71 ++++++++++++++++++++
 7 files changed, 136 insertions(+), 1 deletion(-)
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdarg.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdio.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdlib.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/string.h
 create mode 100644 RedfishClientPkg/PrivateInclude/jansson.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] RedfishClientPkg/Crt: Add CRT header files
  2021-08-11  6:03 [PATCH 0/3] Use RedfishPkg libraries Abner Chang
@ 2021-08-11  6:03 ` Abner Chang
  2021-08-11  6:03 ` [PATCH 2/3] RedfishClientPkg/PrivateInclude: Private header file of JsonLib Abner Chang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Abner Chang @ 2021-08-11  6:03 UTC (permalink / raw)
  To: devel; +Cc: Nickle Wang, Liming Gao

Add CRT header files which refer to the ones under
RedfishPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 RedfishClientPkg/RedfishClientPkg.dec        |  3 ++-
 RedfishClientPkg/PrivateInclude/Crt/stdarg.h | 14 ++++++++++++++
 RedfishClientPkg/PrivateInclude/Crt/stdio.h  | 14 ++++++++++++++
 RedfishClientPkg/PrivateInclude/Crt/stdlib.h | 15 +++++++++++++++
 RedfishClientPkg/PrivateInclude/Crt/string.h | 15 +++++++++++++++
 5 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdarg.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdio.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdlib.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/string.h

diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index 6da0468e65..832cdc6154 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -15,7 +15,8 @@
 [Includes]
   Include
 
-[LibraryClasses]
+[Includes.Common.Private]
+  PrivateInclude/Crt            # Private header files for C RTL.
 
 [Protocols]
   ## Include/Protocol/EdkIIRedfishFeature.h
diff --git a/RedfishClientPkg/PrivateInclude/Crt/stdarg.h b/RedfishClientPkg/PrivateInclude/Crt/stdarg.h
new file mode 100644
index 0000000000..5f458c0a47
--- /dev/null
+++ b/RedfishClientPkg/PrivateInclude/Crt/stdarg.h
@@ -0,0 +1,14 @@
+/** @file
+  Include file to support building the third-party jansson library.
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef REDFISH_CLIENT_CRT_STDARG_H_
+#define REDFISH_CLIENT_CRT_STDARG_H_
+
+#include <Library/RedfishCrtLib.h>
+
+#endif
diff --git a/RedfishClientPkg/PrivateInclude/Crt/stdio.h b/RedfishClientPkg/PrivateInclude/Crt/stdio.h
new file mode 100644
index 0000000000..30a0afae6f
--- /dev/null
+++ b/RedfishClientPkg/PrivateInclude/Crt/stdio.h
@@ -0,0 +1,14 @@
+/** @file
+  Include file to support building the third-party jansson library.
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef REDFISH_CLIENT_CRT_STDIO_H_
+#define REDFISH_CLIENT_CRT_STDIO_H_
+
+#include <Library/RedfishCrtLib.h>
+
+#endif
diff --git a/RedfishClientPkg/PrivateInclude/Crt/stdlib.h b/RedfishClientPkg/PrivateInclude/Crt/stdlib.h
new file mode 100644
index 0000000000..ff02b9f351
--- /dev/null
+++ b/RedfishClientPkg/PrivateInclude/Crt/stdlib.h
@@ -0,0 +1,15 @@
+/** @file
+  Include file to support building the third-party jansson library.
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_CLIENT_CRT_STDLIB_H_
+#define REDFISH_CLIENT_CRT_STDLIB_H_
+
+#include <Library/RedfishCrtLib.h>
+
+#endif
diff --git a/RedfishClientPkg/PrivateInclude/Crt/string.h b/RedfishClientPkg/PrivateInclude/Crt/string.h
new file mode 100644
index 0000000000..c3b0c65c62
--- /dev/null
+++ b/RedfishClientPkg/PrivateInclude/Crt/string.h
@@ -0,0 +1,15 @@
+/** @file
+  Include file to support building the third-party jansson library.
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_CLIENT_CRT_STRING_H_
+#define REDFISH_CLIENT_CRT_STRING_H_
+
+#include <Library/RedfishCrtLib.h>
+
+#endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] RedfishClientPkg/PrivateInclude: Private header file of JsonLib
  2021-08-11  6:03 [PATCH 0/3] Use RedfishPkg libraries Abner Chang
  2021-08-11  6:03 ` [PATCH 1/3] RedfishClientPkg/Crt: Add CRT header files Abner Chang
@ 2021-08-11  6:03 ` Abner Chang
  2021-08-11  6:03 ` [PATCH 3/3] RedfishClientPkg: Add external libraries Abner Chang
  2021-08-11  7:48 ` [PATCH 0/3] Use RedfishPkg libraries Nickle Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Abner Chang @ 2021-08-11  6:03 UTC (permalink / raw)
  To: devel; +Cc: Nickle Wang, Liming Gao

Private header file for using JsonLib.
- Add missing definition in jansson.h due to build error in RedfishLib
- Remove duplicated defines.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 RedfishClientPkg/RedfishClientPkg.dec     |  1 +
 RedfishClientPkg/PrivateInclude/jansson.h | 71 +++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 RedfishClientPkg/PrivateInclude/jansson.h

diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index 832cdc6154..8fa92d5b1e 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -16,6 +16,7 @@
   Include
 
 [Includes.Common.Private]
+  PrivateInclude                # Private header files
   PrivateInclude/Crt            # Private header files for C RTL.
 
 [Protocols]
diff --git a/RedfishClientPkg/PrivateInclude/jansson.h b/RedfishClientPkg/PrivateInclude/jansson.h
new file mode 100644
index 0000000000..dccbffca72
--- /dev/null
+++ b/RedfishClientPkg/PrivateInclude/jansson.h
@@ -0,0 +1,71 @@
+/*
+ This is the wrapper of open source jansson header file for
+ using JsonLib library under RedfishPkg.
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+ */
+
+#ifndef REDFISH_CLIENT_JANSSON_H_
+#define REDFISH_CLIENT_JANSSON_H_
+
+#include <Uefi.h>
+#include <Library/JsonLib.h>
+
+typedef EDKII_JSON_VALUE  json_t;
+typedef EDKII_JSON_INT_T  json_int_t;
+typedef EDKII_JSON_TYPE   json_type;
+
+#define JSON_INDENT(n)      EDKII_JSON_INDENT(n)
+#define JSON_ENSURE_ASCII   EDKII_JSON_ENSURE_ASCII
+#define JSON_OBJECT         EdkiiJsonTypeObject
+#define JSON_ARRAY          EdkiiJsonTypeArray
+#define JSON_STRING         EdkiiJsonTypeString
+#define JSON_INTEGER        EdkiiJsonTypeInteger
+#define JSON_REAL           EdkiiJsonTypeReal
+#define JSON_TRUE           EdkiiJsonTypeTrue
+#define JSON_FALSE          EdkiiJsonTypeFalse
+#define JSON_NULL           EdkiiJsonTypeNull
+
+#define json_object_foreach_safe(object, n, key, value) EDKII_JSON_OBJECT_FOREACH_SAFE(object, n, key, value)
+
+//
+// Macros that directly map functions to JsonLib
+//
+#define json_object_get(json_t, key)                JsonObjectGetValue(json_t, key)
+#define json_object_size(json_t)                    JsonObjectSize(json_t)
+#define json_array_get(json_t, index)               JsonArrayGetValue(json_t, index)
+#define json_array_size(json_t)                     JsonArrayCount(json_t)
+#define json_string_value(json_t)                   JsonValueGetAsciiString(json_t)
+#define json_dumps(json_t, flags)                   JsonDumpString(json_t, flags)
+#define json_loads(string, flags, error)            JsonLoadString(string, flags, error)
+#define json_loadb(buffer, buflen, flags, error)    JsonLoadBuffer(buffer, buflen, flags, error)
+#define json_array_append_new(json_t_array, json_t) JsonArrayAppendValue(json_t_array, json_t)
+#define json_object_set_new(json_t, key, value)     JsonObjectSetValue(json_t, key, value)
+#define json_decref(json_t)                         JsonDecreaseReference(json_t)
+#define json_integer_value(json_t)                  JsonValueGetInteger(json_t)
+#define json_is_object(json_t)                      JsonValueIsObject(json_t)
+#define json_is_array(json_t)                       JsonValueIsArray(json_t)
+#define json_is_string(json_t)                      JsonValueIsString(json_t)
+#define json_is_integer(json_t)                     JsonValueIsInteger(json_t)
+#define json_is_number(json_t)                      JsonValueIsNumber(json_t)
+#define json_is_boolean(json_t)                     JsonValueIsBoolean(json_t)
+#define json_is_true(json_t)                        JsonValueIsTrue(json_t)
+#define json_is_false(json_t)                       JsonValueIsFalse(json_t)
+#define json_is_null(json_t)                        JsonValueIsNull(json_t)
+#define json_incref(json_t)                         JsonIncreaseReference(json_t)
+#define json_object_set(json_t, key, value)         JsonObjectSetValue(json_t, key, value)
+#define json_array_append(json_t, value)            JsonArrayAppendValue(json_t, value)
+#define json_object_iter(json_t)                    JsonObjectIterator(json_t)
+#define json_object_iter_next(json_t, iter)         JsonObjectIteratorNext(json_t, iter)
+#define json_object_iter_value(iter)                JsonObjectIteratorValue(iter)
+#define json_get_type(json_t)                       JsonGetType(json_t)
+
+#define json_object()                               JsonValueInitObject()
+#define json_array()                                JsonValueInitArray()
+#define json_string(string)                         JsonValueInitAsciiString(string)
+#define json_integer(value)                         JsonValueInitInteger(value)
+#define json_boolean(value)                         JsonValueInitBoolean(value)
+#define json_null()                                 JsonValueInitNull()
+#endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] RedfishClientPkg: Add external libraries
  2021-08-11  6:03 [PATCH 0/3] Use RedfishPkg libraries Abner Chang
  2021-08-11  6:03 ` [PATCH 1/3] RedfishClientPkg/Crt: Add CRT header files Abner Chang
  2021-08-11  6:03 ` [PATCH 2/3] RedfishClientPkg/PrivateInclude: Private header file of JsonLib Abner Chang
@ 2021-08-11  6:03 ` Abner Chang
  2021-08-11  7:48 ` [PATCH 0/3] Use RedfishPkg libraries Nickle Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Abner Chang @ 2021-08-11  6:03 UTC (permalink / raw)
  To: devel; +Cc: Nickle Wang, Liming Gao

Add external RedfishPkg libraries to RedfishClientPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 RedfishClientPkg/RedfishClientPkg.dsc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/RedfishClientPkg/RedfishClientPkg.dsc b/RedfishClientPkg/RedfishClientPkg.dsc
index f423bf3861..adb50cec21 100644
--- a/RedfishClientPkg/RedfishClientPkg.dsc
+++ b/RedfishClientPkg/RedfishClientPkg.dsc
@@ -32,6 +32,10 @@
   DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
+  Ucs2Utf8Lib|RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
+  RedfishCrtLib|RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
+  BaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
   #
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Use RedfishPkg libraries
  2021-08-11  6:03 [PATCH 0/3] Use RedfishPkg libraries Abner Chang
                   ` (2 preceding siblings ...)
  2021-08-11  6:03 ` [PATCH 3/3] RedfishClientPkg: Add external libraries Abner Chang
@ 2021-08-11  7:48 ` Nickle Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Nickle Wang @ 2021-08-11  7:48 UTC (permalink / raw)
  To: Chang, Abner (HPS SW/FW Technologist), devel@edk2.groups.io; +Cc: Liming Gao

I reviewed entire series of patch.

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

-----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com> 
Sent: Wednesday, August 11, 2021 2:03 PM
To: devel@edk2.groups.io
Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH 0/3] Use RedfishPkg libraries

Add private header files that are used by the drivers/libraries under RedfishClientPkg for using JsonLib and RedfishCrtLib in RedfishPkg.
Currently we refer to the RedfishCrtLib under RedfishPkg/PrivateLibrary, however RedfishCrtLib would be public for other packages later.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Abner Chang (3):
  RedfishClientPkg/Crt: Add CRT header files
  RedfishClientPkg/PrivateInclude: Private header file of JsonLib
  RedfishClientPkg: Add external libraries

 RedfishClientPkg/RedfishClientPkg.dec        |  4 +-
 RedfishClientPkg/RedfishClientPkg.dsc        |  4 ++
 RedfishClientPkg/PrivateInclude/Crt/stdarg.h | 14 ++++  RedfishClientPkg/PrivateInclude/Crt/stdio.h  | 14 ++++  RedfishClientPkg/PrivateInclude/Crt/stdlib.h | 15 +++++  RedfishClientPkg/PrivateInclude/Crt/string.h | 15 +++++
 RedfishClientPkg/PrivateInclude/jansson.h    | 71 ++++++++++++++++++++
 7 files changed, 136 insertions(+), 1 deletion(-)  create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdarg.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdio.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/stdlib.h
 create mode 100644 RedfishClientPkg/PrivateInclude/Crt/string.h
 create mode 100644 RedfishClientPkg/PrivateInclude/jansson.h

--
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-11  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-11  6:03 [PATCH 0/3] Use RedfishPkg libraries Abner Chang
2021-08-11  6:03 ` [PATCH 1/3] RedfishClientPkg/Crt: Add CRT header files Abner Chang
2021-08-11  6:03 ` [PATCH 2/3] RedfishClientPkg/PrivateInclude: Private header file of JsonLib Abner Chang
2021-08-11  6:03 ` [PATCH 3/3] RedfishClientPkg: Add external libraries Abner Chang
2021-08-11  7:48 ` [PATCH 0/3] Use RedfishPkg libraries Nickle Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox