diff --git a/include/settings/settings.h b/include/settings/settings.h index f2f4e43914a..6379597b171 100644 --- a/include/settings/settings.h +++ b/include/settings/settings.h @@ -74,7 +74,7 @@ struct settings_handler { * User might use it to apply setting to the application. */ - int (*h_export)(int (*export_func)(const char *name, void *val, + int (*h_export)(int (*export_func)(const char *name, const void *val, size_t val_len)); /**< This gets called to dump all current settings items. * @@ -139,7 +139,7 @@ int settings_save(void); * * @return 0 on success, non-zero on failure. */ -int settings_save_one(const char *name, void *value, size_t val_len); +int settings_save_one(const char *name, const void *value, size_t val_len); /** * Delete a single serialized in persisted storage. diff --git a/subsys/bluetooth/host/settings.c b/subsys/bluetooth/host/settings.c index 0dcb92a69e5..e7ebe4ef879 100644 --- a/subsys/bluetooth/host/settings.c +++ b/subsys/bluetooth/host/settings.c @@ -240,7 +240,7 @@ static int commit(void) return 0; } -static int export(int (*export_func)(const char *name, void *val, +static int export(int (*export_func)(const char *name, const void *val, size_t val_len)) { diff --git a/subsys/bluetooth/host/settings.h b/subsys/bluetooth/host/settings.h index 27d3a8a6387..0f79afe2af7 100644 --- a/subsys/bluetooth/host/settings.h +++ b/subsys/bluetooth/host/settings.h @@ -9,8 +9,8 @@ struct bt_settings_handler { int (*set)(int argc, char **argv, size_t len, settings_read_cb read_cb, void *cb_arg); int (*commit)(void); - int (*export)(int (*func)(const char *name, void *val, - size_t val_len)); + int (*export)(int (*func)(const char *name, + const void *val, size_t val_len)); }; #define BT_SETTINGS_DEFINE(_name, _set, _commit, _export) \ diff --git a/subsys/settings/src/settings_store.c b/subsys/settings/src/settings_store.c index 036484dc397..9128ea60e9d 100644 --- a/subsys/settings/src/settings_store.c +++ b/subsys/settings/src/settings_store.c @@ -60,7 +60,7 @@ int settings_load(void) /* * Append a single value to persisted config. Don't store duplicate value. */ -int settings_save_one(const char *name, void *value, size_t val_len) +int settings_save_one(const char *name, const void *value, size_t val_len) { struct settings_store *cs; diff --git a/tests/subsys/settings/fcb/src/settings_test_compress_deleted.c b/tests/subsys/settings/fcb/src/settings_test_compress_deleted.c index fb6e9f3c325..8e11e297ee0 100644 --- a/tests/subsys/settings/fcb/src/settings_test_compress_deleted.c +++ b/tests/subsys/settings/fcb/src/settings_test_compress_deleted.c @@ -28,7 +28,7 @@ struct deletable_s { u32_t val4v2; -int c4_handle_export(int (*cb)(const char *name, void *value, size_t val_len)); +int c4_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)); struct settings_handler c4_test_handler = { .name = "4", @@ -38,7 +38,7 @@ struct settings_handler c4_test_handler = { .h_export = c4_handle_export }; -int c4_handle_export(int (*cb)(const char *name, void *value, size_t val_len)) +int c4_handle_export(int (*cb)(const char *name, const void *value, size_t val_len)) { if (deletable_val.valid) { (void)cb(NAME_DELETABLE, &deletable_val.val32, diff --git a/tests/subsys/settings/fcb/src/settings_test_fcb.c b/tests/subsys/settings/fcb/src/settings_test_fcb.c index 9e350bc681c..33a8d65db89 100644 --- a/tests/subsys/settings/fcb/src/settings_test_fcb.c +++ b/tests/subsys/settings/fcb/src/settings_test_fcb.c @@ -27,17 +27,20 @@ int c1_handle_get(int argc, char **argv, char *val, int val_len_max); int c1_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, void *cb_arg); int c1_handle_commit(void); -int c1_handle_export(int (*cb)(const char *name, void *value, size_t val_len)); +int c1_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)); int c2_handle_get(int argc, char **argv, char *val, int val_len_max); int c2_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, void *cb_arg); -int c2_handle_export(int (*cb)(const char *name, void *value, size_t val_len)); +int c2_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)); int c3_handle_get(int argc, char **argv, char *val, int val_len_max); int c3_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, void *cb_arg); -int c3_handle_export(int (*cb)(const char *name, void *value, size_t val_len)); +int c3_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)); struct settings_handler c_test_handlers[] = { { @@ -122,7 +125,8 @@ int c1_handle_commit(void) return 0; } -int c1_handle_export(int (*cb)(const char *name, void *value, size_t val_len)) +int c1_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)) { if (test_export_block) { return 0; @@ -269,7 +273,8 @@ int c2_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, return -ENOENT; } -int c2_handle_export(int (*cb)(const char *name, void *value, size_t val_len)) +int c2_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)) { int i; char name[32]; @@ -310,7 +315,8 @@ int c3_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, return -ENOENT; } -int c3_handle_export(int (*cb)(const char *name, void *value, size_t val_len)) +int c3_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)) { (void)cb("3/v", &val32, sizeof(val32)); diff --git a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c index ef81c269b25..055b69e1e9f 100644 --- a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c +++ b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c @@ -29,8 +29,8 @@ static int c1_set(int argc, char **argv, size_t len, settings_read_cb read_cb, return -ENOENT; } -static int c1_export(int (*export_func)(const char *name, void *value, - size_t val_len)) +static int c1_export(int (*export_func)(const char *name, + const void *value, size_t val_len)) { (void)export_func("hello/val32", &val32, sizeof(val32)); diff --git a/tests/subsys/settings/nffs/src/settings_test_nffs.c b/tests/subsys/settings/nffs/src/settings_test_nffs.c index 8b31ab2e40d..0b8359fbea3 100644 --- a/tests/subsys/settings/nffs/src/settings_test_nffs.c +++ b/tests/subsys/settings/nffs/src/settings_test_nffs.c @@ -26,7 +26,8 @@ int c1_handle_get(int argc, char **argv, char *val, int val_len_max); int c1_handle_set(int argc, char **argv, size_t len, settings_read_cb read_cb, void *cb_arg); int c1_handle_commit(void); -int c1_handle_export(int (*cb)(const char *name, void *value, size_t val_len)); +int c1_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)); struct settings_handler c_test_handlers[] = { { @@ -108,7 +109,8 @@ int c1_handle_commit(void) return 0; } -int c1_handle_export(int (*cb)(const char *name, void *value, size_t val_len)) +int c1_handle_export(int (*cb)(const char *name, + const void *value, size_t val_len)) { if (test_export_block) { return 0;