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>
28 typedef char *(*grub_env_read_hook_t
) (struct grub_env_var
*var
,
30 typedef char *(*grub_env_write_hook_t
) (struct grub_env_var
*var
,
33 enum grub_env_var_type
35 /* The default variable type which is local in current context. */
38 /* The exported type, which is passed to new contexts. */
41 /* The data slot type, which is used to store arbitrary data. */
49 grub_env_read_hook_t read_hook
;
50 grub_env_write_hook_t write_hook
;
51 struct grub_env_var
*next
;
52 struct grub_env_var
**prevp
;
53 enum grub_env_var_type type
;
56 grub_err_t
EXPORT_FUNC(grub_env_set
) (const char *name
, const char *val
);
57 char *EXPORT_FUNC(grub_env_get
) (const char *name
);
58 void EXPORT_FUNC(grub_env_unset
) (const char *name
);
59 void EXPORT_FUNC(grub_env_iterate
) (int (*func
) (struct grub_env_var
*var
));
60 grub_err_t
EXPORT_FUNC(grub_register_variable_hook
) (const char *name
,
61 grub_env_read_hook_t read_hook
,
62 grub_env_write_hook_t write_hook
);
63 grub_err_t
EXPORT_FUNC(grub_env_context_open
) (int export
);
64 grub_err_t
EXPORT_FUNC(grub_env_context_close
) (void);
65 grub_err_t
EXPORT_FUNC(grub_env_export
) (const char *name
);
67 grub_err_t
EXPORT_FUNC(grub_env_set_data_slot
) (const char *name
,
69 void *EXPORT_FUNC(grub_env_get_data_slot
) (const char *name
);
70 void EXPORT_FUNC(grub_env_unset_data_slot
) (const char *name
);
72 #endif /* ! GRUB_ENV_HEADER */