mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-04 20:26:13 +02:00
env: add env_set_runtime() helper
env_set_runtime() is equivalent to env_set(), but does nothing when CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is unset. Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com> Signed-off-by: Steffen Doster <Steffen.Doster@tq-group.com> Signed-off-by: Max Merchel <Max.Merchel@ew.tq-group.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Alexander Feilke <alexander.feilke@ew.tq-group.com>
This commit is contained in:
parent
c8eebe0a70
commit
9f1807e57c
@ -9,6 +9,7 @@
|
||||
#ifndef __ENV_H
|
||||
#define __ENV_H
|
||||
|
||||
#include <config.h>
|
||||
#include <compiler.h>
|
||||
#include <stdbool.h>
|
||||
#include <linux/types.h>
|
||||
@ -160,6 +161,25 @@ bool env_get_autostart(void);
|
||||
*/
|
||||
int env_set(const char *varname, const char *value);
|
||||
|
||||
/**
|
||||
* env_set_runtime() - set an environment variable if
|
||||
* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is set.
|
||||
*
|
||||
* This is equivalent to env_set(), but does nothing if
|
||||
* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is unset.
|
||||
*
|
||||
* @varname: Variable to adjust
|
||||
* @value: Value to set for the variable, or NULL or "" to delete the variable
|
||||
* @return 0 if OK or !CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG, 1 on error
|
||||
*/
|
||||
static inline int env_set_runtime(const char *varname, const char *value)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG))
|
||||
return env_set(varname, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* env_get_ulong() - Return an environment variable as an integer value
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user