[PATCH 1/7] dhcp: add global var support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Sep 1 08:49:22 EDT 2012


On 10:40 Tue 28 Aug     , Sascha Hauer wrote:
> On Fri, Aug 24, 2012 at 07:06:50AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > This way you can specify as previously set the dhcp parameter via global.dhcp.xxx
> > and get the result via global.dhcp.xxx
> > 
> > This is need for the defaultenv-2 to add the bootp suppport.
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > ---
> >  net/dhcp.c |  100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 99 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/dhcp.c b/net/dhcp.c
> > index 79efa3e..51c4283 100644
> > --- a/net/dhcp.c
> > +++ b/net/dhcp.c
> > @@ -19,6 +19,8 @@
> >  #include <magicvar.h>
> >  #include <linux/err.h>
> >  #include <getopt.h>
> > +#include <globalvar.h>
> > +#include <init.h>
> >  
> >  #define OPT_SIZE 312	/* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
> >  
> > @@ -78,11 +80,39 @@ static IPaddr_t net_dhcp_server_ip;
> >  static uint64_t dhcp_start;
> >  static char dhcp_tftpname[256];
> >  
> > +static const char* dhcp_get_barebox_global(const char * var)
> 
> static const char *dhcp_get_barebox_global
> 
> > +{
> > +	char * var_global = asprintf("global.dhcp.%s", var);
> 
> char *var_global =
> 
> Generally I don't think we should introduce a second set of variables.
> Drop The other ones instead.
I'm ok with it as I 'm going to switch all my board to the defaultenv-2

but other people may not so the only to keep this feature on both env are

1) 2 set of var
2) use glovalbar on defaultenv

I've no preference

Best Regards,
J.



More information about the barebox mailing list