From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from 15.mo1.mail-out.ovh.net ([188.165.38.232] helo=mo1.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLZwh-0007Ii-9I for barebox@lists.infradead.org; Mon, 16 Sep 2013 14:38:35 +0000 Received: from mail615.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo1.mail-out.ovh.net (Postfix) with SMTP id C952F1004805 for ; Mon, 16 Sep 2013 16:38:14 +0200 (CEST) Date: Mon, 16 Sep 2013 16:39:24 +0200 From: Jean-Christophe PLAGNIOL-VILLARD Message-ID: <20130916143924.GG21829@ns203013.ovh.net> References: <20130915112850.GC21829@ns203013.ovh.net> <1379244654-30716-1-git-send-email-plagnioj@jcrosoft.com> <20130916080202.GV30088@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130916080202.GV30088@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 1/4] login: add globalvar timeout support To: Sascha Hauer Cc: barebox@lists.infradead.org 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 > > --- > > 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 > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > > > #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