mirror of https://github.com/hak5/openwrt-owl.git
nvram: get rid of NVRAM_SPACE
Now we support NVRAM whatever its size is. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 46262owl
parent
d372167491
commit
4497c35bd0
|
@ -65,7 +65,7 @@ static void _nvram_free(nvram_handle_t *h)
|
||||||
static nvram_tuple_t * _nvram_realloc( nvram_handle_t *h, nvram_tuple_t *t,
|
static nvram_tuple_t * _nvram_realloc( nvram_handle_t *h, nvram_tuple_t *t,
|
||||||
const char *name, const char *value )
|
const char *name, const char *value )
|
||||||
{
|
{
|
||||||
if ((strlen(value) + 1) > NVRAM_SPACE)
|
if ((strlen(value) + 1) > h->length - h->offset)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!t) {
|
if (!t) {
|
||||||
|
@ -395,7 +395,7 @@ nvram_handle_t * nvram_open(const char *file, int rdonly)
|
||||||
header = nvram_header(h);
|
header = nvram_header(h);
|
||||||
|
|
||||||
if (header->magic == NVRAM_MAGIC &&
|
if (header->magic == NVRAM_MAGIC &&
|
||||||
(rdonly || header->len < NVRAM_SPACE)) {
|
(rdonly || header->len < h->length - h->offset)) {
|
||||||
_nvram_rehash(h);
|
_nvram_rehash(h);
|
||||||
free(mtd);
|
free(mtd);
|
||||||
return h;
|
return h;
|
||||||
|
|
|
@ -114,7 +114,6 @@ char * nvram_find_staging(void);
|
||||||
|
|
||||||
/* NVRAM constants */
|
/* NVRAM constants */
|
||||||
#define NVRAM_MIN_SPACE 0x8000
|
#define NVRAM_MIN_SPACE 0x8000
|
||||||
#define NVRAM_SPACE 0x10000
|
|
||||||
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
||||||
#define NVRAM_VERSION 1
|
#define NVRAM_VERSION 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue