[edk2-devel] [edk2-redfish-client][RFC PATCH 0/3] RedfishClientPkg: fix GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
This set contains fixes for proper nodes handling in GetRedpathNodeByIndex().
It fixes handling of nodes with Index different from 0,
it removes leading '/' returned for section with Index = 0,
also it fixes return of the last section.

This set does not have any impact to 
existing code,
because in all places this function is used to obtain the end of the first 
section.
And actually returned pointer to the requested section is not used.
The current usages is:
   GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &EndOfChar);

and return of EndOfChar value is not affected by this set.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117065): https://edk2.groups.io/g/devel/message/117065
Mute This Topic: https://groups.io/mt/105101990/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 1/3] RedfishClientPkg: fix nodes count in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
This patch fixes work of GetRedpathNodeByIndex() function with non zero
Index argument. NumberNodes value was not changed after the new node
found. This means that before this patch modified function worked only
in case of Index = 0.

Debug output for the initial case:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:
 GetRedpathNodeByIndex[2]:
 GetRedpathNodeByIndex[3]:
 GetRedpathNodeByIndex[4]:
 GetRedpathNodeByIndex[5]:

After this patch the output is as following:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:

Note: it is supposed that caller will set terminating '\0' explicitly
at the next position pointed by returned EndOfNodePtr value.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index cc2b37b79605..3231ef883379 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1320,6 +1320,7 @@ GetRedpathNodeByIndex (
 return NodeStart;
   } else {
 NodeStart = NodeString + StringIndex + 1;
+NumberNodes++;
   }
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117066): https://edk2.groups.io/g/devel/message/117066
Mute This Topic: https://groups.io/mt/105101991/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 2/3] RedfishClientPkg: fix the last field processing in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
After processing of nodes was fixed it was revealed that this function
is not handling the last node correctly. The problem is that the end
of node detected by comparing to L'/', but usually ConfigLang and other
properties do not have terminating separator (i.e '/'). So, before this
patch the situation was as below:

 @Redfish.Settings found: /redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes: 6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:

And after this patch the debug output is:

 @Redfish.Settings found: /redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes: 6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:Settings

The section with Index=5 is found and returned correctly.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 5 +
 1 file changed, 5 insertions(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 3231ef883379..b0a3b20a40bd 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1327,6 +1327,11 @@ GetRedpathNodeByIndex (
 StringIndex++;
   }
 
+  if (NumberNodes == Index) {
+*EndOfNodePtr = NodeString + StringIndex - 1;
+return NodeStart;
+  }
+
   return (NULL);
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117067): https://edk2.groups.io/g/devel/message/117067
Mute This Topic: https://groups.io/mt/105101992/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 3/3] RedfishClientPkg: fix the first node processing in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
For node with index 0, the result of this function contains leading L'/'
character. But for other nodes no such characters (separators) returned.
Make processing of all fields consistent.

After this patch the debug output for specified URI is the following:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:Settings

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index b0a3b20a40bd..c55dc2ee6d05 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1304,7 +1304,7 @@ GetRedpathNodeByIndex (
   NumberNodes = 0;
   StringLen   = StrLen (NodeString);
   StringIndex = 1; // ConfigLang always starts with '/'.
-  NodeStart   = NodeString;
+  NodeStart   = NodeString + StringIndex;
   if (EndOfNodePtr != NULL) {
 *EndOfNodePtr = NULL;
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117068): https://edk2.groups.io/g/devel/message/117068
Mute This Topic: https://groups.io/mt/105101993/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility

2024-03-23 Thread Ashraf Ali S
Reviewed-by: S, Ashraf Ali 

Thanks.,
S, Ashraf Ali

-Original Message-
From: Liu, Zhiguang  
Sent: Monday, March 18, 2024 2:39 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Duggapu, Chinni B 
; Zeng, Star ; Kuo, Ted 
; S, Ashraf Ali ; Mohapatra, Susovan 

Subject: [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 
compatibility

Updated iterator usage for Python 3 compatibility
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Duggapu Chinni B 
Cc: Star Zeng 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Signed-off-by: Zhiguang Liu 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py 
index 0cab73255d..fd7476d576 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -720,7 +720,7 @@ class Symbols:
 def getModGuid(self, var):
 guid = (guid for guid,name in self.dictGuidNameXref.items() if 
name==var)
 try:
-value = guid.next()
+value = next(guid)
 except Exception:
 raise Exception("Unknown module name %s !" % var)
 return value
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117069): https://edk2.groups.io/g/devel/message/117069
Mute This Topic: https://groups.io/mt/104999189/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-