* [PATCH 5/7] net: wget: make wget_with_dns return value compatible with its lwip version
@ 2024-11-06 13:04 Adriano Cordova
2024-11-08 17:32 ` Heinrich Schuchardt
0 siblings, 1 reply; 2+ messages in thread
From: Adriano Cordova @ 2024-11-06 13:04 UTC (permalink / raw)
To: u-boot
Cc: joe.hershberger, rfried.dev, jerome.forissier, xypron.glpk,
Adriano Cordova
There are two wget_with_dns functions, one in the legacy network
stack and one in lwip, but the return values are not compatible.
This commit modifies the legacy version of wget_with_dns so that
the return values are compatible: 0 on success, otherwise a negative
error. This way wget_with_dns can be called in a network stack
agnostic way.
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
net/wget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wget.c b/net/wget.c
index 24be0a4932..6cf721070b 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -576,7 +576,7 @@ int wget_with_dns(ulong dst_addr, char *uri)
out:
free(str_copy);
- return ret;
+ return ret < 0 ? ret : 0;
}
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5/7] net: wget: make wget_with_dns return value compatible with its lwip version
2024-11-06 13:04 [PATCH 5/7] net: wget: make wget_with_dns return value compatible with its lwip version Adriano Cordova
@ 2024-11-08 17:32 ` Heinrich Schuchardt
0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2024-11-08 17:32 UTC (permalink / raw)
To: Adriano Cordova
Cc: joe.hershberger, rfried.dev, jerome.forissier, u-boot,
Ilias Apalodimas
On 11/6/24 14:04, Adriano Cordova wrote:
> There are two wget_with_dns functions, one in the legacy network
> stack and one in lwip, but the return values are not compatible.
> This commit modifies the legacy version of wget_with_dns so that
> the return values are compatible: 0 on success, otherwise a negative
> error. This way wget_with_dns can be called in a network stack
> agnostic way.
>
> Signed-off-by: Adriano Cordova <adrianox@gmail.com>
> ---
> net/wget.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/wget.c b/net/wget.c
> index 24be0a4932..6cf721070b 100644
> --- a/net/wget.c
> +++ b/net/wget.c
> @@ -576,7 +576,7 @@ int wget_with_dns(ulong dst_addr, char *uri)
> out:
> free(str_copy);
>
> - return ret;
> + return ret < 0 ? ret : 0;
include/net-lwip.h descibes wget with dns() as
Return: downloaded file size, negative if failed
There is a second definition in net/common.h with
Return: downloaded file size, negative if failed
Your change does not match the declaration in the includes.
The function should only be defined in one include, i.e. net_common.h.
Function try_load_from_uri_path() uses
env_get_hex("filesize", 0)
to retrieve the file size. Isn't it be preferable to use the return
value of wget with dns() instead?
There is ongoing work to load installation images via http and boot from
these. If we return the filesize, the return type should be ssize_t to
avoid a 2 GiB limit on the filesize.
Best regards
Heinrich
> }
> #endif
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-08 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 13:04 [PATCH 5/7] net: wget: make wget_with_dns return value compatible with its lwip version Adriano Cordova
2024-11-08 17:32 ` Heinrich Schuchardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox