~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to include/grub/normal.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2006-01-05 15:20:40 UTC
  • mto: (17.3.1 squeeze) (1.9.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060105152040-b72i5pq1a82z22yi
Tags: upstream-1.92
ImportĀ upstreamĀ versionĀ 1.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* normal.h - prototypes for the normal mode */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2002,2003,2005  Free Software Foundation, Inc.
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
 
 
21
#ifndef GRUB_NORMAL_HEADER
 
22
#define GRUB_NORMAL_HEADER      1
 
23
 
 
24
#include <grub/setjmp.h>
 
25
#include <grub/symbol.h>
 
26
#include <grub/err.h>
 
27
#include <grub/arg.h>
 
28
 
 
29
/* The maximum size of a command-line.  */
 
30
#define GRUB_MAX_CMDLINE        1600
 
31
 
 
32
/* Can be run in the command-line.  */
 
33
#define GRUB_COMMAND_FLAG_CMDLINE       0x1
 
34
/* Can be run in the menu.  */
 
35
#define GRUB_COMMAND_FLAG_MENU          0x2
 
36
/* Can be run in both interfaces.  */
 
37
#define GRUB_COMMAND_FLAG_BOTH          0x3
 
38
/* Only for the command title.  */
 
39
#define GRUB_COMMAND_FLAG_TITLE         0x4
 
40
/* Don't print the command on booting.  */
 
41
#define GRUB_COMMAND_FLAG_NO_ECHO       0x8
 
42
/* Don't print the command on booting.  */
 
43
#define GRUB_COMMAND_FLAG_NO_ARG_PARSE  0x10
 
44
/* Not loaded yet. Used for auto-loading.  */
 
45
#define GRUB_COMMAND_FLAG_NOT_LOADED    0x20
 
46
 
 
47
/* The type of a completion item.  */
 
48
enum grub_completion_type
 
49
  {
 
50
    GRUB_COMPLETION_TYPE_COMMAND,
 
51
    GRUB_COMPLETION_TYPE_DEVICE,
 
52
    GRUB_COMPLETION_TYPE_PARTITION,
 
53
    GRUB_COMPLETION_TYPE_FILE,
 
54
    GRUB_COMPLETION_TYPE_ARGUMENT
 
55
  };
 
56
typedef enum grub_completion_type grub_completion_type_t;
 
57
 
 
58
/* The command description.  */
 
59
struct grub_command
 
60
{
 
61
  /* The name.  */
 
62
  char *name;
 
63
 
 
64
  /* The callback function.  */
 
65
  grub_err_t (*func) (struct grub_arg_list *state, int argc, char **args);
 
66
 
 
67
  /* The flags.  */
 
68
  unsigned flags;
 
69
 
 
70
  /* The summary of the command usage.  */
 
71
  const char *summary;
 
72
 
 
73
  /* The description of the command.  */
 
74
  const char *description;
 
75
 
 
76
  /* The argument parser optionlist.  */
 
77
  const struct grub_arg_option *options;
 
78
 
 
79
  /* The name of a module. Used for auto-loading.  */
 
80
  char *module_name;
 
81
  
 
82
  /* The next element.  */
 
83
  struct grub_command *next;
 
84
};
 
85
typedef struct grub_command *grub_command_t;
 
86
 
 
87
/* The command list.  */
 
88
struct grub_command_list
 
89
{
 
90
  /* The string of a command.  */
 
91
  char *command;
 
92
 
 
93
  /* The next element.  */
 
94
  struct grub_command_list *next;
 
95
};
 
96
typedef struct grub_command_list *grub_command_list_t;
 
97
 
 
98
/* The menu entry.  */
 
99
struct grub_menu_entry
 
100
{
 
101
  /* The title name.  */
 
102
  const char *title;
 
103
 
 
104
  /* The number of commands.  */
 
105
  int num;
 
106
 
 
107
  /* The list of commands.  */
 
108
  grub_command_list_t command_list;
 
109
 
 
110
  /* The next element.  */
 
111
  struct grub_menu_entry *next;
 
112
};
 
113
typedef struct grub_menu_entry *grub_menu_entry_t;
 
114
 
 
115
/* The menu.  */
 
116
struct grub_menu
 
117
{
 
118
  /* The default entry number.  */
 
119
  int default_entry;
 
120
 
 
121
  /* The fallback entry number.  */
 
122
  int fallback_entry;
 
123
 
 
124
  /* The timeout to boot the default entry automatically.  */
 
125
  int timeout;
 
126
  
 
127
  /* The size of a menu.  */
 
128
  int size;
 
129
 
 
130
  /* The list of menu entries.  */
 
131
  grub_menu_entry_t entry_list;
 
132
};
 
133
typedef struct grub_menu *grub_menu_t;
 
134
 
 
135
/* A list of menus.  */
 
136
struct grub_menu_list
 
137
{
 
138
  grub_menu_t menu;
 
139
  struct grub_menu_list *next;
 
140
};
 
141
typedef struct grub_menu_list *grub_menu_list_t;
 
142
 
 
143
/* The context.  A context holds some global information.  */
 
144
struct grub_context
 
145
{
 
146
  /* The menu list.  */
 
147
  grub_menu_list_t menu_list;
 
148
};
 
149
typedef struct grub_context *grub_context_t;
 
150
 
 
151
/* This is used to store the names of filesystem modules for auto-loading.  */
 
152
struct grub_fs_module_list
 
153
{
 
154
  char *name;
 
155
  struct grub_fs_module_list *next;
 
156
};
 
157
typedef struct grub_fs_module_list *grub_fs_module_list_t;
 
158
 
 
159
/* To exit from the normal mode.  */
 
160
extern grub_jmp_buf grub_exit_env;
 
161
 
 
162
void grub_enter_normal_mode (const char *config);
 
163
void grub_normal_execute (const char *config, int nested);
 
164
void grub_menu_run (grub_menu_t menu, int nested);
 
165
void grub_menu_entry_run (grub_menu_entry_t entry);
 
166
void grub_cmdline_run (int nested);
 
167
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
 
168
                      int echo_char, int readline);
 
