mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] login: add globalvar timeout support
Date: Mon, 16 Sep 2013 16:39:24 +0200	[thread overview]
Message-ID: <20130916143924.GG21829@ns203013.ovh.net> (raw)
In-Reply-To: <20130916080202.GV30088@pengutronix.de>

On 10:02 Mon 16 Sep     , Sascha Hauer wrote:
> On Sun, Sep 15, 2013 at 01:30:51PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  commands/login.c | 26 ++++++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> > 
> > diff --git a/commands/login.c b/commands/login.c
> > index fb6bb35..f5429bc 100644
> > --- a/commands/login.c
> > +++ b/commands/login.c
> > @@ -20,6 +20,10 @@
> >  #include <complete.h>
> >  #include <password.h>
> >  #include <getopt.h>
> > +#include <environment.h>
> > +#include <globalvar.h>
> > +#include <magicvar.h>
> > +#include <init.h>
> >  
> >  #define PASSWD_MAX_LENGTH	(128 + 1)
> >  
> > @@ -31,6 +35,16 @@
> >  #define LOGIN_MODE HIDE
> >  #endif
> >  
> > +static void login_getenv_int(const char *name, int *i)
> > +{
> > +	const char* str = getenv(name);
> > +
> > +	if (!str)
> > +		return;
> > +
> > +	*i = simple_strtoul(str, NULL, 10);
> > +}
> 
> We already have getenv_ull. Should we use it here?

if I switch to dev_add_param_int no
> 
> > +
> >  static int do_login(int argc, char *argv[])
> >  {
> >  	unsigned char passwd[PASSWD_MAX_LENGTH];
> > @@ -38,6 +52,8 @@ static int do_login(int argc, char *argv[])
> >  	int timeout = 0;
> >  	char *timeout_cmd = "boot";
> >  
> > +	login_getenv_int("global.login.timeout", &timeout);
> > +
> >  	if (!is_passwd_enable()) {
> >  		puts("login: password not set\n");
> >  		return 0;
> > @@ -80,3 +96,13 @@ BAREBOX_CMD_START(login)
> >  	BAREBOX_CMD_HELP(cmd_login_help)
> >  	BAREBOX_CMD_COMPLETE(empty_complete)
> >  BAREBOX_CMD_END
> > +
> > +static int login_global_init(void)
> > +{
> > +	globalvar_add_simple("login.timeout");
> 
> globalvar_add_simple now takes an initial value, like this:
> 
> int globalvar_add_simple(const char *name, const char *value)

ok did not see the change

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-09-16 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-15 11:28 [PATCH 0/2 v2] defaultenv-2: add login support Jean-Christophe PLAGNIOL-VILLARD
2013-09-15 11:30 ` [PATCH 1/4] login: add globalvar timeout support Jean-Christophe PLAGNIOL-VILLARD
2013-09-15 11:30   ` [PATCH 2/4] login: disable input console if password wrong Jean-Christophe PLAGNIOL-VILLARD
2013-09-16  8:33     ` Sascha Hauer
2013-09-16 14:37       ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 15:15         ` Sascha Hauer
2013-09-15 11:30   ` [PATCH 3/4] login/passwd: add default password support Jean-Christophe PLAGNIOL-VILLARD
2013-09-15 11:30   ` [PATCH 4/4] defaultenv-2: add login support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16  8:02   ` [PATCH 1/4] login: add globalvar timeout support Sascha Hauer
2013-09-16 14:39     ` Jean-Christophe PLAGNIOL-VILLARD [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130916143924.GG21829@ns203013.ovh.net \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox