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 9D0E0941596 for ; Fri, 22 Mar 2024 09:19:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=WviPyV3NnS9yWd9JTsFIkDfYhVa0MGCTj4t4BJrh5pU=; c=relaxed/simple; d=groups.io; h=Mime-Version:Subject:From:In-Reply-To:Date:Cc:Message-Id:References:To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1711099181; v=1; b=we9OzeEHcgnDK4IS/BxK3DeutKfyrUZwZDkXkazlPvLIOzQVtLvVIWc95t/GrkkohZdJJ99D obv1qCBnmZXmjsw7a37bLFcvc+w8FVwxOx53a3grfbJoTSf0ch22EAXumqkAPvUejpPrqweisqM ShK6tSsfhiJQFqChFHEXL3gkDCmkcZF1NYsI2Rhwjs91q0zx1NsDH40PdSWeaf9ZUK1OSOK7r2w VW2fpEtb19wNdRD0KeP2MImkjMaK8bDpe4kTB43z9dZe+7dvqSJdRsbkupwUJnhhCDt84WCwhlZ lhYuL0Ybn0yXIrvDwq8+Gh6XEs8k5RRjY4jMQQKVE9NDg== X-Received: by 127.0.0.2 with SMTP id 6icHYY7687511xEJkAOCA5Dy; Fri, 22 Mar 2024 02:19:41 -0700 X-Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by mx.groups.io with SMTP id smtpd.web10.8592.1711099180232459213 for ; Fri, 22 Mar 2024 02:19:40 -0700 X-Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-513d3746950so2306084e87.1 for ; Fri, 22 Mar 2024 02:19:39 -0700 (PDT) X-Gm-Message-State: 5fPINjVI6XWUJSI5n8NYUHkWx7686176AA= X-Google-Smtp-Source: AGHT+IFMeybmwDhF7zqQRrkGq+mk3p85JekyNQ0KTLTc+qk8nPHachn69e895YE5NdQa9RuULR1HXA== X-Received: by 2002:a19:381b:0:b0:513:b90f:f4dd with SMTP id f27-20020a19381b000000b00513b90ff4ddmr1143971lfa.49.1711099177950; Fri, 22 Mar 2024 02:19:37 -0700 (PDT) X-Received: from smtpclient.apple ([195.91.209.163]) by smtp.gmail.com with ESMTPSA id i20-20020a198c54000000b00513d595f775sm283197lfj.101.2024.03.22.02.19.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2024 02:19:37 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V3 1/2] RedfishClientPkg: Set SettingsObject URI as the config language From: "Mike Maslenkin" In-Reply-To: <20240322090959.237-1-abner.chang@amd.com> Date: Fri, 22 Mar 2024 12:19:36 +0300 Cc: Igor Kulchytskyy , Nickle Wang Message-Id: <295BA3E2-90F6-456B-95D0-75393D77F13D@gmail.com> References: <20240322090959.237-1-abner.chang@amd.com> To: devel@edk2.groups.io, Abner Chang 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 Resent-Date: Fri, 22 Mar 2024 02:19:40 -0700 Reply-To: devel@edk2.groups.io,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=we9OzeEH; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=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 Hi Abner, > On 22. 3. 2024., at 12:09, Chang, Abner via groups.io wrote: >=20 > From: Abner Chang >=20 > Set SettingsObject URI in @Redfish.Settings resource as the config > language which is the same as the config language of parent URI > that mandates @Redfish.Settings. > With this, we can find the config language of the properties in > SettingsObject URI. >=20 > Signed-off-by: Abner Chang > Cc: Igor Kulchytskyy > Co-authored-by: Nickle Wang > --- > .../Library/RedfishFeatureUtilityLib.h | 17 ++++ > .../RedfishFeatureUtilityLib.c | 86 ++++++++++++++++--- > .../RedfishConfigLangMapDxe.c | 15 +++- > 3 files changed, 101 insertions(+), 17 deletions(-) >=20 > diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h = b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > index ba9ea01501..3c5f248eb7 100644 > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > @@ -369,6 +369,23 @@ RedfishSetRedfishUri ( > IN EFI_STRING Uri > ); >=20 > +/** > + > + Save Redfish SettingsObject URI in database for further use. > + > + @param[in] ParentUri Parent URI of @Redfish.Settings proper= ty. > + @param[in] SettingObjectUri Redfish SettingsObject Uri to save. > + > + @retval EFI_INVALID_PARAMETER SystemId is NULL or EMPTY > + @retval EFI_SUCCESS Redfish uri is saved > + > +**/ > +EFI_STATUS > +SetRedfishSettingsObjectsUri ( > + IN EFI_STRING ParentUri, > + IN EFI_STRING SettingObjectUri > + ); > + > /** >=20 > Get the property name by given Configure Language. > diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFea= tureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/Redfis= hFeatureUtilityLib.c > index cc2b37b796..c37bf85310 100644 > --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUti= lityLib.c > +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUti= lityLib.c > @@ -2082,7 +2082,6 @@ GetConfigureLang ( > EFI_STRING ResultStr; > EFI_STRING UnicodeUri; > EFI_STATUS Status; > - EFI_STRING StrFound; >=20 > if (IS_EMPTY_STRING (Uri)) { > return NULL; > @@ -2101,18 +2100,6 @@ GetConfigureLang ( > } >=20 > ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri); > - if (ConfigLang =3D=3D NULL) { > - // > - // @Redfish.Settings share the same schema as its parent. > - // Remove "Settings" and try again. > - // > - StrFound =3D StrStr (UnicodeUri, L"/Settings"); > - if (StrFound !=3D NULL) { > - StrFound[0] =3D L'\0'; > - DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI, try: = %s\n", __func__, UnicodeUri)); > - ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri); > - } > - } >=20 > FreePool (UnicodeUri); >=20 > @@ -2172,6 +2159,61 @@ RedfishSetRedfishUri ( > return mConfigLangMapProtocol->Set (mConfigLangMapProtocol, ConfigLang,= Uri); > } >=20 > +/** > + > + Save Redfish SettingsObject URI in database for further use. > + > + @param[in] ParentUri Parent URI of @Redfish.Settings proper= ty. > + @param[in] SettingObjectUri Redfish SettingsObject Uri to save. > + > + @retval EFI_INVALID_PARAMETER ParentUri or SettingObjectUri is NULL. > + @retval EFI_NOT_FOUND Config language for ParentUri is not f= ound. > + @retval EFI_SUCCESS Redfish URI is saved with correspondin= g > + config language. > + > +**/ > +EFI_STATUS > +SetRedfishSettingsObjectsUri ( > + IN EFI_STRING ParentUri, > + IN EFI_STRING SettingObjectUri > + ) > +{ > + EFI_STATUS Status; > + EFI_STRING ConfigLang; > + > + if ((ParentUri =3D=3D NULL) || (SettingObjectUri =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // Check if the SettingsObject URI already in the database. > + // > + ConfigLang =3D RedfishGetConfigLanguage (SettingObjectUri); > + if (ConfigLang =3D=3D NULL) { > + // > + // No config language of SettingsObject URI is found. > + // Get the config language of parent URI because the data model of > + // SettingsObject URI resource is the same as the data model of pare= nt URI. > + // > + ConfigLang =3D RedfishGetConfigLanguage (ParentUri); > + if (ConfigLang =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to get the config language of par= ent URI that mandates SettingsObject - %s.\n", __func__, ParentUri)); > + return EFI_NOT_FOUND; > + } > + > + // Set the config language of settings URI using parent's URI config= language. > + Status =3D RedfishSetRedfishUri (ConfigLang, SettingObjectUri); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Fails to set the config language of Sett= ingsObject - %s.\n", __func__, SettingObjectUri)); looks like there is ConfigLang leak in this function. > + return Status; > + } > + > + DEBUG ((DEBUG_INFO, "%a: Set the config language of SettingsObject -= %s: SUCCESS.\n", __func__, SettingObjectUri)); > + } > + > + return EFI_SUCCESS; > +} > + > /** >=20 > Get @odata.id from give HTTP payload. It's call responsibility to relea= se returned buffer. > @@ -3532,6 +3574,7 @@ CompareRedfishBooleanArrayValues ( > payload and URI to pending settings. Caller has to release "SettingPayl= oad" and > "SettingUri". >=20 > + @param[in] RedfishService Instance of REDFISH_SERVICE > @param[in] Payload Payload that may contain "@Redfish.Settings= " > @param[out] SettingPayload Payload keeps pending settings. > @param[out] SettingUri URI to pending settings. > @@ -3552,6 +3595,7 @@ GetPendingSettings ( > EDKII_JSON_VALUE JsonValue; > UINTN Index; > EFI_STATUS Status; > + EFI_STRING StrFound; >=20 > if ((RedfishService =3D=3D NULL) || (Payload =3D=3D NULL) || (SettingRe= sponse =3D=3D NULL) || (SettingUri =3D=3D NULL)) { > return EFI_INVALID_PARAMETER; > @@ -3586,6 +3630,22 @@ GetPendingSettings ( > return Status; > } >=20 > + // > + // Setting URI exists, check if settings URI is valid or not. > + // > + StrFound =3D StrStr (*SettingUri, L"/Settings"); > + if (StrFound !=3D NULL) { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI: %s\n"= , __func__, *SettingUri)); > + } else { > + StrFound =3D StrStr (*SettingUri, L"/SD"); > + if (StrFound !=3D NULL) { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"SD\" found in URI: %s\n", __= func__, *SettingUri)); > + } else { > + DEBUG ((DEBUG_ERROR, "%a: Not an valid @redfish.settings URI\n",= __func__, *SettingUri)); > + ASSERT (FALSE); > + } > + } > + > return EFI_SUCCESS; > } >=20 > diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMa= pDxe.c b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > index 8c93044580..4071e30c17 100644 > --- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > @@ -2,6 +2,7 @@ >=20 > (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights re= served. > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -606,10 +607,16 @@ RedfishConfigLangMapSet ( > Status =3D EFI_NOT_FOUND; > Target =3D FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader= , ConfigLang, FALSE); > if (Target !=3D NULL) { > - // > - // Remove old one and create new one. > - // > - Status =3D DeleteConfigLangMapRecord (&Private->ConfigLangList, Targ= et); > + if (Uri !=3D NULL) { > + if (StrCmp (Uri, Target->Uri) =3D=3D 0) { > + return EFI_SUCCESS; > + } > + } else { > + // > + // Remove old one and create new one. > + // > + Status =3D DeleteConfigLangMapRecord (&Private->ConfigLangList, Ta= rget); > + } > } >=20 > // > --=20 > 2.37.1.windows.1 Regards, Mike. -=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 (#117035): https://edk2.groups.io/g/devel/message/117035 Mute This Topic: https://groups.io/mt/105081867/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-