Annotation of embedtools/src/ub_env.c, revision 1.1.2.5
1.1.2.1 misho 1: #include "global.h"
2: #include "ub_env.h"
3:
4:
1.1.2.4 misho 5: env_t *env;
6:
7:
1.1.2.3 misho 8: static int
1.1.2.5 ! misho 9: ub_flash_io(const char *csSec, int mode)
1.1.2.3 misho 10: {
11: int f, ret = 0;
1.1.2.5 ! misho 12: const char *str;
1.1.2.3 misho 13:
14: FTRACE(4);
15:
1.1.2.5 ! misho 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);
1.1.2.3 misho 23: if (f == -1) {
1.1.2.5 ! misho 24: printf("Error:: Can't access u-boot-env device %s\n", str);
1.1.2.3 misho 25: return -1;
26: }
27:
28: if (mode & O_RDWR) {
29: } else {
30: }
31:
32: close(f);
33: return ret;
34: }
35:
1.1.2.4 misho 36: int
37: ub_load(const char *csSec)
38: {
39: const char *str;
40: size_t siz;
41:
1.1.2.5 ! misho 42: FTRACE(4);
! 43:
1.1.2.4 misho 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: {
1.1.2.5 ! misho 61: FTRACE(4);
! 62:
1.1.2.4 misho 63: if (env)
64: e_free(env);
65: }
66:
1.1.2.2 misho 67: const char*
1.1.2.5 ! misho 68: ub_getenv(const char *csSec, const char *csName)
1.1.2.2 misho 69: {
70: const char *str = NULL;
71:
1.1.2.3 misho 72: FTRACE(3);
73:
1.1.2.2 misho 74: return str;
75: }
76:
77: int
1.1.2.5 ! misho 78: ub_setenv(const char *csSec, const char *csName, const char *csValue)
1.1.2.2 misho 79: {
1.1.2.3 misho 80: FTRACE(3);
81:
1.1.2.2 misho 82: return 0;
83: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>