Commit graph

128 commits

Author SHA1 Message Date
Nicolas Tsiftes a06110e5ed Renamed the internal dummy_space variable, since it contains useful information. 2016-06-14 21:08:01 +02:00
Nicolas Tsiftes 5010309005 Make the I/O semantics functionality in Coffee unconditional so that the API becomes consistent across platforms.
Change certain CPP conditionals into C conditionals, which should be possible for the compiler to optimize at runtime. This makes the source code easier to read.
2016-06-14 21:08:00 +02:00
Benoît Thébaudeau d70c75914a cfs-coffee: Fix build warning
Fix this build warning, which is generated if micro logs are enabled:

In file included from ../../core/cfs/cfs-coffee.c:59:0:
../../core/cfs/cfs-coffee.c: In function 'read_log_page':
../../cpu/cc2538/./cfs-coffee-arch.h:145:24: warning: passing argument 1 of 'cfs_coffee_arch_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   cfs_coffee_arch_read((buf), (size), (offset))
                        ^
../../core/cfs/cfs-coffee.c:757:3: note: in expansion of macro 'COFFEE_READ'
   COFFEE_READ(lp->buf, lp->size, base);
   ^
../../cpu/cc2538/./cfs-coffee-arch.h:176:6: note: expected 'void *' but argument is of type 'const char *'
 void cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset);
      ^

COFFEE_READ() needs to write to lp->buf, so the target type of this
pointer cannot be qualified as "const".

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-05-30 23:05:11 +02:00
Joakim Nohlgård 19550f9f7f core/cfs: Disallow seeking past the end of a file if it is not writable 2016-05-03 07:10:35 +02:00
Frank Freihube 59727ede70 fixup! make changes configurable through io_semantics() 2016-04-29 08:12:55 +02:00
Frank Freihube 5bd7fc86c3 make changes configurable through io_semantics() 2016-04-29 08:07:27 +02:00
Frank Freihube 7ba5b0d150 Trailing zeros in file leading to unexpected file length get set in destination buffer 2016-04-27 10:39:05 +02:00
Nicolas Tsiftes 86733e8702 Clarified and cleaned up Coffee's documentation and the debug statements. Formatted some source code for easier reading. 2016-04-20 14:34:17 +02:00
Nicolas Tsiftes 7f700c9564 Remove the protected memory code associated with sensornet checkpointing because this functionality has been removed from Contiki. 2016-04-20 12:47:37 +02:00
rajithr 0d8de9022c Remove redundant assignment 2015-05-20 15:37:32 +05:30
Nicolas Tsiftes da04ec74ed Corrected some code style issues in Coffee. 2015-02-17 11:02:06 +01:00
Nicolas Tsiftes 7004355c0f Do not copy more bytes than the filename string contains. 2014-06-11 14:10:00 +02:00
Nicolas Tsiftes aef0e9eae6 Ensure that the file end is updated in the original file extent if it has been overwritten through a micro log operation. 2014-03-03 21:27:26 +01:00
nvt 757a54f63c Added some comments about Antelope and Coffee. 2012-11-19 13:21:59 +01:00
nvt 5330dd1565 Avoid reading bytes from the original file when their is a log entry for that part of the file. 2011-07-30 10:05:23 +02:00
Nicolas Tsiftes ce909a97e6 Removed unread stack variable 2011-06-10 17:41:46 +02:00
Joakim Eriksson 77ec0bfa0f fixed the z1 platform and generic code used by z1 to work with IAR compiler 2011-05-25 17:21:51 +02:00
Fredrik Osterlind 499c13a357 removed execute flag of source files (avoids diff problems with egit) 2011-03-01 18:16:42 +01:00
nvt 20bf23cf06 Replaced ifdef with if, as salvopitru suggested 2011-02-14 15:53:08 +01:00
nvt 4125c38808 missing word 2011-02-13 21:34:29 +01:00
Nicolas Tsiftes 774aa3984a Use a more understandable name 2011-02-09 15:17:25 +01:00
Nicolas Tsiftes c77cb63df1 ifdef -> if 2011-02-09 15:13:50 +01:00
Nicolas Tsiftes 39ea9405bb Added a function for setting the I/O semantics on a Coffee file descriptor. Changed the configuration parameters slightly and updated the platform definitions to reflect this change. 2011-02-09 15:03:57 +01:00
nvt-se faab7229c9 Must check the storage boundary in find_contiguous_pages. 2011-01-25 18:39:09 +00:00
nvt-se 28421f1fe2 Removed watchdog calls from Coffee 2011-01-18 14:06:33 +00:00
nvt-se 404230a047 Added a macro for portable watchdog calls. 2010-12-15 14:01:07 +00:00
nvt-se 1168703506 Minor clarifications in the code and comments. Integrated atches from Frederic Sureau: 1. copy_buf is now an ordinary char pointer. 2. Read directly from a file that is not modified. This reduces the code size when COFFEE_MICRO_LOGS is set to 0. 3. Update the file end value each time it is changed in case a log merge operation occurs later. 4. Avoid possible alignment problem in reading from the dummy_space area when calling cfs_readdir. 2010-11-11 13:08:23 +00:00
nvt-se 909569f834 Must check if load_file succeeded 2010-10-01 20:14:14 +00:00
nvt-se 8c3ed291bb Preserve the file offset if a seek operation fails. 2010-05-13 18:24:55 +00:00
nvt-se e4187b2fc8 Made pointers constant and thereby reduced the code size slightly. 2010-05-05 12:35:39 +00:00
nvt-se f9ca4a546d 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 2010-04-12 13:20:55 +00:00
fros4943 b952f97799 stopping watchdog during find_file 2010-03-29 11:31:35 +00:00
nvt-se f4d19560fc Fixed a performance problem by not allowing GC while doing merges of files and micro logs. 2010-02-08 14:08:14 +00:00
nvt-se 3c890c48a9 Added some comments to clarify how Coffee works internally 2010-01-19 16:18:34 +00:00
nvt-se d2655eac7a make watchdog management slightly more abstract to simplify porting 2010-01-14 21:16:58 +00:00
nvt-se 62b380b0a6 Fixed a bug with reading to far in get_record index. Thanks to Darren Moore for reporting this. 2009-07-16 11:58:44 +00:00
nvt-se 906717a333 * isolate only pages in the last sector
* set max_pages to 0 when calling remove_by_page to prevent file starvation.
* when allocating files, only update next_free if the allocated file starts at next_free.

