Skip to content

Commit

Permalink
squash spiffs: update read/write functions with new mtd interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Dupont committed Aug 10, 2016
1 parent 9f41abd commit a71bb8b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/spiffs/fs/spiffs_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "kernel_defines.h"

#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG (1)
#include <debug.h>

static int spiffs_err_to_errno(s32_t err);
Expand All @@ -26,7 +26,12 @@ static int32_t _dev_read(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *dst)

//DEBUG("spiffs: read: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size);

return mtd_read(dev, dst, addr, size);
if (mtd_read(dev, dst, addr, size) > 0) {
return 0;
}
else {
return -EIO;
}
}

static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src)
Expand All @@ -35,7 +40,12 @@ static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src

DEBUG("spiffs: write: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size);

return mtd_write(dev, src, addr, size);
if (mtd_write(dev, src, addr, size) > 0) {
return 0;
}
else {
return -EIO;
}
}

static int32_t _dev_erase(struct spiffs_t *fs, u32_t addr, u32_t size)
Expand Down

0 comments on commit a71bb8b

Please sign in to comment.