mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [26/50] [abbrv] incubator-mynewt-core git commit: sys/config; change export function prototype. Added argument which tells whether module should export variables it wants to persist, or variables it wants to display.
Date Fri, 08 Jul 2016 21:20:13 GMT
sys/config; change export function prototype.
Added argument which tells whether module should export variables
it wants to persist, or variables it wants to display.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9490ca70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9490ca70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9490ca70

Branch: refs/heads/master
Commit: 9490ca7056298b0b00e33a6f59b91ec0e7fbd4aa
Parents: 93f2e11
Author: Marko Kiiskila <marko@runtime.io>
Authored: Mon Jun 27 15:26:56 2016 -0700
Committer: Marko Kiiskila <marko@runtime.io>
Committed: Mon Jun 27 15:26:56 2016 -0700

----------------------------------------------------------------------
 apps/slinky/src/main.c             |  5 +++--
 sys/config/include/config/config.h |  8 +++++++-
 sys/config/src/config_cli.c        |  2 +-
 sys/config/src/config_store.c      |  2 +-
 sys/config/src/test/conf_test.c    | 18 ++++++++++++------
 5 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9490ca70/apps/slinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/slinky/src/main.c b/apps/slinky/src/main.c
index 569f040..59c569d 100755
--- a/apps/slinky/src/main.c
+++ b/apps/slinky/src/main.c
@@ -131,7 +131,8 @@ struct os_mempool default_mbuf_mpool;
 static char *test_conf_get(int argc, char **argv, char *val, int max_len);
 static int test_conf_set(int argc, char **argv, char *val);
 static int test_conf_commit(void);
-static int test_conf_export(void (*export_func)(char *name, char *val));
+static int test_conf_export(void (*export_func)(char *name, char *val),
+  enum conf_export_tgt tgt);
 
 static struct conf_handler test_conf_handler = {
     .ch_name = "test",
@@ -182,7 +183,7 @@ test_conf_commit(void)
 }
 
 static int
-test_conf_export(void (*func)(char *name, char *val))
+test_conf_export(void (*func)(char *name, char *val), enum conf_export_tgt tgt)
 {
     char buf[4];
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9490ca70/sys/config/include/config/config.h
----------------------------------------------------------------------
diff --git a/sys/config/include/config/config.h b/sys/config/include/config/config.h
index b0bc8aa..3402b46 100644
--- a/sys/config/include/config/config.h
+++ b/sys/config/include/config/config.h
@@ -42,13 +42,19 @@ enum conf_type {
     CONF_DOUBLE
 } __attribute__((__packed__));
 
+enum conf_export_tgt {
+    CONF_EXPORT_PERSIST,        /* Value is to be persisted. */
+    CONF_EXPORT_SHOW            /* Value is to be displayed. */
+};
+
 struct conf_handler {
     SLIST_ENTRY(conf_handler) ch_list;
     char *ch_name;
     char *(*ch_get)(int argc, char **argv, char *val, int val_len_max);
     int (*ch_set)(int argc, char **argv, char *val);
     int (*ch_commit)(void);
-    int (*ch_export)(void (*export_func)(char *name, char *val));
+    int (*ch_export)(void (*export_func)(char *name, char *val),
+      enum conf_export_tgt tgt);
 };
 
 int conf_init(void);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9490ca70/sys/config/src/config_cli.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_cli.c b/sys/config/src/config_cli.c
index 7c39598..2923845 100644
--- a/sys/config/src/config_cli.c
+++ b/sys/config/src/config_cli.c
@@ -48,7 +48,7 @@ conf_dump_running(void)
 
     SLIST_FOREACH(ch, &conf_handlers, ch_list) {
         if (ch->ch_export) {
-            ch->ch_export(conf_running_one);
+            ch->ch_export(conf_running_one, CONF_EXPORT_SHOW);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9490ca70/sys/config/src/config_store.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_store.c b/sys/config/src/config_store.c
index 6bd94a1..87f9955 100644
--- a/sys/config/src/config_store.c
+++ b/sys/config/src/config_store.c
@@ -159,7 +159,7 @@ conf_save(void)
     rc = 0;
     SLIST_FOREACH(ch, &conf_handlers, ch_list) {
         if (ch->ch_export) {
-            rc2 = ch->ch_export(conf_store_one);
+            rc2 = ch->ch_export(conf_store_one, CONF_EXPORT_PERSIST);
             if (!rc) {
                 rc = rc2;
             }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9490ca70/sys/config/src/test/conf_test.c
----------------------------------------------------------------------
diff --git a/sys/config/src/test/conf_test.c b/sys/config/src/test/conf_test.c
index 35ed588..cde1cca 100644
--- a/sys/config/src/test/conf_test.c
+++ b/sys/config/src/test/conf_test.c
@@ -46,15 +46,18 @@ static char *ctest_handle_get(int argc, char **argv, char *val,
   int val_len_max);
 static int ctest_handle_set(int argc, char **argv, char *val);
 static int ctest_handle_commit(void);
-static int ctest_handle_export(void (*cb)(char *name, char *value));
+static int ctest_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt);
 static char *c2_handle_get(int argc, char **argv, char *val,
   int val_len_max);
 static int c2_handle_set(int argc, char **argv, char *val);
-static int c2_handle_export(void (*cb)(char *name, char *value));
+static int c2_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt);
 static char *c3_handle_get(int argc, char **argv, char *val,
   int val_len_max);
 static int c3_handle_set(int argc, char **argv, char *val);
-static int c3_handle_export(void (*cb)(char *name, char *value));
+static int c3_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt);
 
 struct conf_handler config_test_handler = {
     .ch_name = "myfoo",
@@ -98,7 +101,8 @@ ctest_handle_commit(void)
 }
 
 static int
-ctest_handle_export(void (*cb)(char *name, char *value))
+ctest_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt)
 {
     char value[32];
 
@@ -177,7 +181,8 @@ c2_handle_set(int argc, char **argv, char *val)
 }
 
 static int
-c2_handle_export(void (*cb)(char *name, char *value))
+c2_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt)
 {
     int i;
     char name[32];
@@ -222,7 +227,8 @@ c3_handle_set(int argc, char **argv, char *val)
 }
 
 static int
-c3_handle_export(void (*cb)(char *name, char *value))
+c3_handle_export(void (*cb)(char *name, char *value),
+  enum conf_export_tgt tgt)
 {
     char value[32];
 


Mime
View raw message