From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fb.mail.gandi.net (spool8.mail.gandi.net [217.70.178.217]) by nmboxes7-ms7.sd4.0x35.net (Postfix) with ESMTPS id 2B4D761930 for ; Tue, 16 Jan 2024 05:08:11 +0000 (UTC) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by fb.mail.gandi.net (Postfix) with ESMTPS id 7395060376 for ; Tue, 16 Jan 2024 05:08:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kxVFxY/zBcIzKTV4oEdrAQGjb0v1YaKOeMhyPdbQWn4=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1705381689; v=1; b=ms+2iAy0wT5G1jdgOHV4uIPPoDYAEG1O65MSx3fcLZ1QHJjzC1wNJKRb7hIJkwCVJbznT1tE 3vv3M/atcG8W7CYyPXIr8k5g76aYpVrrcSwld+R5PXDTxm75Mj2Fo2eJOv9scMg6NAgJFn10vUL tO2w6lNDgEVqUA/1jjYDsUz0= X-Received: by 127.0.0.2 with SMTP id wQz5YY7687511xqB7BEfMdk6; Mon, 15 Jan 2024 21:08:09 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.70]) by mx.groups.io with SMTP id smtpd.web10.4180.1705378088714745940 for ; Mon, 15 Jan 2024 20:08:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Akg99UYTrcCNGGhNoOjGlxDNBt25KU52AEHutNfMZFerYbaWwgCJdjsCgZbHOcrtSrYsOQ+20jTueKQOqvkH6s5a+KT2Gs6o1iV+fyyLlGWl3qzxEFpilxBEZamAh5tazZIq0h66zxSDlh22DofsN8eJb17WgmTU/ANvIT304JxAfH7FxWtiTQrt5fQ7g1uRtuBc1/xBuB01FlrCYhw9PSayjJ9H3FY971VBZitBBdFrQwWZaK+xq5h9KQuBDyIEujpwhRrpxdn8Y2ga/r8TtLzy59nb5ITBkiJ8i/ZjvXfODfvbLys5zbLlRLtkIF0TTdL2+BID8j5QOXR0Pw+YTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dZIv/mnU/+ZFJEe21cKF5RPP0U8P2Ml1nj/N4A+bna8=; b=iBTwxUVuZ6gB35lxaLY8bAQn2hhd12aZg1TTxOObvFSUsrv1ri26sVkXMBp94TSAjiC6U5Pu2CoWUaSe/hCybWRW+PdSKX2rRI0ztdsC3kdTkm9K0QUhyQM0VNwZ/Eref+65y7fI1iO9zMM6lrq1YWP7TN/yPZ8V/nh7s2COUU88v56nv1quOi4MFtUhoP5krLNkpL4rx32U4cbN9BdYu/8ehajjWU5W8rcziFsTtCbFU6DAryLglmAp8AFnLMq1oMoYQFds2zb35y/93A5d24Yne0fiXL+L6BRYcUu4I+wiAXyZ8qBSr+kyApgzglvAC4GZSS1dhj5DZ6nFL14Zvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by PH0PR12MB7472.namprd12.prod.outlook.com (2603:10b6:510:1e9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.26; Tue, 16 Jan 2024 04:08:05 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6%7]) with mapi id 15.20.7159.020; Tue, 16 Jan 2024 04:08:05 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib: Function to remove Redfish unchangeable properties Thread-Topic: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterLib: Function to remove Redfish unchangeable properties Thread-Index: AQHaRQc4HTeiDNjzZUSd1KJIVDmyR7DbylvggAAN14A= Date: Tue, 16 Jan 2024 04:08:05 +0000 Message-ID: References: <20240112032622.274-1-abner.chang@amd.com> <20240112032622.274-3-abner.chang@amd.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=12749c01-9a2d-4b55-9ca2-fb359cfe09c7;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2024-01-16T04:04:39Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|PH0PR12MB7472:EE_ x-ms-office365-filtering-correlation-id: 87f75b99-344c-42eb-86af-08dc1648bd8b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: S9D441KumS7CvaFTNuFq/7r8JWum3Ult9muFGXC+RMsnT637DrJadvGeE7V4d3e4ubZah5/Ze4TL7mZfzHU8YIqvgc5NBdkpCrqzvKicCXZSKZqfKXPPwkxh2XdodkCZJISH4RKli6gBnWUij4dlN0omBSJJctB3DTrzVhVTfANp5vpd4BZs3qITx7frKxvJ2sig6qiJfQG7r9hmF4TXfK69Ky6NID0AB1CPOdhf8CKPGEQiH19LilH1kWzFempcqpt7+5qF/1lm9KGZFPSZ+YfZWNGf3qYbet0hYLmAx7vSI8dUpyGbSo9bmyRMer1/k+DslbuIQ8D63Tz9QtG4LOrr0rp956YfWi4LMKkd9zygwtyMR1koHqI/uUvUMQgS+DG4D6BNkXgUTW8vP+TglOOAr6FVtcvAe/4/mn3/PMU0MeN0StX9e4r/AXQLgklIAoKQmp0g1xOGmaehCb5hRoYm3v6EjHgDJgTm91UaVGmU+9+9LOSK8P4H047G5tQnqjn5OGHLxpxOz+74/MCKsxiL+F7/lesYUeycvsVWo2X+AhorK2HjHTz2VvlBanJuAVll3x/U0eYh4f7uHAYpuuluO7tmK2g3hWPGNKWZJLVt4nYFWO0G1HIFvwcaJ1mgXAt4tezuKM84ZPB0QJjsJseF+UKhaX7cTGwUD3pVfz8= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5EHaFBn02PQ5zvxbH1VlLZmQU2ZXxQOw2yapAv5p/BUPQwO9HZkkKX7Lq4Gr?= =?us-ascii?Q?z6b3S+VQiUsz7y/jnW5zKRtgf7eATHXi/7Hq2ZSsJonb2JupnCws/P/4Dzgs?= =?us-ascii?Q?xX3izoiqL1r6fmwVd4C87y5BsxkN4IaAuDWI5icSYPlii6e8EVdWdBdKD+az?= =?us-ascii?Q?1XLKJg5RaTNqjl5eBTKYtMHrnGol61vqMRR8q2faVmUxasdwfu96eAG47xu3?= =?us-ascii?Q?l5YgRI0qqURl3R6K6kAhPwSV4/SokaX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tMwYWiDam/Y3PiAjb9Lb42Bem3JMtMSqh7n2Z+u2R+JsQz1cXVRLymL?= =?us-ascii?Q?UU50pFCToqOUTTghAFciUbOAyGSCq4+ivb7K1mxXbaJNpu8ppeBkP3lzbbYL?= =?us-ascii?Q?jMjrcT4eRxuOFZz0qPaVv5O1IMVclsndytnUj//q0ldoU4ZLniaTzpwTgH9q?= =?us-ascii?Q?8QAuhpT4B/WRjcgPeDpHa8NRx63bKgu+R7WM4MRjy79C6RdpIeoEvny4xyN3?= =?us-ascii?Q?XXjSpEg3wuosEPP3UYIGeGBEYOEXB6wZhDe2yBtXNP6x7x7upna9MaeggKs+?= =?us-ascii?Q?G80y/tD/t3w97CWnPCRdZ22vU7Q1pLQg4Z33YxFtY7vg5oODDKyDRkLKEtfr?= =?us-ascii?Q?Dj7RoIQ853YTI/v3QoNMYCJT86WIm1tHmNv8dGFAZZdNQEL3Gerc7LjKCKIq?= =?us-ascii?Q?32/7dzud7VwZ6r+zZDc=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87f75b99-344c-42eb-86af-08dc1648bd8b X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2024 04:08:05.3118 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vxoT1ErvEKuiARmQaB6XWMZSbLpadIAIhcQ90SYHx4yj+bWUz1gI+IdSOj2zQRiXoV6L0ptvznDUhb5UarczCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7472 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 8F83cLdfLY0ZLWlwHxMafYFhx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: fb.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ms+2iAy0; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (fb.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] > -----Original Message----- > From: Nickle Wang > Sent: Tuesday, January 16, 2024 11:18 AM > To: Chang, Abner ; devel@edk2.groups.io > Cc: Igor Kulchytskyy > Subject: RE: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/ConverterL= ib: > Function to remove Redfish unchangeable properties > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > I found typos. Please see below. > > Regards, > Nickle > > > -----Original Message----- > > From: abner.chang@amd.com > > Sent: Friday, January 12, 2024 11:26 AM > > To: devel@edk2.groups.io > > Cc: Nickle Wang ; Igor Kulchytskyy > > 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 > > > > Update RedfishCsCommon.c to add a function to remove Redfish > unchangeable > > properties. > > > > Signed-off-by: Abner Chang > > Cc: Nickle Wang > > Cc: Igor Kulchytskyy > > --- > > .../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 s= till update the read only property defined in schema such as BootOptions. T= hus 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 =3D=3D NULL) || (NewJsonBuffer =3D=3D NULL)) { > > + return RedfishCS_status_invalid_parameter; > > + } > > + > > + JsonObj =3D json_loads (JsonString, 0, NULL); if (JsonObj =3D=3D NU= LL) { > > + 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 =3D json_dumps ((json_t *)JsonObj, JSON_INDENT (2)); > > + if (TempChar !=3D NULL) { > > + if ((strlen (TempChar) + 1) > BuufferSize) { > > + Status =3D RedfishCS_status_insufficient_memory; > > + } else { > > + memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1); > > + free (TempChar); > > + Status =3D RedfishCS_status_success; > > + } > > + } else { > > + Status =3D RedfishCS_status_unknown_error; > > + } > > + json_decref(JsonObj); > > + return Status; > > +} > > + > > -- > > 2.37.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113864): https://edk2.groups.io/g/devel/message/113864 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-