diff options
Diffstat (limited to 'lib/libnvram')
-rw-r--r-- | lib/libnvram/envvar.c | 13 | ||||
-rw-r--r-- | lib/libnvram/nvram.c | 13 | ||||
-rw-r--r-- | lib/libnvram/nvram.h | 10 |
3 files changed, 17 insertions, 19 deletions
diff --git a/lib/libnvram/envvar.c b/lib/libnvram/envvar.c index ee943fc..d413e97 100644 --- a/lib/libnvram/envvar.c +++ b/lib/libnvram/envvar.c @@ -46,7 +46,7 @@ static int get_past_env_pos(partition_t part, char *envvar, int evlen) * @param evlen string length of the envvar parameter * @return pointer to temporary string containing the value of envvar */ -char *nvram_get_env(partition_t part, char *envvar, int evlen) +char *nvram_get_env(partition_t part, char *envvar, unsigned evlen) { static char temp[256+1]; int len, offset; @@ -100,10 +100,9 @@ static int find_last_envvar(partition_t part) return -1; } -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_add_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { - int freespace, last, len, offset; - unsigned int i; + unsigned i, freespace, last, len, offset; /* Find offset where we can write */ last = find_last_envvar(part); @@ -132,7 +131,7 @@ int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int va return 0; } -int nvram_del_env(partition_t part, char *envvar, int evlen) +int nvram_del_env(partition_t part, char *envvar, unsigned evlen) { int last, current, pos, i; char *buffer; @@ -168,10 +167,10 @@ int nvram_del_env(partition_t part, char *envvar, int evlen) return 0; } -int nvram_set_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_set_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { char *oldvalue, *buffer; - int last, current, buffersize, i; + unsigned last, current, buffersize, i; DEBUG("nvram_set_env %lx[%lx]: %p=>%p\n", part.addr, part.len, envvar, value); diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c index 99deb2a..6d145d7 100644 --- a/lib/libnvram/nvram.c +++ b/lib/libnvram/nvram.c @@ -163,7 +163,7 @@ nvram_access(uint64_t, 64, qword) * @return pointer to temporary buffer */ -char *get_nvram_buffer(int len) +char *get_nvram_buffer(unsigned len) { if(len>NVRAM_LENGTH) return NULL; @@ -271,7 +271,7 @@ static uint8_t calc_partition_header_checksum(int offset) static int calc_used_nvram_space(void) { - int walk, len; + unsigned walk, len; for (walk=0; walk<NVRAM_LENGTH;) { if(nvram_read_byte(walk) == 0 @@ -319,7 +319,7 @@ static int calc_used_nvram_space(void) partition_t get_partition(unsigned int type, char *name) { partition_t ret={0,-1}; - int walk, len; + unsigned walk, len; DEBUG("get_partition(%i, '%s')\n", type, name); @@ -416,11 +416,10 @@ int wipe_partition(partition_t partition, int header_only) } -static partition_t create_nvram_partition(int type, const char *name, int len) +static partition_t create_nvram_partition(int type, const char *name, unsigned len) { partition_t ret = { 0, 0 }; - int offset, plen; - unsigned int i; + unsigned i, offset, plen; plen = ALIGN(len+PARTITION_HEADER_SIZE, 16); @@ -510,7 +509,7 @@ partition_t new_nvram_partition_fs(int type, char *name, int namelen, int len) int delete_nvram_partition(partition_t partition) { - int i; + unsigned i; partition_t free_part; if(!partition.len || partition.len == -1) diff --git a/lib/libnvram/nvram.h b/lib/libnvram/nvram.h index 73fe444..c8aad31 100644 --- a/lib/libnvram/nvram.h +++ b/lib/libnvram/nvram.h @@ -47,7 +47,7 @@ nvram_access_proto(uint64_t, qword) /* nvram.c */ -char *get_nvram_buffer(int len); +char *get_nvram_buffer(unsigned len); void free_nvram_buffer(char *buffer); int nvramlog_printf(const char* fmt, ...); partition_t get_partition(unsigned int type, char *name); @@ -67,9 +67,9 @@ void nvram_init(uint32_t store_token, uint32_t fetch_token, unsigned int get_nvram_size(void); /* envvar.c */ -char *nvram_get_env(partition_t part, char *envvar, int evlen); -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen); -int nvram_del_env(partition_t part, char *envvar, int evlen); -int nvram_set_env(partition_t part, char *envvar, int evlen, char *val, int vlen); +char *nvram_get_env(partition_t part, char *envvar, unsigned evlen); +int nvram_add_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen); +int nvram_del_env(partition_t part, char *envvar, unsigned evlen); +int nvram_set_env(partition_t part, char *envvar, unsigned evlen, char *val, unsigned vlen); #endif |