Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7d3acf4d1009
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3bd7f117375b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jun 27, 2015

  1. Copy the full SHA
    2d475e1 View commit details
  2. update lwip

    sbourdeauducq committed Jun 27, 2015
    Copy the full SHA
    3bd7f11 View commit details
Showing with 8 additions and 7 deletions.
  1. +7 −6 soc/runtime/flash_storage.c
  2. +1 −1 soc/runtime/lwip
13 changes: 7 additions & 6 deletions soc/runtime/flash_storage.c
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
#include <generated/mem.h>
#include <generated/csr.h>

#include "log.h"
#include "flash_storage.h"

#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
@@ -62,21 +63,21 @@ static int record_iter_next(struct iter_state *is, struct record *record, int *f
return 0;

if(record->size < 6) {
printf("flash_storage might be corrupted: record size is %u (<6) at address %08x\n", record->size, record->raw_record);
log("flash_storage might be corrupted: record size is %u (<6) at address %08x", record->size, record->raw_record);
if(fatal)
*fatal = 1;
return 0;
}

if(is->seek > is->buf_len - sizeof(record->size) - 2) { /* 2 is the minimum key length */
printf("flash_storage might be corrupted: END_MARKER missing at the end of the storage sector\n");
log("flash_storage might be corrupted: END_MARKER missing at the end of the storage sector");
if(fatal)
*fatal = 1;
return 0;
}

if(record->size > is->buf_len - is->seek) {
printf("flash_storage might be corrupted: invalid record_size %d at address %08x\n", record->size, record->raw_record);
log("flash_storage might be corrupted: invalid record_size %d at address %08x", record->size, record->raw_record);
if(fatal)
*fatal = 1;
return 0;
@@ -86,7 +87,7 @@ static int record_iter_next(struct iter_state *is, struct record *record, int *f
record->key_len = strnlen(record->key, record->size - sizeof(record->size)) + 1;

if(record->key_len == record->size - sizeof(record->size) + 1) {
printf("flash_storage might be corrupted: invalid key length at address %08x\n", record->raw_record);
log("flash_storage might be corrupted: invalid key length at address %08x", record->raw_record);
if(fatal)
*fatal = 1;
return 0;
@@ -258,7 +259,7 @@ int fs_write(char *key, void *buffer, unsigned int buf_len)
return 0; // Storage is definitely full.

fatal_error:
printf("fatal error: flash storage might be corrupted\n");
log("fatal error: flash storage might be corrupted");
return 0;
}

@@ -289,7 +290,7 @@ unsigned int fs_read(char *key, void *buffer, unsigned int buf_len, unsigned int
}

if(fatal)
printf("fatal error: flash storage might be corrupted\n");
log("fatal error: flash storage might be corrupted");

return read_length;
}
2 changes: 1 addition & 1 deletion soc/runtime/lwip
Submodule lwip updated from 737a69 to d32177