All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Grub-devel Digest, Vol 185, Issue 13
       [not found] <mailman.95.1563379213.16389.grub-devel@gnu.org>
@ 2019-07-17 17:06 ` Artyom Pozharov
  0 siblings, 0 replies; only message in thread
From: Artyom Pozharov @ 2019-07-17 17:06 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 7800 bytes --]

Sorry, do you know about my bug (Grub-installation to UEFI with HP 250 G6)?
I am worrying, because I have been waiting for answer a long time.

ср, 17 июл. 2019 г., 19:01 <grub-devel-request@gnu.org>:

> Send Grub-devel mailing list submissions to
>         grub-devel@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.gnu.org/mailman/listinfo/grub-devel
> or, via email, send a message with subject or body 'help' to
>         grub-devel-request@gnu.org
>
> You can reach the person managing the list at
>         grub-devel-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Grub-devel digest..."
>
>
> Today's Topics:
>
>    1. Re: [PATCH] grub-core/commands/basic_math.c: New commands to
>       perform basic math operations on variables
>       (Vladimir 'phcoder' Serbinenko)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 16 Jul 2019 21:48:51 +0200
> From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
> To: The development of GRUB 2 <grub-devel@gnu.org>
> Subject: Re: [PATCH] grub-core/commands/basic_math.c: New commands to
>         perform basic math operations on variables
> Message-ID:
>         <
> CAEaD8JOTj9yDJMFSJKiWaHH4kJt1fgGoH+BqM-00626NkLsYyA@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Tue, 16 Jul 2019, 19:15 glenn tanner, <glenntanner3@gmail.com> wrote:
>
> > Added new commands to add and subtract values from grub variables, was
> > desirable for automated testing. Compiled and tested under x86_64-efi.
> >
> > diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> > index 474a63e68..c383f0157 100644
> > --- a/grub-core/Makefile.core.def
> > +++ b/grub-core/Makefile.core.def
> > @@ -2503,3 +2503,8 @@ module = {
> >   common = commands/i386/wrmsr.c;
> >   enable = x86;
> > };
> > +
> > +module = {
> > +  name = basic_math;
> > +  common = commands/basic_math.c;
> > +};
> > diff --git a/grub-core/commands/basic_math.c
> > b/grub-core/commands/basic_math.c
> > new file mode 100644
> > index 000000000..9337cd5b1
> > --- /dev/null
> > +++ b/grub-core/commands/basic_math.c
> > @@ -0,0 +1,134 @@
> > +/* basic_math.c - basic math functions.  */
> > +/*
> > + *  GRUB  --  GRand Unified Bootloader
> > + *  Copyright (C) 2008,2009,2010  Free Software Foundation, Inc.
> > + *
> > + *  GRUB is free software: you can redistribute it and/or modify
> > + *  it under the terms of the GNU General Public License as published by
> > + *  the Free Software Foundation, either version 3 of the License, or
> > + *  (at your option) any later version.
> > + *
> > + *  GRUB is distributed in the hope that it will be useful,
> > + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + *  GNU General Public License for more details.
> > + *
> > + *  You should have received a copy of the GNU General Public License
> > + *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
> > + */
> > +
> > +/* what any module needs */
> > +#include <grub/dl.h>
> > +#include <grub/misc.h>
> > +#include <grub/extcmd.h>
> > +#include <grub/i18n.h>
> > +#include <grub/mm.h>
> > +/* what my module needs */
> > +#include <grub/env.h>
> > +
> > +GRUB_MOD_LICENSE ("GPLv3+");
> > +
> > +static grub_err_t
> > +grub_cmd_add (grub_extcmd_context_t ctxt __attribute__ ((unused)), int
> > argc, char **args)
> > +{
> > +  unsigned int i;
> > +  int ret, value_int=0, arg_int=0, digit;
> > +  const char *value;
> > +  char buf[512];
> > +
> > +  if (argc != 2)
> > +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Variable and value
> > required"));
> > +
> > +  value = grub_env_get (args[0]);
> > +  if (!value)
> > +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Variable must be
> > defined"));
> > +
> > +  for (i=0;i<grub_strlen(value);i++) {
> > +    if (grub_isdigit((int)value[i])) {
> > +      digit = value[i] - '0';
> > +      value_int = (10*value_int) + digit;
> >
> This should be grub_strtol and not custom loop
>
> > +    }
> > +  }
> > +
> > +  for (i=0;i<grub_strlen(args[1]);i++) {
> > +    if (grub_isdigit((int)args[1][i])) {
> > +      digit = args[1][i] - '0';
> > +      arg_int = (10*arg_int) + digit;
> > +    } else {
> > +      return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Value must be a
> > positive interger"));
> > +    }
> > +  }
> > +
> > +  ret=value_int+arg_int;
> > +  /* grub_printf ("%d\n", ret); */
> > +
> > +  grub_snprintf (buf, sizeof (buf), "%d", ret);
> > +  /* grub_printf ("%s\n", buf); */
> > +  grub_env_set (args[0], buf);
> > +  return 0;
> > +}
> > +
> > +static grub_err_t
> > +grub_cmd_sub (grub_extcmd_context_t ctxt __attribute__ ((unused)), int
> > argc, char **args)
> > +{
> > +  unsigned int i;
> > +  int ret, value_int=0, arg_int=0, digit;
> > +  const char *value;
> > +  char buf[512];
> > +
> > +  if (argc != 2)
> > +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Variable and value
> > required"));
> > +
> > +  value = grub_env_get (args[0]);
> > +  if (!value)
> > +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Variable must be
> > defined"));
> > +
> > +  for (i=0;i<grub_strlen(value);i++) {
> > +    if (grub_isdigit((int)value[i])) {
> > +      digit = value[i] - '0';
> > +      value_int = (10*value_int) + digit;
> > +    }
> > +  }
> > +
> > +  for (i=0;i<grub_strlen(args[1]);i++) {
> > +    if (grub_isdigit((int)args[1][i])) {
> > +      digit = args[1][i] - '0';
> > +      arg_int = (10*arg_int) + digit;
> > +    } else {
> > +      return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Value must be a
> > positive interger"));
> > +    }
> > +  }
> > +
> > +  if (arg_int > value_int)
> > +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Result may not be
> > negitive"));
> > +
> > +  ret=value_int-arg_int;
> > +  /* grub_printf ("%d\n", ret); */
> > +
> > +  grub_snprintf (buf, sizeof (buf), "%d", ret);
> > +  /* grub_printf ("%s\n", buf); */
> > +  grub_env_set (args[0], buf);
> > +  return 0;
> > +}
> > +
> > +static grub_extcmd_t cmd_add, cmd_sub;
> > +
> >
> > +GRUB_MOD_INIT(basic_math)
> > +{
> > +  cmd_add =
> > +    grub_register_extcmd ("add", grub_cmd_add, 0,
> > +                         N_("<variable_name> <value>"),
> > +                         N_("Add value to variable."),
> > +                         0);
> > +  cmd_sub =
> > +    grub_register_extcmd ("sub", grub_cmd_sub, 0,
> > +                         N_("<variable_name> <value>"),
> > +                         N_("Subtract value from variable."),
> > +                         0);
> > +}
> > +
> > +GRUB_MOD_FINI(basic_math)
> > +{
> > +  grub_unregister_extcmd (cmd_add);
> > +  grub_unregister_extcmd (cmd_sub);
> > +}
> >
> > --
> > Regards,
> > Glenn Tanner
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.gnu.org/archive/html/grub-devel/attachments/20190716/c23d5329/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> ------------------------------
>
> End of Grub-devel Digest, Vol 185, Issue 13
> *******************************************
>

[-- Attachment #2: Type: text/html, Size: 10987 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-17 17:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.95.1563379213.16389.grub-devel@gnu.org>
2019-07-17 17:06 ` Grub-devel Digest, Vol 185, Issue 13 Artyom Pozharov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.