2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_ENV_HEADER
20 #define GRUB_ENV_HEADER 1
22 #include <grub/symbol.h>
24 #include <grub/types.h>
25 #include <grub/menu.h>
29 typedef const char *(*grub_env_read_hook_t
) (struct grub_env_var
*var
,
31 typedef char *(*grub_env_write_hook_t
) (struct grub_env_var
*var
,
38 grub_env_read_hook_t read_hook
;
39 grub_env_write_hook_t write_hook
;
40 struct grub_env_var
*next
;
41 struct grub_env_var
**prevp
;
42 struct grub_env_var
*sorted_next
;
46 grub_err_t
EXPORT_FUNC(grub_env_set
) (const char *name
, const char *val
);
47 const char *EXPORT_FUNC(grub_env_get
) (const char *name
);
48 void EXPORT_FUNC(grub_env_unset
) (const char *name
);
49 struct grub_env_var
*EXPORT_FUNC(grub_env_update_get_sorted
) (void);
51 #define FOR_SORTED_ENV(var) for (var = grub_env_update_get_sorted (); var; var = var->sorted_next)
53 grub_err_t
EXPORT_FUNC(grub_register_variable_hook
) (const char *name
,
54 grub_env_read_hook_t read_hook
,
55 grub_env_write_hook_t write_hook
);
57 grub_err_t
grub_env_context_open (void);
58 grub_err_t
grub_env_context_close (void);
59 grub_err_t
EXPORT_FUNC(grub_env_export
) (const char *name
);
61 void grub_env_unset_menu (void);
62 grub_menu_t
grub_env_get_menu (void);
63 void grub_env_set_menu (grub_menu_t nmenu
);
66 grub_env_extractor_open (int source
);
69 grub_env_extractor_close (int source
);
72 #endif /* ! GRUB_ENV_HEADER */