From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E6C27AC0A5F for ; Fri, 12 Jan 2024 03:23:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fVr/GTsCZwbmiQ+AjEmOyZ5k4D0UT5H7RC6KWSEXafY=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705029834; v=1; b=OYvTaIUhKA4NN8geMGgAKHYM05B8xWgY8hUmtKMBbfledpUs7Am4zXMn6Ur4attU+aFae1a9 bjoKI+gEJX7uRxnfc4nxL6a9fVJSV1d37E2e24/oR0Aw/yTKq4YFHEVV2fCFxS4X/VzycQmbHUI zKgslC1KHDxWp+5EVntDu2uo= X-Received: by 127.0.0.2 with SMTP id 9mdqYY7687511xFGJF67LSwZ; Thu, 11 Jan 2024 19:23:54 -0800 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.60]) by mx.groups.io with SMTP id smtpd.web10.11603.1705029833716680660 for ; Thu, 11 Jan 2024 19:23:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTy/HudXMCsBOJcBl2Tscx0VUnpUf361yRpjeecAoUd6d723uXqyaC2OKJ+FCveefg+XC3VhOQF7/6zZmf1ENmj3xy8pS4iG2LeKZiUVqg42MS6MFH4+pQHOOnaOFKQvnAuO4E9JTNkVpbkR+q8SLzZs9sKeLtlWcWNLA4B+X3azNjZg1MYaezV1RFYyg/NUaWUa/IfnMOm71v0vBR7Ncs7fLsR/eIVKFF5q5mYV8ysqVvLYHCYB+Pj+XOZbNRnDwOBln4cBk74nOuYb6EJ7L0cQ2ynbXndSvuGRO+GVKc9lgZXY77IMuUhOwQtMEjJaePd2fhSGSwAZ8RCE90KegQ== 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=X7mCDe/G6jX+ccUWigoII6oj1873mXrXWwc9AkgDH6o=; b=IxJAeTHGUGYFAipbyjVlfkGwh7LXQS/wQORQO5pweAiPyt/mCMv4tAzoM9/gCh3ptj9ZUh4DGCMEKYEvFlFpVzAQLvyuxAPAEK9/77k3q1hUXKoLo1VivL4LByhrOxs4Chjy/i9knJXu9/NEoO2CuvagLEQsg9nUDPIsy+NHbniYJ1FbUTN+S9tCOFOvY8b15Ng05hPheH/f4LIzOPtEL/AvbQgEoyjQhRI3FenZJuhTZOoz1KUPGjT94Hipvi6poOOsMOTTspIi/acx7v2RB/3mxS9YUlnZM9FU5pRUrdlsCfTC69CLfkZDCBImxXu0rSSwTce9Dz4qFhjjkCNRYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) X-Received: from BYAPR07CA0080.namprd07.prod.outlook.com (2603:10b6:a03:12b::21) by PH7PR12MB6833.namprd12.prod.outlook.com (2603:10b6:510:1af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Fri, 12 Jan 2024 03:23:51 +0000 X-Received: from CO1PEPF000044EF.namprd05.prod.outlook.com (2603:10b6:a03:12b:cafe::db) by BYAPR07CA0080.outlook.office365.com (2603:10b6:a03:12b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18 via Frontend Transport; Fri, 12 Jan 2024 03:23:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044EF.mail.protection.outlook.com (10.167.241.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Fri, 12 Jan 2024 03:23:50 +0000 X-Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 11 Jan 2024 21:23:48 -0600 From: "Chang, Abner via groups.io" To: CC: Nickle Wang , Igor Kulchytskyy Subject: [edk2-devel] [RESEND PATCH] RedfishPkg/JsonLib: Add JSON delete object function Date: Fri, 12 Jan 2024 11:23:35 +0800 Message-ID: <20240112032335.736-1-abner.chang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EF:EE_|PH7PR12MB6833:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e6c7667-53e2-485c-cd4d-08dc131de5a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Yi56+WZTmVyfFCgrXwRbHjDJdTXmdLyBmEFM1+p+RemhG7G9KJtltsDAfs2GfgShWqGF0sDIDNjsO0y9RqVrFEygfE3bEJSkkOrOmWzEIE7aswj1XqSxZEF+FsSdimoOhfhpLEiY62DeMQd6suZIeeYSi7Tep35W3SGmhwkk+KYs+SKBTEenSTGNDuybW0V90fRZGzdB6rhylH9T+UpES0dRAtsiBMm4LcyZMdGR6EtZznnb2wv+7AOclZXE2CCou3RRUk4zafyNIb5pr386ZGd5xUIvE140zmaGlzguT4ILFO4zKuP4urTeWK7DgYi1NSDovsMfVXWuA0rfcKik+TFUnBNNm/muLw+gzxdErniYGXmYnv/1brZc9HoUtgbQ4NUrUZEyRdhBULr+ZrrmnFZY9vi7v7FV3IDrFXbqAF5gSEn1Y/32fKcseOMIrdN4v9Z7vklYACIAecYI84u/JNakxVjg/qbAeapUBtZkbZSLt6m8retaY1rz5ITs09xfvoOdO3gZs1tE18M0qgkB6hRdLeTmXu70dgINDwjD2cfyY7NVj5jcgGSIqkK4A770Gv8huQeece58Qa/1XC8oFkRYmAQF3Toah71x9MA/yw+OOzR27F5WFUy0HB4f8OGa3G7GNiMSVMXUuQ+Pw73seziKW9jpylNLShZdYK7+YbzPWGtr++LRbEHLNaiwoaeMNLIkkZWhdJyQMhhOpZyOAbOjg8IS6SdyDLFy42jnDjJr9UGo2wDmVbouYDuE6EyvNTCR7LWrn9y0DtN0rWrobA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2024 03:23:50.5927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e6c7667-53e2-485c-cd4d-08dc131de5a1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6833 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: aEcH2gTeNRGpx49ZFBBCuIAcx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=OYvTaIUh; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Abner Chang Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy --- RedfishPkg/Include/Library/JsonLib.h | 17 +++++++++++++++++ RedfishPkg/Library/JsonLib/JsonLib.c | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/RedfishPkg/Include/Library/JsonLib.h b/RedfishPkg/Include/Libr= ary/JsonLib.h index 8f31d934148..ea252291a0e 100644 --- a/RedfishPkg/Include/Library/JsonLib.h +++ b/RedfishPkg/Include/Library/JsonLib.h @@ -656,6 +656,23 @@ JsonObjectSetValue ( IN EDKII_JSON_VALUE Json ); =20 +/** + The function is used to delete a JSON key from the given JSON bject, + + @param[in] JsonObj The provided JSON object. + @param[in] Key The key of the JSON value to be dele= ted. + + @retval EFI_ABORTED Some error occur and operation abort= ed. + @retval EFI_SUCCESS The JSON value has been deleted from= this JSON object. + +**/ +EFI_STATUS +EFIAPI +JsonObjectDelete ( + IN EDKII_JSON_OBJECT JsonObj, + IN CONST CHAR8 *Key + ); + /** The function is used to get the number of elements in a JSON array. Retu= rns or 0 if JsonArray is NULL or not a JSON array. diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c b/RedfishPkg/Library/Json= Lib/JsonLib.c index 6c3373d205c..b7be4d61766 100644 --- a/RedfishPkg/Library/JsonLib/JsonLib.c +++ b/RedfishPkg/Library/JsonLib/JsonLib.c @@ -810,6 +810,30 @@ JsonObjectSetValue ( } } =20 +/** + The function is used to delete a JSON key from the given JSON bject + + @param[in] JsonObj The provided JSON object. + @param[in] Key The key of the JSON value to be dele= ted. + + @retval EFI_ABORTED Some error occur and operation abort= ed. + @retval EFI_SUCCESS The JSON value has been deleted from= this JSON object. + +**/ +EFI_STATUS +EFIAPI +JsonObjectDelete ( + IN EDKII_JSON_OBJECT JsonObj, + IN CONST CHAR8 *Key + ) +{ + if (json_object_del ((json_t *)JsonObj, (const char *)Key) !=3D 0) { + return EFI_ABORTED; + } else { + return EFI_SUCCESS; + } +} + /** The function is used to get the number of elements in a JSON array. Retu= rns or 0 if JsonArray is NULL or not a JSON array. --=20 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 (#113646): https://edk2.groups.io/g/devel/message/113646 Mute This Topic: https://groups.io/mt/103676885/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-