Skip to contentSkip to conversation

cmd: ufetch: print Net feature when NET_LWIP=y, prettyfy if NET=n

PATCH Superseded Quentin Schulz 3 participants 6 messages Apr 28 – May 4

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover cmd: ufetch: print Net feature when NET_LWIP=y, prettyfy if NET=n

Make sure the Net feature is printed when NET_LWIP is enabled, not only when NET_LEGACY is.

Only print comma and following whitespace as separator if there was a feature printed before feature to be printed.

---
Quentin Schulz (2):
cmd: ufetch: show net feature when NET_LWIP is selected
cmd: ufetch: only show comma separator if there was a previous feature

 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

---
base-commit: 4433253ecf2041f9362a763bb6cb79960921ac7e
change-id: 20260428-ufetch-net-1ba7553a20c7

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

PATCH 1/2 cmd: ufetch: show net feature when NET_LWIP is selected

From: Quentin Schulz <[email protected]>

We've had a new lwIP networking stack for a couple of years already, so let's show there is a "net" feature if it's selected. Since NET_LEGACY || NET_LWIP is the same as NET, let's check on NET.

---
 cmd/ufetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/ufetch.c +1 -1
index f8dc904bdd0..bc5db08eee1 100644
@@ -159,7 +159,7 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
 			break;
 		case FEATURES:
 			printf("Features:" RESET " ");
-			if (IS_ENABLED(CONFIG_NET_LEGACY))
+			if (IS_ENABLED(CONFIG_NET))
 				printf("Net");
 			if (IS_ENABLED(CONFIG_EFI_LOADER))
 				printf(", EFI");
Signature · 1 line
2.54.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] cmd: ufetch: show net feature when NET_LWIP is selected

Quoted 6 lines · Quentin Schulz

cmd: ufetch: show net feature when NET_LWIP is selected

We've had a new lwIP networking stack for a couple of years already, so let's show there is a 'net' feature if it's selected. Since NET_LEGACY || NET_LWIP is the same as NET, let's check on NET.

Quoted 6 lines

cmd/ufetch.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH 2/2 cmd: ufetch: only show comma separator if there was a previous feature

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

Currently, if NET is disabled, the next feature to be printed will start with a comma and a space which is not pretty. Add the comma and whitespace only when a previous feature has already been shown.

---
 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
cmd/ufetch.c +20 -9
index bc5db08eee1..5c0d09c07bf 100644
@@ -157,26 +157,37 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
 				printf(" (%d baud)", gd->baudrate);
 			putc('\n');
 			break;
-		case FEATURES:
+		case FEATURES: {
+			bool sep = false;
+
 			printf("Features:" RESET " ");
-			if (IS_ENABLED(CONFIG_NET))
-				printf("Net");
-			if (IS_ENABLED(CONFIG_EFI_LOADER))
-				printf(", EFI");
-			if (IS_ENABLED(CONFIG_CMD_CAT))
-				printf(", cat :3");
+			if (IS_ENABLED(CONFIG_NET)) {
+				printf("%sNet", sep ? ", " : "");
+				sep = true;
+			}
+			if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+				printf("%sEFI", sep ? ", " : "");
+				sep = true;
+			}
+			if (IS_ENABLED(CONFIG_CMD_CAT)) {
+				printf(":%scat :3", sep ? ", " : "");
+				sep = true;
+			}
 #ifdef CONFIG_ARM64
 			switch (current_el()) {
 			case 2:
-				printf(", VMs");
+				printf("%sVMs", sep ? ", " : "");
+				sep = true;
 				break;
 			case 3:
-				printf(", full control!");
+				printf("%sfull control!", sep ? ", " : "");
+				sep = true;
 				break;
 			}
 #endif
 			printf("\n");
 			break;
+		}
 		case RELOCATION:
 			if (gd->flags & GD_FLG_SKIP_RELOC)
 				printf("Relocated:" RESET " no\n");
Signature · 1 line
2.54.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] cmd: ufetch: only show comma separator if there was a previous feature

Hi Quentin,

Quoted 13 lines · Quentin Schulz

cmd: ufetch: only show comma separator if there was a previous feature

Currently, if NET is disabled, the next feature to be printed will start with a comma and a space which is not pretty. Add the comma and whitespace only when a previous feature has already been shown.

cmd/ufetch.c | 29 ++++++++++++++++++++---------

 1 file changed, 20 insertions(+), 9 deletions(-)

cmd/ufetch.c static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc, · line 160

Quoted 4 lines
cmd/ufetch.c +4 -0
@@ -157,26 +157,37 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
+                     if (IS_ENABLED(CONFIG_CMD_CAT)) {
+                             printf(":%scat :3", sep ? ", " : "");
+                             sep = true;
+                     }

Do you want the ':' before the '%s' ?

Regards,
Simon

Reviewed-by on the v1 series
#5 lore raw
In reply to Quentin Schulz
Quoted 7 lines · Quentin Schulz

Make sure the Net feature is printed when NET_LWIP is enabled, not only when NET_LEGACY is.

Only print comma and following whitespace as separator if there was a feature printed before feature to be printed.

As simon pointed out the erroneous ':', with that fixed

Quoted 15 lines

---
Quentin Schulz (2):
cmd: ufetch: show net feature when NET_LWIP is selected
cmd: ufetch: only show comma separator if there was a previous feature

 cmd/ufetch.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

---
base-commit: 4433253ecf2041f9362a763bb6cb79960921ac7e
change-id: 20260428-ufetch-net-1ba7553a20c7

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
Signature · 1 line
// Casey (she/her)