persist/persist.h header reference
[Persistent configuration service module]
The source code of this header can be browsed online.
Description [link]
Persistent configuration library
Members [link]
Types [link]
- struct persist_config
- struct persist_context_s
- struct persist_descriptor_s
- struct persist_rq_s
- enum persist_type_e
- enum persist_state_e
- struct persist_status_s
Functions [link]
- ENUM_DESCRIPTOR(persist_type_e , strip:PERSIST_, upper )
- void persist_context_init(struct persist_context_s *ctx, uintptr_t dev_addr, size_t dev_size, size_t page_size)
- void persist_erase(struct persist_context_s *ctx, struct persist_rq_s *rq)
- void persist_pack(struct persist_context_s *ctx, struct persist_rq_s *rq)
- void persist_read(struct persist_context_s *ctx, struct persist_rq_s *rq)
- void persist_remove(struct persist_context_s *ctx, struct persist_rq_s *rq)
- struct persist_rq_s * persist_rq_s_from_kr(void *x)
- error_t persist_wait_counter_read(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, uint64_t *value)
- error_t persist_wait_erase(struct persist_context_s *ctx)
- error_t persist_wait_inc(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, uint64_t *counter)
- error_t persist_wait_pack(struct persist_context_s *ctx)
- error_t persist_wait_read(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, const void **data)
- error_t persist_wait_remove(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset)
- error_t persist_wait_write(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, const void *data)
- void persist_write(struct persist_context_s *ctx, struct persist_rq_s *rq)
- void persist_sched_init(struct persist_rq_s *rq, struct persist_status_s *status)
- void persist_sched_wait(struct persist_status_s *status)
Macro [link]
Members detail [link]
ENUM_DESCRIPTOR(persist_type_e , strip:PERSIST_, upper ) [link]
This constructor is declared in persist/persist.h source file, line 56.
#define CONFIG_PERSIST_RAM_BACKEND_PAGESIZE [link]
This macro is declared in persist/persist.h source file, line 42.
Documentation from alternate declaration:
Token description: Set page size for the compiled test
This token is declared in libpersist/persist.config, line 13.
The default value is `0x1000'.
This token has the following parents:
Preprocessor condition: defined( CONFIG_PERSIST_RAM_BACKEND ) and not defined( CONFIG_PERSIST_RAM_BACKEND_PAGESIZE )
#define PERSIST_FLASH_ERASE_VALUE [link]
This macro is declared in persist/persist.h source file, line 40.
backend choice
Preprocessor condition: defined( CONFIG_PERSIST_RAM_BACKEND )
#define __PERSIST_H__ [link]
This macro is declared in persist/persist.h source file, line 28.
struct persist_config [link]
This struct is declared in persist/persist.h source file, line 60.
Persist config
void persist_context_init(struct persist_context_s *ctx, uintptr_t dev_addr, size_t dev_size, size_t page_size) [link]
This function is declared in persist/persist.h source file, line 161.
Initialize a context for access to a persistent storage in a memory area.
struct persist_context_s [link]
This struct is declared in persist/persist.h source file, line 68.
Persistent storage context
Field | Description |
---|---|
uintptr_t addr; | |
size_t page_size; | |
size_t slot_size; | |
uint8_t current_slot; | |
size_t used; | |
size_t reclaimable; | |
size_t available; |
struct persist_descriptor_s [link]
This struct is declared in persist/persist.h source file, line 101.
Value descriptor.
void persist_erase(struct persist_context_s *ctx, struct persist_rq_s *rq) [link]
This function is declared in persist/persist.h source file, line 179.
Erase all entries, start fresh with a blank storage. This does not check for previous storage contents.
This is available when CONFIG_PERSIST is defined.
void persist_pack(struct persist_context_s *ctx, struct persist_rq_s *rq) [link]
This function is declared in persist/persist.h source file, line 189.
Pack storage. Collect all erased entries.
This is available when CONFIG_PERSIST is defined.
void persist_read(struct persist_context_s *ctx, struct persist_rq_s *rq) [link]
This function is declared in persist/persist.h source file, line 167.
Read an entry. Caller will get data pointer set to start of value if present.
This is available when CONFIG_PERSIST is defined.
void persist_remove(struct persist_context_s *ctx, struct persist_rq_s *rq) [link]
This function is declared in persist/persist.h source file, line 184.
Remove a given entry, if present.
This is available when CONFIG_PERSIST is defined.
struct persist_rq_s [link]
This struct is declared in persist/persist.h source file, line 115.
Persist request object.
Field | Description |
---|---|
struct kroutine_s kr; | Executed when request done |
void * pvdata; | Reserved for application |
const struct persist_descriptor_s * descriptor; | Value descriptor |
uint16_t uid_offset; | UID offset to add to descriptor's base UID |
error_t error; | Access return status |
union <anonymous> { | |
const void * data; |
|
uint64_t counter; |
|
}; |
struct persist_rq_s * persist_rq_s_from_kr(void *x) [link]
This function is declared in persist/persist.h source file, line 155.
enum persist_type_e [link]
This enum is declared in persist/persist.h source file, line 84.
Value type
Identifier | Description |
---|---|
PERSIST_BLOB | A blob may hold any value. It is reallocated when written to. |
PERSIST_COUNTER | A counter can only be incremented or reset. It is stored in two fields in backing storage: a counter part, and a bitfield part. Single increments changes single bits in the bitfield part as long as there are some left. When all bytes got consumed, value is reallocated. This minimizes wear on backing storage. Writes to counters actually increment counter with passed value. |
error_t persist_wait_counter_read(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, uint64_t *value) [link]
This function is declared in persist/persist.h source file, line 366.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_erase(struct persist_context_s *ctx) [link]
This function is declared in persist/persist.h source file, line 315.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_inc(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, uint64_t *counter) [link]
This function is declared in persist/persist.h source file, line 341.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request. The value of counter must contain the increment and is replaced by the value of the counter after the operation.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_pack(struct persist_context_s *ctx) [link]
This function is declared in persist/persist.h source file, line 297.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_read(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, const void **data) [link]
This function is declared in persist/persist.h source file, line 233.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_remove(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset) [link]
This function is declared in persist/persist.h source file, line 279.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
error_t persist_wait_write(struct persist_context_s *ctx, const struct persist_descriptor_s *desc, uint16_t uid_offset, const void *data) [link]
This function is declared in persist/persist.h source file, line 257.
Synchronous persist device operation function. This function use the scheduler api to put current context in wait state during the request.
This is available when CONFIG_PERSIST and CONFIG_MUTEK_CONTEXT_SCHED are both defined.
void persist_write(struct persist_context_s *ctx, struct persist_rq_s *rq) [link]
This function is declared in persist/persist.h source file, line 173.
Write an entry. Entry will be replaced if present already. This may pack existing storage.
This is available when CONFIG_PERSIST is defined.
void persist_sched_init(struct persist_rq_s *rq, struct persist_status_s *status) [link]
This function is declared in persist/persist.h source file, line 204.
This function is for internal use only.
Preprocessor condition: defined( CONFIG_MUTEK_CONTEXT_SCHED )
void persist_sched_wait(struct persist_status_s *status) [link]
This function is declared in persist/persist.h source file, line 207.
This function is for internal use only.
Preprocessor condition: defined( CONFIG_MUTEK_CONTEXT_SCHED )
enum persist_state_e [link]
This enum is declared in persist/persist.h source file, line 49.
This enum is for internal use only.
Identifier | Description |
---|---|
PERSIST_STATE_ERASED | |
PERSIST_STATE_WRITTEN | |
PERSIST_STATE_BUSY | |
PERSIST_STATE_FREE |
struct persist_status_s [link]
This struct is declared in persist/persist.h source file, line 196.
This struct is for internal use only.
Preprocessor condition: defined( CONFIG_MUTEK_CONTEXT_SCHED )
Field | Description |
---|---|
lock_t lock; | |
struct sched_context_s * ctx; | |
bool_t done; |