mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Introduced append-only mode for systems with little available code space left, but which require basic FS support. Removes about 1.5kB ROM when the mode is enabled, i.e., COFFEE_CONF_APPEND_ONLY=1
This commit is contained in:
parent
8b6d34dbfc
commit
f9ca4a546d
@ -60,6 +60,16 @@
|
|||||||
#define COFFEE_WATCHDOG_STOP()
|
#define COFFEE_WATCHDOG_STOP()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef COFFEE_CONF_APPEND_ONLY
|
||||||
|
#define COFFEE_APPEND_ONLY 0
|
||||||
|
#else
|
||||||
|
#define COFFEE_APPEND_ONLY COFFEE_CONF_APPEND_ONLY
|
||||||
|
#if COFFEE_MICRO_LOGS
|
||||||
|
#error "Cannot have COFFEE_APPEND_ONLY when COFFEE_MICRO_LOGS is set."
|
||||||
|
#endif
|
||||||
|
#define COFFEE_MICRO_LOGS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if COFFEE_START & (COFFEE_SECTOR_SIZE - 1)
|
#if COFFEE_START & (COFFEE_SECTOR_SIZE - 1)
|
||||||
#error COFFEE_START must point to the first byte in a sector.
|
#error COFFEE_START must point to the first byte in a sector.
|
||||||
#endif
|
#endif
|
||||||
@ -1177,6 +1187,11 @@ cfs_write(int fd, const void *buf, unsigned size)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif /* COFFEE_MICRO_LOGS */
|
#endif /* COFFEE_MICRO_LOGS */
|
||||||
|
#if COFFEE_APPEND_ONLY
|
||||||
|
if(fdp->offset < file->end) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* COFFEE_APPEND_ONLY */
|
||||||
COFFEE_WRITE(buf, size, absolute_offset(file->page, fdp->offset));
|
COFFEE_WRITE(buf, size, absolute_offset(file->page, fdp->offset));
|
||||||
fdp->offset += size;
|
fdp->offset += size;
|
||||||
#if COFFEE_MICRO_LOGS
|
#if COFFEE_MICRO_LOGS
|
||||||
|
Loading…
Reference in New Issue
Block a user