summaryrefslogtreecommitdiff
path: root/mesh/mesh.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-07-14 16:23:18 -0700
committerBrian Gix <brian.gix@intel.com>2019-07-15 14:48:04 -0700
commit7cafe5fd7cc86497c851e273550fb74fc52917d0 (patch)
tree63ee403213bff14c3b4cd6e749cdd494a46cd0d4 /mesh/mesh.c
parentd57524629036a4bbbe183b6a32afa02a87fe489d (diff)
downloadbluez-7cafe5fd7cc86497c851e273550fb74fc52917d0.tar.gz
mesh: Manage node config directory in mesh-config
This completely removes storage.c file. Instead, the handling of mesh node configuration storage is done completely in mesh-config layer by calling the following API functions: bool mesh_config_load_nodes(const char *cfg_dir, mesh_config_node_func_t cb, void *user_data) void mesh_config_release(struct mesh_config *cfg) void mesh_config_destroy(struct mesh_config *cfg) bool mesh_config_save(struct mesh_config *cfg, bool no_wait, mesh_config_status_func_t cb, void *user_data) struct mesh_config *mesh_config_create(const char *cfg_path, const uint8_t uuid[16], struct mesh_config_node *node)
Diffstat (limited to 'mesh/mesh.c')
-rw-r--r--mesh/mesh.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c
index b9e3162eb..9c6b9a70e 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -27,7 +27,6 @@
#include "mesh/mesh-io.h"
#include "mesh/node.h"
#include "mesh/net.h"
-#include "mesh/storage.h"
#include "mesh/provision.h"
#include "mesh/model.h"
#include "mesh/dbus.h"
@@ -78,6 +77,8 @@ static struct join_data *join_pending;
/* Pending method requests */
static struct l_queue *pending_queue;
+static const char *storage_dir;
+
static bool simple_match(const void *a, const void *b)
{
return a == b;
@@ -150,12 +151,11 @@ bool mesh_init(const char *config_dir, enum mesh_io_type type, void *opts)
mesh.prov_timeout = DEFAULT_PROV_TIMEOUT;
mesh.algorithms = DEFAULT_ALGORITHMS;
- if (!config_dir)
- config_dir = MESH_STORAGEDIR;
+ storage_dir = config_dir ? config_dir : MESH_STORAGEDIR;
- l_info("Loading node configuration from %s", config_dir);
+ l_info("Loading node configuration from %s", storage_dir);
- if (!storage_load_nodes(config_dir))
+ if (!node_load_from_storage(storage_dir))
return false;
mesh.io = mesh_io_new(type, opts);
@@ -638,3 +638,8 @@ bool mesh_dbus_init(struct l_dbus *dbus)
return true;
}
+
+const char *mesh_get_storage_dir(void)
+{
+ return storage_dir;
+}