67 #define SOL_MEMMAP_VERSION_ENTRY "_version"
73 #define SOL_MEMMAP_ENTRY_BIT_SIZE(_name, _offset, _size, _bit_offset, _bit_size) \
74 static struct sol_memmap_entry _name = { .offset = (_offset), .size = (_size), .bit_size = (_bit_size), .bit_offset = (_bit_offset) }
81 #define SOL_MEMMAP_ENTRY(_name, _offset, _size) \
82 SOL_MEMMAP_ENTRY_BIT_SIZE(_name, _offset, _size, 0, 0)
88 #define SOL_MEMMAP_BOOL_ENTRY(_name, _offset, _bit_offset) \
89 SOL_MEMMAP_ENTRY_BIT_SIZE(_name, _offset, 1, _bit_offset, 1)
157 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
222 #define CREATE_BUFFER(_val) \
223 struct sol_buffer buf = SOL_BUFFER_INIT_FLAGS(_val, \
224 sizeof(*(_val)), SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED | SOL_BUFFER_FLAGS_NO_NUL_BYTE);
229 #define CREATE_BLOB(_val) \
230 struct sol_blob *blob; \
231 size_t _s = sizeof(*_val); \
232 void *v = malloc(_s); \
233 SOL_NULL_CHECK(v, -ENOMEM); \
234 memcpy(v, _val, _s); \
235 blob = sol_blob_new(&SOL_BLOB_TYPE_DEFAULT, NULL, v, _s); \
279 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
329 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
379 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
432 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
485 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
535 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
594 void (*cb)(
void *
data,
const char *name,
struct sol_blob *blob,
int status),
601 string = strdup(value);
int sol_memmap_write_raw(const char *name, struct sol_blob *blob, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes buffer contents to storage.
size_t offset
Offset of this entry on storage, in bytes.
Definition: sol-memmap-storage.h:131
static int sol_memmap_write_int32(const char *name, int32_t value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes an int32_t contents to storage.
Definition: sol-memmap-storage.h:378
int sol_memmap_read_raw(const char *name, struct sol_buffer *buffer)
Read storage contents to buffer.
#define SOL_NULL_CHECK(ptr,...)
Convenience macro to check for NULL pointer.
Definition: sol-log.h:223
#define SOL_BUFFER_INIT_EMPTY
Helper macro to initialize an empty buffer.
Definition: sol-buffer.h:153
static int sol_memmap_write_double(const char *name, double value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes a double contents to storage.
Definition: sol-memmap-storage.h:534
void sol_buffer_fini(struct sol_buffer *buf)
Finalizes the buffer.
int sol_memmap_add_map(const struct sol_memmap_map *map)
Add a map to internal list of available maps.
static int sol_memmap_write_string(const char *name, const char *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes a string contents to storage.
Definition: sol-memmap-storage.h:593
size_t size
Total size of this entry on storage, in bytes.
Definition: sol-memmap-storage.h:132
static int sol_memmap_read_irange(const char *name, struct sol_irange *value)
Reads an irange content.
Definition: sol-memmap-storage.h:404
static int sol_memmap_read_int32(const char *name, int32_t *value)
Reads an int32_t contents.
Definition: sol-memmap-storage.h:352
int sol_memmap_remove_map(const struct sol_memmap_map *map)
Removes a previously added map from internal list of available maps.
Memory map basic struct.
Definition: sol-memmap-storage.h:96
struct sol_memmap_map sol_memmap_map
Memory map basic struct.
These routines are used for Soletta types' manipulation.
static int sol_memmap_write_uint8(const char *name, uint8_t value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes an uint8_t contents to storage.
Definition: sol-memmap-storage.h:278
const struct sol_str_table_ptr * entries
Entries on map, containing name, offset and size.
Definition: sol-memmap-storage.h:122
static int sol_memmap_read_string(const char *name, char **value)
Reads a string contents.
Definition: sol-memmap-storage.h:558
Data type describing a Double range.
Definition: sol-types.h:187
uint8_t version
Version of map.
Definition: sol-memmap-storage.h:97
#define CREATE_BLOB(_val)
Macro to create a struct sol_blob with value passed as argument.
Definition: sol-memmap-storage.h:229
struct sol_blob * sol_blob_new(const struct sol_blob_type *type, struct sol_blob *parent, const void *mem, size_t size)
Creates a new blob instance of the given type type.
static int sol_memmap_read_bool(const char *name, bool *value)
Reads a boolean contents.
Definition: sol-memmap-storage.h:302
const struct sol_blob_type SOL_BLOB_TYPE_DEFAULT
Blob type object for the default implementation.
static struct sol_buffer value
Definition: server.c:42
These are routines that Soletta provides for its buffer implementation.
A memory map entry.
Definition: sol-memmap-storage.h:130
struct sol_memmap_entry sol_memmap_entry
A memory map entry.
static struct sol_timeout * timeout
Definition: browse.c:36
Data type describing Integer ranges.
Definition: sol-types.h:327
void * data
Buffer data.
Definition: sol-buffer.h:131
#define CREATE_BUFFER(_val)
Macro to create a struct sol_buffer with value passed as argument and flags SOL_BUFFER_FLAGS_MEMORY_N...
Definition: sol-memmap-storage.h:222
static int sol_memmap_write_drange(const char *name, struct sol_drange *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes an drange contents to storage.
Definition: sol-memmap-storage.h:484
static int sol_memmap_write_bool(const char *name, bool value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes a bool contents to storage.
Definition: sol-memmap-storage.h:328
static int sol_memmap_read_double(const char *name, double *value)
Reads a double contents.
Definition: sol-memmap-storage.h:508
Data type describing the default blob implementation.
Definition: sol-types.h:468
uint32_t bit_size
Total size of this entry on storage, in bits.
Definition: sol-memmap-storage.h:133
uint32_t timeout
Timeout, in milliseconds, of writing operations.
Definition: sol-memmap-storage.h:120
uint8_t bit_offset
Bit offset on first byte.
Definition: sol-memmap-storage.h:134
String/Pointer table type.
Definition: sol-str-table.h:141
static int sol_memmap_write_irange(const char *name, struct sol_irange *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes an irange contents to storage.
Definition: sol-memmap-storage.h:431
uint32_t sol_memmap_get_timeout(const struct sol_memmap_map *map)
Get map timeout.
static int sol_memmap_read_uint8(const char *name, uint8_t *value)
Read an uint8_t contents.
Definition: sol-memmap-storage.h:252
#define SOL_NULL_CHECK_GOTO(ptr, label)
Convenience macro to check for NULL pointer and jump to a given label.
Definition: sol-log.h:262
These are routines that Soletta provides for its string table implementation.
void * sol_buffer_steal(struct sol_buffer *buf, size_t *size)
'Steals' sol_buffer internal buffer and resets sol_buffer.
A sol_buffer is a dynamic array, that can be resized if needed.
Definition: sol-buffer.h:130
int sol_memmap_set_timeout(struct sol_memmap_map *map, uint32_t timeout)
Defines map timeout to actually perform write.
const char * path
Where to find the storage.
Definition: sol-memmap-storage.h:98
static int sol_memmap_read_drange(const char *name, struct sol_drange *value)
Reads a drange contents.
Definition: sol-memmap-storage.h:457
void sol_blob_unref(struct sol_blob *blob)
Decreases the reference counter of the given blob.