Commit Graph

8 Commits (960d69f081ed540f83ac02fe87760a9635f1712b)

Author SHA1 Message Date
Simon Hughes 5e22db842f This commit includes the following CFSTORE/Flash-Journal/Storage updates and fixes:
- flash-journal basicAPI fix for ARM toolchain
- Updated storage-abstraction with version 0.4.7
  (commit c7c4a8c52298bbc006a6f53a059fb2599cad73cc).
- https://github.com/ARMmbed/storage-volume-manager at version v0.2.10.
- https://github.com/ARMmbed/mtd-k64f v0.4.2 version of flash.c (imported as storage_driver.c).
- update to CFSTORE to use the storage-volume-manager API to initialize volume manager and
  add a volume for CFSTORE to use.
- https://github.com/ARMmbed/flash-journal at version v0.5.3
  (commit 4c58165e2fa02c6ed2b9d166a9c96967e81f458f) including readFrom() support.
- Taking flash-journal-strategy-sequential v0.6.7 strategy.c
  (commit b11a718761aa9f33679956968a21aaef9179bde1).
- GCC_ARM, ARM and IAR compiler warning fixes for new versions of flash-journal code.
- Fix storage-volume-manager test cases for concurrent access from 2 volumes to use
  addresses within the 512-1024kB address range, which is within the cfstore added volume.
- Fix cfstore/storage-volume-manager IAR warnings when building with verbose flag.
2016-09-13 18:16:56 +01:00
Sam Grove 5b90bf7b1d Merge pull request #2624 from simonqhughes/master
CFSTORE Bugfix for realloc() moving KV area and cfstore_file_t data structures not being updated correctly
2016-09-10 07:26:41 -05:00
Simon Hughes b2f561a917 Restoring swap code to cfstore_test_delete_all() after being previously removed to work around CFSTORE issue 17/23 (realloc()). 2016-09-05 14:16:40 +01:00
Simon Hughes d9ad7bbb99 This commit contains CFSTORE fixes for the following related issues:
- issue 17: Heap corruption.
- issue 23: Handles invalidated when realloc called.
- issue 24: cfstore_find returns error when "previous" parameter is NULL.
- issue 25: Memory leak when out of memory.

With respect to issues 17 and 23:
- A code defect existed for correctly updating cfstore_file_t data structures
  under the following conditions:
  -- the KV memory area contained some KV's.
  -- cfstore calls realloc() to increase the size of the KV area in
     memory because:
	  * A new KV was being added to the KV area, or
	  * the size of a pre-existing KV was being increased.
  -- The returned address from realloc() has changed from before the
     call (i.e. the location in memory of the KV area has changed)
	 e.g. the presence of heap memory objects directly above the KV memory
	 area in the memory address space causes realloc() to move the KV area
	 so the newly increased area can be accommodated at contiguous addresses.
  -- In this scenario, the cfstore_file_t (structures for open files) head pointers
     do not get correctly updated.
  -- The defect was fixed by correctly updating the cfstore_file_t:: head pointer.
  -- A new add_del test case was added to the scenario where a new KV is being added
     to the KV area.
  -- A new create test case was added to the scenario where the size of a
     pre-existing KV is being increased in size.

- A code defect for suppling a NULL handle as the previous argument to the Find() method
  (issue 24).
	-- Supply a null handle is valid, but it was being used to check for a valid hkey,
	   which was incorrect.
	-- A new test case was added to check the case of supplying a NULL previous argument
	   works correctly.

- A code defect for a memory leak under the following conditions (issue 25):
  -- When realloc() fails to perform a requested change to the size of the KV area, the
     error handling sometimes incorrectly sets cfstore_context_t::area_0_head to NULL.
	 Cfstore returns a suitable error to the client. If memory had previously been held
	 at area_0_head, realloc(area_0_head, size) returning NULL means the memory
	 at area_0_head is still retained.
  -- On receiving the error code, the client cleans up including a call to Uninitialize().
     This should free the retained but as area_0_head == NULL this is not possible. Hence
	 a memory leak occurred.
  -- This was fixed by not setting area_0_head = NULL on the realloc() failure.
  -- A create test case was modified to detect the leaking of memory in this way.
2016-09-05 12:45:43 +01:00
Marcus Chang 076515c15f Added define guards for SEQUENTIAL_FLASH_JOURNAL_MAX_LOGGED_BLOBS so that the value can be passed as an argument during compile time. 2016-08-25 14:16:59 +01:00
Russ Butler 81859050c3 Fix cfstore_test_delete_all by removing swap
Remove the handle swap in cfstore_test_delete_all. This prevents a
deleted handle from being used.
2016-08-22 18:32:59 -05:00
Russ Butler 1799ace8ba Fix intermittent config store tests failures
Make the journal object in cfstore_test_startup static since the call
to FlashJournal_initialize keep a copy of this for future use. This fixes
an intermittent crash start started showing up when optimizations
were set to "-os".
2016-07-26 23:07:26 -05:00
Simon Hughes c2d849133f Adding mbed-os/features/storage to mbed/features/storage/FEATURE_STORAGE (before deleting mbed-os/features/storage). 2016-07-26 23:07:24 -05:00