66 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
85 #define CREATE_BUFFER(_val) \
86 struct sol_buffer buf SOL_BUFFER_INIT_FLAGS(_val, \
87 sizeof(*(_val)), SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED | SOL_BUFFER_FLAGS_NO_NUL_BYTE);
89 #define CREATE_BUFFER(_val) \
90 struct sol_buffer buf = SOL_BUFFER_INIT_FLAGS(_val, \
91 sizeof(*(_val)), SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED | SOL_BUFFER_FLAGS_NO_NUL_BYTE);
97 #define CREATE_BLOB(_val) \
98 struct sol_blob *blob; \
99 size_t _s = sizeof(*_val); \
100 void *v = malloc(_s); \
101 SOL_NULL_CHECK(v, -ENOMEM); \
102 memcpy(v, _val, _s); \
103 blob = sol_blob_new(&SOL_BLOB_TYPE_DEFAULT, NULL, v, _s); \
139 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
182 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
225 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
268 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
311 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
354 void (*cb)(
void *data,
const char *name,
struct sol_blob *blob,
int status),
406 void (*cb)(
void *
data,
const char *name,
struct sol_blob *blob,
int status),
413 string = strdup(value);
static int sol_fs_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 sol_drange struct in storage.
Definition: sol-fs-storage.h:310
static int sol_fs_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 sol_irange struct in storage.
Definition: sol-fs-storage.h:267
static int sol_fs_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 in storage.
Definition: sol-fs-storage.h:405
#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
void sol_buffer_fini(struct sol_buffer *buf)
Finalizes the buffer.
These routines are used for Soletta types' manipulation.
Data type describing a Double range.
Definition: sol-types.h:187
static int sol_fs_read_string(const char *name, char **value)
Read string in storage.
Definition: sol-fs-storage.h:376
static int sol_fs_read_double(const char *name, double *value)
Read double in storage.
Definition: sol-fs-storage.h:333
static int sol_fs_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 uint8_t in storage.
Definition: sol-fs-storage.h:138
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.
const struct sol_blob_type SOL_BLOB_TYPE_DEFAULT
Blob type object for the default implementation.
These routines are used for Soletta logging.
static struct sol_buffer value
Definition: server.c:42
These are routines that Soletta provides for its buffer implementation.
#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-fs-storage.h:89
Data type describing Integer ranges.
Definition: sol-types.h:327
void * data
Buffer data.
Definition: sol-buffer.h:131
Data type describing the default blob implementation.
Definition: sol-types.h:468
static int sol_fs_read_bool(const char *name, bool *value)
Read a boolean from storage.
Definition: sol-fs-storage.h:161
static int sol_fs_read_uint8(const char *name, uint8_t *value)
Read an uint8_t from storage.
Definition: sol-fs-storage.h:118
static int sol_fs_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 int32 in storage.
Definition: sol-fs-storage.h:224
static int sol_fs_read_drange(const char *name, struct sol_drange *value)
Read sol_drange struct from storage.
Definition: sol-fs-storage.h:290
#define CREATE_BLOB(_val)
Macro to create a struct sol_blob with value passed as argument.
Definition: sol-fs-storage.h:97
#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
static int sol_fs_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 in storage.
Definition: sol-fs-storage.h:353
void * sol_buffer_steal(struct sol_buffer *buf, size_t *size)
'Steals' sol_buffer internal buffer and resets sol_buffer.
int sol_fs_read_raw(const char *name, struct sol_buffer *buffer)
Read stored contents and set to buffer.
A sol_buffer is a dynamic array, that can be resized if needed.
Definition: sol-buffer.h:130
static int sol_fs_read_int32(const char *name, int32_t *value)
Read an int32 from storage.
Definition: sol-fs-storage.h:204
int sol_fs_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.
static int sol_fs_read_irange(const char *name, struct sol_irange *value)
Read sol_irange struct from storage.
Definition: sol-fs-storage.h:247
static int sol_fs_write_bool(const char *name, bool value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data)
Writes boolean in storage.
Definition: sol-fs-storage.h:181
void sol_blob_unref(struct sol_blob *blob)
Decreases the reference counter of the given blob.