From: "Nickle Wang via groups.io" <nicklew=nvidia.com@groups.io>
To: "Chang, Abner" <Abner.Chang@amd.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib: Function to remove Redfish unchangeable properties
Date: Tue, 16 Jan 2024 06:20:02 +0000 [thread overview]
Message-ID: <MW4PR12MB7031F6A4836FEF988B80D063D9732@MW4PR12MB7031.namprd12.prod.outlook.com> (raw)
In-Reply-To: <LV8PR12MB94525413230ADAA43AF6E3D0EA732@LV8PR12MB9452.namprd12.prod.outlook.com>
> I didn't choose ReadOnly is because at BIOS perspective as a provider, we still
> update the read only property defined in schema such as BootOptions. Thus I
> thought to use ReadOnly is not quite accurate. How do you think?
I see. Thanks for your explanation. Please fix the typos and keep the function name untouched.
Regards,
Nickle
> -----Original Message-----
> From: Chang, Abner <Abner.Chang@amd.com>
> Sent: Tuesday, January 16, 2024 12:08 PM
> To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> Cc: Igor Kulchytskyy <igork@ami.com>
> Subject: RE: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib:
> Function to remove Redfish unchangeable properties
>
> External email: Use caution opening links or attachments
>
>
> [AMD Official Use Only - General]
>
> > -----Original Message-----
> > From: Nickle Wang <nicklew@nvidia.com>
> > Sent: Tuesday, January 16, 2024 11:18 AM
> > To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Subject: RE: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib:
> > Function to remove Redfish unchangeable properties
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > I found typos. Please see below.
> >
> > Regards,
> > Nickle
> >
> > > -----Original Message-----
> > > From: abner.chang@amd.com <abner.chang@amd.com>
> > > Sent: Friday, January 12, 2024 11:26 AM
> > > To: devel@edk2.groups.io
> > > Cc: Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy
> > > <igork@ami.com>
> > > Subject: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib:
> > > Function to remove Redfish unchangeable properties
> > >
> > > External email: Use caution opening links or attachments
> > >
> > >
> > > From: Abner Chang <abner.chang@amd.com>
> > >
> > > Update RedfishCsCommon.c to add a function to remove Redfish
> > unchangeable
> > > properties.
> > >
> > > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Cc: Igor Kulchytskyy <igork@ami.com>
> > > ---
> > > .../ConverterLib/include/RedfishCsCommon.h | 20 +++++++
> > > .../ConverterLib/src/RedfishCsCommon.c | 55 +++++++++++++++++++
> > > 2 files changed, 75 insertions(+)
> > >
> > > diff --git a/RedfishClientPkg/ConverterLib/include/RedfishCsCommon.h
> > > b/RedfishClientPkg/ConverterLib/include/RedfishCsCommon.h
> > > index e454ab0b73..f5278015aa 100644
> > > --- a/RedfishClientPkg/ConverterLib/include/RedfishCsCommon.h
> > > +++ b/RedfishClientPkg/ConverterLib/include/RedfishCsCommon.h
> > > @@ -104,6 +104,26 @@ DestoryCsMemory (
> > > RedfishCS_void *rootCs
> > > );
> > >
> > > +/**
> > > + This function removes the unchangeable Redfish properties from
> > > +JSON raw text
> > > + The content in JsonString is left unmodified, the caller has to
> > > +give enoungh
> > > + memory pointed by NewJsonBuffer in the size of BufferSize.
> > > +
> > > + JsonString Input JSON raw string
> > > + NewJsonBuffer Pointer to memory for the updated JSON raw string in
> > > + size of BuufferSize.
> > > + BuufferSize The buffer size of NewJsonBuffer
> > > +
> > > + Return RedfishCS_status.
> > > +
> > > +**/
> > > +RedfishCS_status
> > > +RemoveUnchangeableProperties (
> > > + RedfishCS_char *JsonString,
> > > + RedfishCS_char *NewJsonBuffer,
> > > + RedfishCS_uint32 BuufferSize
> > > + );
> >
> > BufferSize. You have double 'u' above. And how about to use ReadOnly
> > instead of "Unchangeable"?
> Thanks for catching the typo.
>
> I didn't choose ReadOnly is because at BIOS perspective as a provider, we still
> update the read only property defined in schema such as BootOptions. Thus I
> thought to use ReadOnly is not quite accurate. How do you think?
>
> Abner
>
> >
> >
> > > +
> > > typedef struct _RedfishCS_char_Array RedfishCS_char_Array;
> > > typedef struct _RedfishCS_int64_Array RedfishCS_int64_Array;
> > > typedef struct _RedfishCS_bool_Array RedfishCS_bool_Array;
> > > diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > index fd31e5296b..c6996d7d5d 100644
> > > --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > @@ -1461,3 +1461,58 @@ CsEmptyPropLinkToJson (
> > >
> > > return RedfishCS_status_success;
> > > }
> > > +
> > > +/**
> > > + This function removes the unchangeable Redfish properties from
> > > +JSON raw text
> > > + The content in JsonString is left unmodified, the caller has to
> > > +give enoungh
> > > + memory pointed by NewJsonBuffer in the size of BufferSize.
> > > +
> > > + JsonString Input JSON raw string
> > > + NewJsonBuffer Pointer to memory for the updated JSON raw string in
> > > + size of BuufferSize.
> > > + BuufferSize The buffer size of NewJsonBuffer
> > > +
> > > + Return RedfishCS_status.
> > > +
> > > +**/
> > > +RedfishCS_status
> > > +RemoveUnchangeableProperties (
> > > + RedfishCS_char *JsonString,
> > > + RedfishCS_char *NewJsonBuffer,
> > > + RedfishCS_uint32 BuufferSize
> > > + )
> >
> >
> > BufferSize. You have double 'u' above.
> >
> >
> > > +{
> > > + json_t *JsonObj;
> > > + RedfishCS_char *TempChar;
> > > + RedfishCS_status Status;
> > > +
> > > + if ((JsonString == NULL) || (NewJsonBuffer == NULL)) {
> > > + return RedfishCS_status_invalid_parameter;
> > > + }
> > > +
> > > + JsonObj = json_loads (JsonString, 0, NULL); if (JsonObj == NULL) {
> > > + return RedfishCS_status_unknown_error; }
> > > +
> > > + json_object_del (JsonObj, "@odata.type"); json_object_del
> > > + (JsonObj, "@odata.id"); json_object_del (JsonObj, "Id");
> > > + json_object_del (JsonObj, "Name");
> > > +
> > > + TempChar = json_dumps ((json_t *)JsonObj, JSON_INDENT (2));
> > > + if (TempChar != NULL) {
> > > + if ((strlen (TempChar) + 1) > BuufferSize) {
> > > + Status = RedfishCS_status_insufficient_memory;
> > > + } else {
> > > + memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
> > > + free (TempChar);
> > > + Status = RedfishCS_status_success;
> > > + }
> > > + } else {
> > > + Status = RedfishCS_status_unknown_error;
> > > + }
> > > + json_decref(JsonObj);
> > > + return Status;
> > > +}
> > > +
> > > --
> > > 2.37.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113865): https://edk2.groups.io/g/devel/message/113865
Mute This Topic: https://groups.io/mt/103676920/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-16 6:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 3:26 [edk2-devel] [edk2-redfish-client][PATCH 1/3] RedfishClientPkg/jansson: Define json_object_del Chang, Abner via groups.io
2024-01-12 3:26 ` [edk2-devel] [edk2-redfish-client][PATCH 2/3] RedfishClientPkg/RedfishFeatureUtilityLib: Add two helper functions Chang, Abner via groups.io
2024-01-16 3:14 ` Nickle Wang via groups.io
2024-01-12 3:26 ` [edk2-devel] [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib: Function to remove Redfish unchangeable properties Chang, Abner via groups.io
2024-01-16 3:17 ` Nickle Wang via groups.io
2024-01-16 4:08 ` Chang, Abner via groups.io
2024-01-16 6:20 ` Nickle Wang via groups.io [this message]
2024-01-16 8:31 ` Chang, Abner via groups.io
2024-01-16 3:07 ` [edk2-devel] [edk2-redfish-client][PATCH 1/3] RedfishClientPkg/jansson: Define json_object_del Nickle Wang via groups.io
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR12MB7031F6A4836FEF988B80D063D9732@MW4PR12MB7031.namprd12.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox