Contiki 2.5
|
Files | |
file | storage_mmem.c |
Macros | |
#define | STORAGE_MMEM_FLAGS_LOCKED 0x1 |
Flags for the storage. | |
Functions | |
void | storage_mmem_prune () |
"Internal" functions More... | |
void | storage_mmem_reinit (void) |
Sets the storage to its initial state. | |
uint16_t | storage_mmem_delete_bundle (uint32_t bundle_number, uint8_t reason) |
deletes a bundle from storage More... | |
void | storage_mmem_update_statistics () |
internal function to send statistics to statistics module | |
void | storage_mmem_init (void) |
called by agent at startup | |
uint8_t | storage_mmem_make_room (struct mmem *bundlemem) |
This function delete as many bundles from the storage as necessary to have at least one slot and the number of required of memory free. More... | |
uint8_t | storage_mmem_save_bundle (struct mmem *bundlemem, uint32_t **bundle_number_ptr) |
saves a bundle in storage More... | |
struct mmem * | storage_mmem_read_bundle (uint32_t bundle_num) |
reads a bundle from storage More... | |
uint16_t | storage_mmem_get_free_space (struct mmem *bundlemem) |
checks if there is space for a bundle More... | |
uint16_t | storage_mmem_get_bundle_numbers (void) |
Get the number of slots available in storage. More... | |
struct storage_entry_t * | storage_mmem_get_bundles (void) |
Get the bundle list. More... | |
uint8_t | storage_mmem_lock_bundle (uint32_t bundle_num) |
Mark a bundle as locked so that it will not be deleted even if we are running out of space. More... | |
void | storage_mmem_unlock_bundle (uint32_t bundle_num) |
Mark a bundle as unlocked after being locked previously. | |
uint16_t storage_mmem_delete_bundle | ( | uint32_t | bundle_number, |
uint8_t | reason | ||
) |
deletes a bundle from storage
bundle_number | bundle number to be deleted |
reason | reason code |
Definition at line 388 of file storage_mmem.c.
References bundle_decrement(), entry, list_head(), list_item_next(), list_remove(), memb_free(), MMEM_PTR, NULL, STATUSREPORT, and storage_mmem_update_statistics().
Referenced by storage_mmem_make_room(), storage_mmem_prune(), and storage_mmem_reinit().
uint16_t storage_mmem_get_bundle_numbers | ( | void | ) |
Get the number of slots available in storage.
Definition at line 506 of file storage_mmem.c.
|
read |
Get the bundle list.
Definition at line 514 of file storage_mmem.c.
References list_head().
uint16_t storage_mmem_get_free_space | ( | struct mmem * | bundlemem | ) |
checks if there is space for a bundle
bundlemem | pointer to a bundle struct (not used here) |
Definition at line 497 of file storage_mmem.c.
References BUNDLE_STORAGE_SIZE.
uint8_t storage_mmem_lock_bundle | ( | uint32_t | bundle_num | ) |
Mark a bundle as locked so that it will not be deleted even if we are running out of space.
bundle_num | Bundle number |
Definition at line 525 of file storage_mmem.c.
References entry, list_head(), list_item_next(), NULL, and STORAGE_MMEM_FLAGS_LOCKED.
uint8_t storage_mmem_make_room | ( | struct mmem * | bundlemem | ) |
This function delete as many bundles from the storage as necessary to have at least one slot and the number of required of memory free.
bundlemem | Pointer to the MMEM struct containing the bundle |
Definition at line 168 of file storage_mmem.c.
References BUNDLE_STORAGE_SIZE, entry, list_head(), list_item_next(), MMEM_PTR, NULL, storage_mmem_delete_bundle(), STORAGE_MMEM_FLAGS_LOCKED, and storage_mmem_prune().
Referenced by storage_mmem_save_bundle().
void storage_mmem_prune | ( | ) |
"Internal" functions
deletes expired bundles from storage
Definition at line 123 of file storage_mmem.c.
References ctimer_restart(), entry, list_head(), list_item_next(), MMEM_PTR, NULL, and storage_mmem_delete_bundle().
Referenced by storage_mmem_init(), and storage_mmem_make_room().
|
read |
reads a bundle from storage
bundle_num | bundle number to read |
Definition at line 448 of file storage_mmem.c.
References bundle_increment(), entry, list_head(), list_item_next(), MMEM_PTR, and NULL.
uint8_t storage_mmem_save_bundle | ( | struct mmem * | bundlemem, |
uint32_t ** | bundle_number_ptr | ||
) |
saves a bundle in storage
bundlemem | pointer to the bundle |
bundle_number_ptr | pointer where the bundle number will be stored (on success) |
Definition at line 299 of file storage_mmem.c.
References bundle_decrement(), bundle_increment(), entry, list_add(), list_head(), list_item_next(), memb_alloc(), MMEM_PTR, NULL, storage_mmem_make_room(), and storage_mmem_update_statistics().