Skip to contentSkip to conversation

tools: env: bug: config structs must be defined in tools library

PATCH In review Andreas Fenkart 3 participants 3 messages Mar 25, 2016 – Mar 27, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: env: bug: config structs must be defined in tools library

fw_senten/fw_printenv can be compiled as a tools library, excluding the fw_env_main object.

---
 tools/env/fw_env.c      | 4 ++++
 tools/env/fw_env_main.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/env/fw_env.c +4 -0
index ee17a69..2533dc4 100644
@@ -34,6 +34,10 @@
 
 #include "fw_env.h"
 
+struct common_args common_args;
+struct printenv_args printenv_args;
+struct setenv_args setenv_args;
+
 #define DIV_ROUND_UP(n, d)	(((n) + (d) - 1) / (d))
 
 #define WHITESPACE(c) ((c == '\t') || (c == ' '))
tools/env/fw_env_main.c +0 -4
index 4bd4216..3065de9 100644
@@ -49,10 +49,6 @@ static struct option long_options[] = {
 	{NULL, 0, NULL, 0}
 };
 
-struct common_args common_args;
-struct printenv_args printenv_args;
-struct setenv_args setenv_args;
-
 void usage_printenv(void)
 {
 
Signature · 1 line
2.8.0.rc3
#1 lore raw

PATCH 1/1 tools: env: bug: config structs must be defined in tools library

Hi Andreas,

Quoted 15 lines · Andreas Fenkart

fw_senten/fw_printenv can be compiled as a tools library, excluding the fw_env_main object.

---
 tools/env/fw_env.c      | 4 ++++
 tools/env/fw_env_main.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/env/fw_env.c +0 -0
index ee17a69..2533dc4 100644

tools/env/fw_env.c line 40

Quoted 7 lines
tools/env/fw_env.c +4 -0
@@ -34,6 +34,10 @@
 
 #include "fw_env.h"
 
+struct common_args common_args;
+struct printenv_args printenv_args;
+struct setenv_args setenv_args;
+

This solves linking, but this makes the functions not reentrant. What about to pass the parameters to the exported functions without any global structure ?

Quoted 9 lines
tools/env/fw_env.c +0 -0
 #define DIV_ROUND_UP(n, d)	(((n) + (d) - 1) / (d))
 
 #define WHITESPACE(c) ((c == '\t') || (c == ' '))
tools/env/fw_env_main.c +0 -0
index 4bd4216..3065de9 100644

tools/env/fw_env_main.c static struct option long_options[] = { · line 54

Quoted 10 lines
tools/env/fw_env_main.c +0 -4
@@ -49,10 +49,6 @@ static struct option long_options[] = {
 	{NULL, 0, NULL, 0}
 };
 
-struct common_args common_args;
-struct printenv_args printenv_args;
-struct setenv_args setenv_args;
-
 void usage_printenv(void)
 {
 

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw
In reply to Andreas Fenkart
Quoted 5 lines · Andreas Fenkart

fw_senten/fw_printenv can be compiled as a tools library, excluding the fw_env_main object.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160327/62abaf7e/attachment.sig>