vaseboot/include/VasEBoot/env.h

73 lines
2.4 KiB
C

/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
*
* VasEBoot 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.
*
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VasEBoot_ENV_HEADER
#define VasEBoot_ENV_HEADER 1
#include <VasEBoot/symbol.h>
#include <VasEBoot/err.h>
#include <VasEBoot/types.h>
#include <VasEBoot/menu.h>
struct VasEBoot_env_var;
typedef const char *(*VasEBoot_env_read_hook_t) (struct VasEBoot_env_var *var,
const char *val);
typedef char *(*VasEBoot_env_write_hook_t) (struct VasEBoot_env_var *var,
const char *val);
struct VasEBoot_env_var
{
char *name;
char *value;
VasEBoot_env_read_hook_t read_hook;
VasEBoot_env_write_hook_t write_hook;
struct VasEBoot_env_var *next;
struct VasEBoot_env_var **prevp;
struct VasEBoot_env_var *sorted_next;
int global;
};
VasEBoot_err_t EXPORT_FUNC(VasEBoot_env_set) (const char *name, const char *val);
const char *EXPORT_FUNC(VasEBoot_env_get) (const char *name);
void EXPORT_FUNC(VasEBoot_env_unset) (const char *name);
struct VasEBoot_env_var *EXPORT_FUNC(VasEBoot_env_update_get_sorted) (void);
#define FOR_SORTED_ENV(var) for (var = VasEBoot_env_update_get_sorted (); var; var = var->sorted_next)
VasEBoot_err_t EXPORT_FUNC(VasEBoot_register_variable_hook) (const char *name,
VasEBoot_env_read_hook_t read_hook,
VasEBoot_env_write_hook_t write_hook);
VasEBoot_err_t VasEBoot_env_context_open (void);
VasEBoot_err_t VasEBoot_env_context_close (void);
VasEBoot_err_t EXPORT_FUNC(VasEBoot_env_export) (const char *name);
void VasEBoot_env_unset_menu (void);
VasEBoot_menu_t VasEBoot_env_get_menu (void);
void VasEBoot_env_set_menu (VasEBoot_menu_t nmenu);
VasEBoot_err_t
VasEBoot_env_extractor_open (int source);
VasEBoot_err_t
VasEBoot_env_extractor_close (int source);
#endif /* ! VasEBoot_ENV_HEADER */