summaryrefslogtreecommitdiff
path: root/src/storage.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-01-04 19:25:07 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-01-04 19:25:07 +0100
commit92fcf25b006be340a57d75882365f1a6747dc668 (patch)
treeeafbe9f0aa3ef1d71e713b78717f866b7296973b /src/storage.c
parent409f3e68cc39cb66fe706c164484518e3706c81e (diff)
downloadconnman-92fcf25b006be340a57d75882365f1a6747dc668.tar.gz
connman-92fcf25b006be340a57d75882365f1a6747dc668.tar.bz2
connman-92fcf25b006be340a57d75882365f1a6747dc668.zip
Add functions for loading and saving information
Diffstat (limited to 'src/storage.c')
-rw-r--r--src/storage.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index 1266fc28..5bf3f3f7 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -66,6 +66,86 @@ void connman_storage_unregister(struct connman_storage *storage)
storage_list = g_slist_remove(storage_list, storage);
}
+int __connman_storage_load_device(struct connman_device *device)
+{
+ GSList *list;
+
+ DBG("device %p", device);
+
+ for (list = storage_list; list; list = list->next) {
+ struct connman_storage *storage = list->data;
+
+ if (storage->device_load) {
+ DBG("%s", storage->name);
+
+ if (storage->device_load(device) == 0)
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
+int __connman_storage_save_device(struct connman_device *device)
+{
+ GSList *list;
+
+ DBG("device %p", device);
+
+ for (list = storage_list; list; list = list->next) {
+ struct connman_storage *storage = list->data;
+
+ if (storage->device_save) {
+ DBG("%s", storage->name);
+
+ if (storage->device_save(device) == 0)
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
+int __connman_storage_load_network(struct connman_network *network)
+{
+ GSList *list;
+
+ DBG("network %p", network);
+
+ for (list = storage_list; list; list = list->next) {
+ struct connman_storage *storage = list->data;
+
+ if (storage->network_load) {
+ DBG("%s", storage->name);
+
+ if (storage->network_load(network) == 0)
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
+int __connman_storage_save_network(struct connman_network *network)
+{
+ GSList *list;
+
+ DBG("network %p", network);
+
+ for (list = storage_list; list; list = list->next) {
+ struct connman_storage *storage = list->data;
+
+ if (storage->network_save) {
+ DBG("%s", storage->name);
+
+ if (storage->network_save(network) == 0)
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
int __connman_storage_init(void)
{
DBG("");