Remove handlers

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-27 00:19:42 +01:00
parent 0959e5ec30
commit d56a6ac7f6
29 changed files with 40 additions and 627 deletions

View file

@ -1,60 +0,0 @@
/* handler.h - header for grub handler */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 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/>.
*/
#ifndef GRUB_HANDLER_HEADER
#define GRUB_HANDLER_HEADER 1
#include <grub/list.h>
#include <grub/err.h>
struct grub_handler
{
struct grub_handler *next;
const char *name;
grub_err_t (*init) (void);
grub_err_t (*fini) (void);
};
typedef struct grub_handler *grub_handler_t;
struct grub_handler_class
{
struct grub_handler_class *next;
const char *name;
grub_handler_t handler_list;
grub_handler_t cur_handler;
};
typedef struct grub_handler_class *grub_handler_class_t;
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
grub_handler_t handler);
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
grub_handler_t handler);
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
grub_handler_t handler);
#define GRUB_AS_HANDLER(ptr) \
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
(grub_handler_t) ptr : grub_bad_type_cast ())
#endif /* ! GRUB_HANDLER_HEADER */

View file

@ -22,7 +22,6 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/handler.h>
#include <grub/reader.h>
/* All the states for the command line. */
@ -84,36 +83,9 @@ struct grub_parser
};
typedef struct grub_parser *grub_parser_t;
extern struct grub_handler_class EXPORT_VAR(grub_parser_class);
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
static inline void
grub_parser_register (const char *name __attribute__ ((unused)),
/* `name' is ignored here, but used by genhandlerlist.sh. */
grub_parser_t parser)
{
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));
}
static inline void
grub_parser_unregister (grub_parser_t parser)
{
grub_handler_unregister (&grub_parser_class, GRUB_AS_HANDLER (parser));
}
static inline grub_parser_t
grub_parser_get_current (void)
{
return (grub_parser_t) grub_parser_class.cur_handler;
}
static inline grub_err_t
grub_parser_set_current (grub_parser_t parser)
{
return grub_handler_set_current (&grub_parser_class,
GRUB_AS_HANDLER (parser));
}
void grub_register_rescue_parser (void);
grub_err_t
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
#endif /* ! GRUB_PARSER_HEADER */

View file

@ -324,4 +324,7 @@ int grub_script_function_call (grub_script_function_t func,
char **
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
grub_err_t
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
#endif /* ! GRUB_NORMAL_PARSER_HEADER */

View file

@ -38,7 +38,7 @@
#include <grub/err.h>
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/handler.h>
#include <grub/list.h>
/* These are used to represent the various color states we use. */
typedef enum