Go to the documentation of this file.
31 #if (CH_CFG_USE_OBJ_CACHES == TRUE) || defined(__DOXYGEN__)
41 #define OC_FLAG_INLRU 0x00000001U
42 #define OC_FLAG_INHASH 0x00000002U
43 #define OC_FLAG_SHARED 0x00000004U
44 #define OC_FLAG_NOTSYNC 0x00000008U
45 #define OC_FLAG_LAZYWRITE 0x00000010U
46 #define OC_FLAG_FORGET 0x00000020U
oc_writef_t writef
Writer functions for cached objects.
void * objvp
Pointer to the objects table.
uint32_t obj_key
Object key.
oc_readf_t readf
Reader functions for cached objects.
bool(* oc_writef_t)(objects_cache_t *ocp, oc_object_t *objp, bool async)
Object write function.
void chCacheObjectInit(objects_cache_t *ocp, ucnt_t hashn, oc_hash_header_t *hashp, ucnt_t objn, size_t objsz, void *objvp, oc_readf_t readf, oc_writef_t writef)
Initializes a objects_cache_t object.
oc_object_t * chCacheGetObject(objects_cache_t *ocp, uint32_t group, uint32_t key)
Retrieves an object from the cache.
ucnt_t objn
Number of elements in the objects table.
oc_lru_header_t lru
LRU list header.
bool(* oc_readf_t)(objects_cache_t *ocp, oc_object_t *objp, bool async)
Object read function.
oc_object_t * hash_next
Next in the collisions list.
Structure representing a cached object.
oc_object_t * lru_prev
Previous in the LRU list.
oc_hash_header_t * hashp
Pointer to the hash table.
uint32_t oc_flags_t
Flags of cached objects.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
uint32_t obj_group
Object group.
bool chCacheReadObject(objects_cache_t *ocp, oc_object_t *objp, bool async)
Reads object data from the storage.
static void chCacheReleaseObject(objects_cache_t *ocp, oc_object_t *objp)
Releases an object into the cache.
semaphore_t cache_sem
Semaphore for cache access.
semaphore_t obj_sem
Semaphore for object access.
Structure representing a cache object.
semaphore_t lru_sem
Semaphore for LRU access.
bool chCacheWriteObject(objects_cache_t *ocp, oc_object_t *objp, bool async)
Writes the object data back to storage.
void chCacheReleaseObjectI(objects_cache_t *ocp, oc_object_t *objp)
Releases an object into the cache.
oc_flags_t obj_flags
Object flags.
oc_object_t * lru_next
Next in the LRU list.
size_t objsz
Size of elements in the objects table.
oc_object_t * hash_prev
Previous in the collisions list.
#define chSysUnlock()
Leaves the kernel lock state.
ucnt_t hashn
Number of elements in the hash table.
#define chSysLock()
Enters the kernel lock state.