Thanks to Darren Moore (CSIRO) for suggesting the first two of the
three changes.
2009-07-09 22:16:22 +00:00
nvt-se c872a86653 undo accidental enabling of debug output. 2009-06-29 13:33:12 +00:00
nvt-se 1e0ca9ceac Made the use of micro logs configurable to make file modifications
more efficient on storage types that support inline updates.

The sky platform uses logs, and the native platform uses no logs.
2009-06-29 13:30:16 +00:00
nvt-se 53a8acc49a cleared debug flag. 2009-06-10 15:13:37 +00:00
nvt-se 349e14abd4 fixed GC bug with big files and unwanted buffer overwrite bug. 2009-06-10 15:03:35 +00:00
nvt-se d9b75b2fda stop the watchdog while merging. 2009-05-26 14:27:06 +00:00
nvt-se 88766d8740 use unsigned for sector count type. 2009-05-25 22:10:04 +00:00
nvt-se 2978270e43 decreased the code size to less than 5000 bytes. (msp430 code)
improved clarity in read and write code.
added negative offset check in cfs_seek().
removed unnecessary multiplication.
2009-05-13 13:27:19 +00:00
nvt-se 995e788d73 Fixed append->modify->append bug.
Approximately doubled the speed of file reservations.

Reduced the compiled code size by about 100 bytes by removing redundant code.
2009-05-11 16:35:49 +00:00
nvt-se 55ec3093ec removed complicated and mostly unused EOF hint code. 2009-05-04 22:30:32 +00:00
nvt-se 17fa2f1618 make sure that page isolation is called after erasing a sector in reluctant GC.
simplified the GC logic a bit.
2009-04-29 13:15:59 +00:00
nvt-se 3f205a1413 reluctant gc will now wait until the sector has no free pages
before erasing the sector.
2009-04-13 22:26:31 +00:00
nvt-se 4507891ed5 made gc on removal configurable since it decreases wear levelling.
cleaned up some code.
2009-04-02 14:20:04 +00:00
nvt-se 1425537a13 Introduced two garbage collection mode: greedy and reluctant.
The greedy GC mode attempts to erase as many sectors as possible, and
it is therefore a slow operation, since the flash driver must wait
for about a second after erasing one sector. The former behavior was
to always do a greedy GC if file reservations fails due to lack of space.

The new reluctant GC stops after erasing one sector, and therefore
we often do not have to wait if there is no file system operation
in the time while the sector is being erased. We call the garbage collector
using this mode when removing a file that is not a micro log file, since
the remove function is called recursively for micro log files that are
erased because the corresponding ordinary file is erased.

This change increases the coffee test (examples/sky/test-coffee.c) speed
from 9 to 5 seconds.
2009-04-02 11:22:23 +00:00