orphan
[debian/elilo] / config.h
1 /*
2  *  Copyright (C) 2001-2003 Hewlett-Packard Co.
3  *      Contributed by Stephane Eranian <eranian@hpl.hp.com>
4  *
5  * This file is part of the ELILO, the EFI Linux boot loader.
6  *
7  *  ELILO is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  ELILO is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with ELILO; see the file COPYING.  If not, write to the Free
19  *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20  *  02111-1307, USA.
21  *
22  * Please check out the elilo.txt for complete documentation on how
23  * to use this program.
24  */
25
26 #ifndef __ELILO_CONFIG_H__
27 #define __ELILO_CONFIG_H__
28
29 #define opt_offsetof(opt)       (&((boot_image_t *)(0x0))->opt)
30
31 typedef enum { OPT_NOTUSED, OPT_STR, OPT_CMD, OPT_BOOL, OPT_NUM, OPT_FILE } config_option_type_t;
32
33 typedef enum { OPT_GLOBAL,      /* global and shared among architectures */
34                OPT_IMAGE,       /* per image only and shared among architectures */
35                OPT_IMAGE_SYS    /* per image and architecture specific (offset base in sys_img_opts) */
36 } config_option_scope_t;
37
38 typedef enum { OPTIONS_GROUP_GLOBAL,    /* group must be added to global set of options */
39                OPTIONS_GROUP_IMAGE,     /* group must be added to per-image set of options */
40 } config_option_group_scope_t;
41
42 struct _config_option_t;
43 typedef INTN option_action_t(struct _config_option_t *, VOID *);
44
45 typedef struct _config_option_t {
46     config_option_type_t        type;   /* option type: OPT_CMD, OPT_BOOL, ... */
47     config_option_scope_t       scope;  /* option scope: global, per image, per image_sys */
48     CHAR16                      *name;  /* unicode string for the option */
49     option_action_t             *action; /* option specific action */
50     INTN                        (*check)(void *);       /* check valid arguments, NULL=don't need */
51     VOID                        *data;  /* which data structure to record the option */
52 } config_option_t;
53
54 extern INTN register_config_options(config_option_t *opt, UINTN nentries, config_option_group_scope_t);
55
56 #endif /* __ELILO_CONFIG_H__ */