[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] New command checktime
From: |
Bean |
Subject: |
Re: [PATCH] New command checktime |
Date: |
Wed, 13 Aug 2008 11:26:53 +0800 |
On Wed, Aug 13, 2008 at 9:46 AM, Bean <address@hidden> wrote:
> On Wed, Aug 13, 2008 at 5:49 AM, Marco Gerards <address@hidden> wrote:
>> Bean <address@hidden> writes:
>>
>>> On Tue, Aug 12, 2008 at 5:07 AM, Marco Gerards <address@hidden> wrote:
>>>>
>>>>> * commands/date.c: New file.
>>>>>
>>>>> * commands/datetime.c: Likewise.
>>>>
>>>> This is not a command. But I do not really know a good place for this
>>>> module...
>>>
>>> How about the /hook directory ?
>>
>> Perhaps? Do you have suggestions what we can place there, besides
>> this?
>>
>> Otherwise the patch looks fine to me :-)
>
> Hi,
>
> Oh, please take a look at my other post "Idea: implementation of the
> password command", it sugguest to implement password with hooks, for
> example, reading $GET_PASSWORD would prompt the user for password and
> return the encrypted form.
>
> BTW, I'm thinking perhaps it's better to move the hook function from
> datetime.mod to datehook.mod, and datetime.mod only contain
> grub_get_datetime, grub_set_datetime, grub_get_weekday and
> grub_get_weekday_name. Module like date.mod only need the datetime
> functions, it's a little wired to install the hook as a side effect.
Hi,
This is the new patch. BTW. when testing datehook.mod, I found a
serious bug in grub_env_insert:
static void
grub_env_insert (struct grub_env_context *context,
struct grub_env_var *var)
{
int idx = grub_env_hashval (var->name);
/* Insert the variable into the hashtable. */
var->prevp = &context->vars[idx];
var->next = context->vars[idx];
if (var->next)
- var->next->prevp = &var;
+ var->next->prevp = &(var->next);
context->vars[idx] = var;
}
prevp should point to the variable that points to the next item, so it
should be &(var->next) instead of &var. To see the effect, you can
insmod datehook then rmmod datehook. The old code would either hang,
or you can see some of the datetime variable, like $YEAR, still
present in the variable list. If you try to unset it, it will cause
allocate magic broken error.
2008-08-11 Bean <address@hidden>
* conf/i386-pc.rmk (pkglib_MODULES): Add datetime.mod, date.mod
and datehook.mod.
(datetime_mod_SOURCES): New macro.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* conf/i386-coreboot.rmk (pkglib_MODULES): Add datetime.mod, date.mod
and datehook.mod.
(datetime_mod_SOURCES): New macro.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add datetime.mod, date.mod
and datehook.mod.
(datetime_mod_SOURCES): New macro.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* conf/i386-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
and datehook.mod.
(datetime_mod_SOURCES): New macro.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* conf/x86_64-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
and datehook.mod.
(datetime_mod_SOURCES): New macro.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* kern/env.c (grub_env_insert): Fix a bug in prevp pointer.
* commands/date.c: New file.
* hook/datetime.c: Likewise.
* include/grub/lib/datetime.h: Likewise.
* include/grub/i386/cmos.h: Likewise.
* lib/datetime.c: Likewise.
* lib/i386/datetime.c: Likewise.
* lib/efi/datetime.c: Likewise.
--
Bean
date_5.diff
Description: Text Data
Re: [PATCH] New command checktime, Marco Gerards, 2008/08/10
- Re: [PATCH] New command checktime, Bean, 2008/08/11
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/11
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/11
- Re: [PATCH] New command checktime, Bean, 2008/08/12
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/12
- Re: [PATCH] New command checktime, Bean, 2008/08/12
- Re: [PATCH] New command checktime,
Bean <=
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/13
- Re: [PATCH] New command checktime, Bean, 2008/08/15