169
grub_command_t grub_register_command (const char *name,
 
170
                                      grub_err_t (*func) (struct grub_arg_list *state,
 
171
                                                          int argc,
 
172
                                                          char **args),
 
173
                                      unsigned flags,
 
174
                                      const char *summary,
 
175
                                      const char *description,
 
176
                                      const struct grub_arg_option *parser);
 
177
void grub_unregister_command (const char *name);
 
178
grub_command_t grub_command_find (char *cmdline);
 
179
grub_err_t grub_set_history (int newsize);
 
180
int grub_iterate_commands (int (*iterate) (grub_command_t));
 
181
int grub_command_execute (char *cmdline, int interactive);
 
182
void grub_command_init (void);
 
183
void grub_normal_init_page (void);
 
184
void grub_menu_init_page (int nested, int edit);
 
185
int grub_arg_parse (grub_command_t parser, int argc, char **argv,
 
186
                    struct grub_arg_list *usr, char ***args, int *argnum);
 
187
void grub_arg_show_help (grub_command_t cmd);
 
188
grub_context_t grub_context_get (void);
 
189
grub_menu_t grub_context_get_current_menu (void);
 
190
grub_menu_t grub_context_push_menu (grub_menu_t menu);
 
191
void grub_context_pop_menu (void);
 
192
char *grub_normal_do_completion (char *buf, int *restore,
 
193
                                 void (*hook) (const char *item, grub_completion_type_t type, int count));
 
194
grub_err_t grub_normal_print_device_info (const char *name);
 
195
 
 
196
#ifdef GRUB_UTIL
 
197
void grub_normal_init (void);
 
198
void grub_normal_fini (void);
 
199
void grub_hello_init (void);
 
200
void grub_hello_fini (void);
 
201
void grub_ls_init (void);
 
202
void grub_ls_fini (void);
 
203
void grub_cat_init (void);
 
204
void grub_cat_fini (void);
 
205
void grub_boot_init (void);
 
206
void grub_boot_fini (void);
 
207
void grub_cmp_init (void);
 
208
void grub_cmp_fini (void);
 
209
void grub_terminal_init (void);
 
210
void grub_terminal_fini (void);
 
211
void grub_loop_init (void);
 
212
void grub_loop_fini (void);
 
213
void grub_help_init (void);
 
214
void grub_help_fini (void);
 
215
void grub_halt_init (void);
 
216
void grub_halt_fini (void);
 
217
void grub_reboot_init (void);
 
218
void grub_reboot_fini (void);
 
219
void grub_default_init (void);
 
220
void grub_default_fini (void);
 
221
void grub_timeout_init (void);
 
222
void grub_timeout_fini (void);
 
223
void grub_configfile_init (void);
 
224
void grub_configfile_fini (void);
 
225
void grub_search_init (void);
 
226
void grub_search_fini (void);
 
227
void grub_test_init (void);
 
228
void grub_test_fini (void);
 
229
#endif
 
230
 
 
231
#endif /* ! GRUB_NORMAL_HEADER */