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

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

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