* [PATCH 3/7] net: wget: Add a global struct wget_http_info
@ 2024-11-06 13:03 Adriano Cordova
2024-11-07 11:21 ` Jerome Forissier
0 siblings, 1 reply; 3+ messages in thread
From: Adriano Cordova @ 2024-11-06 13:03 UTC (permalink / raw)
To: u-boot
Cc: joe.hershberger, rfried.dev, jerome.forissier, xypron.glpk,
Adriano Cordova
Declare and define a global struct wget_http_info. The default
values are so that wget works as it used to, but they can be
changed by an application before issuing an http request using
wget, and restored afterwards. This struct is common to legacy
wget and lwip wget.
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
include/net-common.h | 2 ++
net/net-common.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/net-common.h b/include/net-common.h
index 38ba95cf60..3039dfdce7 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -533,4 +533,6 @@ struct wget_http_info {
char *headers;
};
+extern struct wget_http_info wget_info;
+
#endif /* __NET_COMMON_H__ */
diff --git a/net/net-common.c b/net/net-common.c
index a7f767d5e9..e969d508cc 100644
--- a/net/net-common.c
+++ b/net/net-common.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+#include <net-common.h>
void copy_filename(char *dst, const char *src, int size)
{
@@ -11,3 +12,12 @@ void copy_filename(char *dst, const char *src, int size)
*dst++ = *src++;
*dst = '\0';
}
+
+struct wget_http_info wget_info = {
+ .method = WGET_HTTP_METHOD_GET,
+ .file_size = 0,
+ .buffer_size = 0,
+ .set_bootdev = true,
+ .check_buffer_size = false,
+ .headers = NULL,
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/7] net: wget: Add a global struct wget_http_info
2024-11-06 13:03 [PATCH 3/7] net: wget: Add a global struct wget_http_info Adriano Cordova
@ 2024-11-07 11:21 ` Jerome Forissier
2024-11-08 17:07 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Jerome Forissier @ 2024-11-07 11:21 UTC (permalink / raw)
To: Adriano Cordova, u-boot; +Cc: joe.hershberger, rfried.dev, xypron.glpk
On 11/6/24 13:03, Adriano Cordova wrote:
> Declare and define a global struct wget_http_info. The default
> values are so that wget works as it used to, but they can be
> changed by an application before issuing an http request using
> wget, and restored afterwards. This struct is common to legacy
> wget and lwip wget.
>
> Signed-off-by: Adriano Cordova <adrianox@gmail.com>
> ---
> include/net-common.h | 2 ++
> net/net-common.c | 10 ++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/include/net-common.h b/include/net-common.h
> index 38ba95cf60..3039dfdce7 100644
> --- a/include/net-common.h
> +++ b/include/net-common.h
> @@ -533,4 +533,6 @@ struct wget_http_info {
> char *headers;
> };
>
> +extern struct wget_http_info wget_info;
> +
> #endif /* __NET_COMMON_H__ */
> diff --git a/net/net-common.c b/net/net-common.c
> index a7f767d5e9..e969d508cc 100644
> --- a/net/net-common.c
> +++ b/net/net-common.c
> @@ -1,4 +1,5 @@
> // SPDX-License-Identifier: GPL-2.0
> +#include <net-common.h>
>
> void copy_filename(char *dst, const char *src, int size)
> {
> @@ -11,3 +12,12 @@ void copy_filename(char *dst, const char *src, int size)
> *dst++ = *src++;
> *dst = '\0';
> }
> +
> +struct wget_http_info wget_info = {
> + .method = WGET_HTTP_METHOD_GET,
> + .file_size = 0,
> + .buffer_size = 0,
> + .set_bootdev = true,
> + .check_buffer_size = false,
> + .headers = NULL,
> +};
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Thanks,
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/7] net: wget: Add a global struct wget_http_info
2024-11-07 11:21 ` Jerome Forissier
@ 2024-11-08 17:07 ` Heinrich Schuchardt
0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2024-11-08 17:07 UTC (permalink / raw)
To: Adriano Cordova
Cc: joe.hershberger, rfried.dev, Jerome Forissier, u-boot,
Ilias Apalodimas
On 11/7/24 12:21, Jerome Forissier wrote:
> On 11/6/24 13:03, Adriano Cordova wrote:
>> Declare and define a global struct wget_http_info. The default
>> values are so that wget works as it used to, but they can be
>> changed by an application before issuing an http request using
>> wget, and restored afterwards. This struct is common to legacy
>> wget and lwip wget.
>>
>> Signed-off-by: Adriano Cordova <adrianox@gmail.com>
>> ---
>> include/net-common.h | 2 ++
>> net/net-common.c | 10 ++++++++++
>> 2 files changed, 12 insertions(+)
>>
>> diff --git a/include/net-common.h b/include/net-common.h
>> index 38ba95cf60..3039dfdce7 100644
>> --- a/include/net-common.h
>> +++ b/include/net-common.h
>> @@ -533,4 +533,6 @@ struct wget_http_info {
>> char *headers;
>> };
>>
>> +extern struct wget_http_info wget_info;
>> +
>> #endif /* __NET_COMMON_H__ */
>> diff --git a/net/net-common.c b/net/net-common.c
>> index a7f767d5e9..e969d508cc 100644
>> --- a/net/net-common.c
>> +++ b/net/net-common.c
>> @@ -1,4 +1,5 @@
>> // SPDX-License-Identifier: GPL-2.0
>> +#include <net-common.h>
>>
>> void copy_filename(char *dst, const char *src, int size)
>> {
>> @@ -11,3 +12,12 @@ void copy_filename(char *dst, const char *src, int size)
>> *dst++ = *src++;
>> *dst = '\0';
>> }
>> +
>> +struct wget_http_info wget_info = {
>> + .method = WGET_HTTP_METHOD_GET,
>> + .file_size = 0,
>> + .buffer_size = 0,
>> + .set_bootdev = true,
>> + .check_buffer_size = false,
>> + .headers = NULL,
wget_info is a global symbol. It will be reused in every wget
transaction. The values initialized here may be overwritten in a first
transaction and the current initialization would have no impact on a
second transaction.
Please, move the initialization to the function that starts a new
transaction.
For static and global variables only used after relocation it is not
necessary to initialize members to 0 in the definition.
Best regards
Heinrich
>> +};
>
> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
>
> Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-08 17:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 13:03 [PATCH 3/7] net: wget: Add a global struct wget_http_info Adriano Cordova
2024-11-07 11:21 ` Jerome Forissier
2024-11-08 17:07 ` Heinrich Schuchardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox