libuboot.h
/*
* (C) Copyright 2019
* Stefano Babic, DENX Software Engineering, sbabic@denx.de.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#pragma once
struct uboot_ctx;
#define DEVNAME_MAX_LENGTH 40
struct uboot_env_device {
char *devname;
long long int offset;
size_t envsize;
size_t sectorsize;
unsigned long envsectors;
};
int libuboot_read_config(struct uboot_ctx *ctx, const char *config);
int libuboot_configure(struct uboot_ctx *ctx,
struct uboot_env_device *envdevs);
int libuboot_load_file(struct uboot_ctx *ctx, const char *filename);
int libuboot_env_store(struct uboot_ctx *ctx);
int libuboot_initialize(struct uboot_ctx **out,
struct uboot_env_device *envdevs);
void libuboot_exit(struct uboot_ctx *ctx);
int libuboot_open(struct uboot_ctx *ctx);
void libuboot_close(struct uboot_ctx *ctx);
int libuboot_set_env(struct uboot_ctx *ctx, const char *varname, const char *value);
char *libuboot_get_env(struct uboot_ctx *ctx, const char *varname);
void *libuboot_iterator(struct uboot_ctx *ctx, void *next);
const char *libuboot_getname(void *entry);
const char *libuboot_getvalue(void *entry);
libuboot_getvalue
const char * libuboot_getvalue(void *entry)
Accessor to get variable value from DB entry.
Definition: uboot_env.c:1268
uboot_env_device::devname
char * devname
Definition: libuboot.h:20
libuboot_getname
const char * libuboot_getname(void *entry)
Accessor to get variable name from DB entry.
Definition: uboot_env.c:1261
libuboot_set_env
int libuboot_set_env(struct uboot_ctx *ctx, const char *varname, const char *value)
Set a variable.
Definition: uboot_env.c:1195
libuboot_load_file
int libuboot_load_file(struct uboot_ctx *ctx, const char *filename)
Import environment from file.
Definition: uboot_env.c:1031
libuboot_initialize
int libuboot_initialize(struct uboot_ctx **out, struct uboot_env_device *envdevs)
Initialize the library.
Definition: uboot_env.c:1313
libuboot_configure
int libuboot_configure(struct uboot_ctx *ctx, struct uboot_env_device *envdevs)
Read U-Boot environment configuration from structure.
Definition: uboot_env.c:1284
uboot_env_device::envsize
size_t envsize
Definition: libuboot.h:24
libuboot_close
void libuboot_close(struct uboot_ctx *ctx)
Release an environment.
Definition: uboot_env.c:1343
libuboot_get_env
char * libuboot_get_env(struct uboot_ctx *ctx, const char *varname)
Get a variable.
Definition: uboot_env.c:1249
uboot_env_device::envsectors
unsigned long envsectors
Definition: libuboot.h:28
libuboot_read_config
int libuboot_read_config(struct uboot_ctx *ctx, const char *config)
Read U-Boot environment configuration from a file.
Definition: uboot_env.c:1077
libuboot_exit
void libuboot_exit(struct uboot_ctx *ctx)
Release all resources and exit the library.
Definition: uboot_env.c:1360
libuboot_env_store
int libuboot_env_store(struct uboot_ctx *ctx)
Flush environment to the storage.
Definition: uboot_env.c:740
uboot_env_device::sectorsize
size_t sectorsize
Definition: libuboot.h:26
uboot_env_device
Definition: libuboot.h:18
libuboot_iterator
void * libuboot_iterator(struct uboot_ctx *ctx, void *next)
Iterator.
Definition: uboot_env.c:1275
uboot_env_device::offset
long long int offset
Definition: libuboot.h:22
libuboot_open
int libuboot_open(struct uboot_ctx *ctx)
Load an environment.
Definition: uboot_env.c:1335
uboot_ctx
Definition: uboot_private.h:111