grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Handler support


From: Bean
Subject: Re: [PATCH] Handler support
Date: Sat, 14 Feb 2009 22:46:55 +0800

Hi,

This new version of handler patch contain the following changes:

1, Register/unregister handler class automatically, so there is no
need to usel grub_handler_class_register/grub_handler_class_unregister
anymore.
2, Keep the original api function of term.c, so that there is no need
to change modules depend on it. Inside term.c, it rely on the handler
function to do the job.
3. Use a new method of compile time checking. Now, instead of using
void*, it uses normal type, for example:

void grub_handler_register (grub_handler_class_t class, grub_handler_t handler);

Codes that calls grub_handler_register should looks like this:

grub_handler_register (&grub_term_input_class, GRUB_AS_HANDLER (term));

macro GRUB_AS_HANDLER check the various fields required by
grub_handler_t is at the same location as term, and then cast it to
type grub_handler_t. Just as before, if the testing succeed, it
wouldn't generate extra runtime code.

If there is no objection, I'd commit this patch in a few days.

2009-02-14  Bean  <address@hidden>

        * commands/handler.c: New file.

        * include/grub/list.h: Likewise.

        * include/grub/handler.h: Likewise.

        * kern/list.c: Likewise.

        * kern/handler.c: Likewise.

        * kern/term.h: Include header file <grub/handler.h>.
        (grub_term_input): Move next field to the beginning.
        (grub_term_output): Likewise.
        (grub_term_iterate_input): Removed.
        (grub_term_iterate_output): Likewise.

        * kern/term.c (grub_term_list_input): Removed.
        (grub_term_list_output): Likewise.
        (grub_term_input_class): New variable.
        (grub_term_output_class): Likewise.
        (grub_cur_term_input): Change varaible as macro.
        (grub_cur_term_output): Likewise.
        (grub_term_register_input): Call underlying handler function to do the
        job.
        (grub_term_register_output): Likewise.
        (grub_term_unregister_input): Likewise.
        (grub_term_unregister_output): Likewise.
        (grub_term_set_current_input): Likewise.
        (grub_term_set_current_output): Likewise.
        (grub_term_iterate_input): Removed.
        (grub_term_iterate_output): Likewise.
        (grub_term_get_current_input): Use grub_term_input_class to retrive
        the current handler.
        (grub_term_get_current_output): Likewise.

        * conf/common.rmk (pkglib_MODULES): Replace terminal with handler.
        (terminal_mod_SOURCES): Likewise.
        (terminal_mod_CFLAGS): Likewise.
        (terminal_mod_LDFLAGS): Likewise.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_img_SOURCES): Add list.c and handler.c.
        (kernel_img_HEADERS): Add list.h and handler.h.

        * conf/i386-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_mod_SOURCES): Add list.c and handler.c.
        (kernel_mod_HEADERS): Add list.h and handler.h.

        * conf/i386-coreboot.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_elf_SOURCES): Add list.c and handler.c.
        (kernel_elf_HEADERS): Add list.h and handler.h.

        * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_elf_SOURCES): Add list.c and handler.c.
        (kernel_elf_HEADERS): Add list.h and handler.h.

        * conf/x86_64-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_mod_SOURCES): Add list.c and handler.c.
        (kernel_mod_HEADERS): Add list.h and handler.h.

        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_elf_SOURCES): Add list.c and handler.c.
        (kernel_elf_HEADERS): Add list.h and handler.h.

        * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
        handler.c.
        (kernel_elf_SOURCES): Add list.c and handler.c.
        (kernel_elf_HEADERS): Add list.h and handler.h.

-- 
Bean

Attachment: handler_2.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]