File:  [ELWIX - Embedded LightWeight unIX -] / embedtools / src / ub_env.c
Revision 1.1.2.4: download - view: text, annotated - select for diffs - revision graph
Tue Jan 28 22:22:34 2014 UTC (10 years, 5 months ago) by misho
Branches: tools2_0
init env

    1: #include "global.h"
    2: #include "ub_env.h"
    3: 
    4: 
    5: env_t *env;
    6: 
    7: 
    8: static int
    9: ub_flash_io(env_t * __restrict e, int mode)
   10: {
   11: 	int f, ret = 0;
   12: 
   13: 	FTRACE(4);
   14: 
   15: 	f = open(DRV_UB_ENV_MAP, mode);
   16: 	if (f == -1) {
   17: 		printf("Error:: Can't access u-boot-env device %s\n", DRV_UB_ENV_MAP);
   18: 		return -1;
   19: 	}
   20: 
   21: 	if (mode & O_RDWR) {
   22: 	} else {
   23: 	}
   24: 
   25: 	close(f);
   26: 	return ret;
   27: }
   28: 
   29: int
   30: ub_load(const char *csSec)
   31: {
   32: 	const char *str;
   33: 	size_t siz;
   34: 
   35: 	str = cfg_getAttribute(&cfg, csSec, "size");
   36: 	siz = strtol(str, NULL, 0);
   37: 	if (!siz)
   38: 		return -1;
   39: 
   40: 	env = e_malloc(siz);
   41: 	if (!env) {
   42: 		ELIBERR(elwix);
   43: 		return -1;
   44: 	}
   45: 
   46: 	return 0;
   47: }
   48: 
   49: void
   50: ub_unload()
   51: {
   52: 	if (env)
   53: 		e_free(env);
   54: }
   55: 
   56: const char*
   57: ub_getenv(const char *csName)
   58: {
   59: 	const char *str = NULL;
   60: 
   61: 	FTRACE(3);
   62: 
   63: 	return str;
   64: }
   65: 
   66: int
   67: ub_setenv(const char *csName, const char *csValue)
   68: {
   69: 	FTRACE(3);
   70: 
   71: 	return 0;
   72: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>