You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/07/02 08:40:15 UTC

[GitHub] mkiiskila closed pull request #1233: sys/config; add conf_set_from_storage().

mkiiskila closed pull request #1233: sys/config; add conf_set_from_storage().
URL: https://github.com/apache/mynewt-core/pull/1233
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sys/config/include/config/config.h b/sys/config/include/config/config.h
index 811265336a..063e111752 100644
--- a/sys/config/include/config/config.h
+++ b/sys/config/include/config/config.h
@@ -195,6 +195,13 @@ int conf_load(void);
  */
 int conf_ensure_loaded(void);
 
+/**
+ * Config setting comes as a result of conf_load().
+ *
+ * @return 1 if yes, 0 if not.
+ */
+int conf_set_from_storage(void);
+
 /**
  * Save currently running configuration. All configuration which is different
  * from currently persisted values will be saved.
@@ -223,12 +230,6 @@ int conf_save_tree(char *name);
  */
 int conf_save_one(const char *name, char *var);
 
-/*
-  XXXX for later
-  int conf_save_lib(char *name);
-  int conf_save_var(char *name, char *var);
-*/
-
 /**
  * Set configuration item identified by @p name to be value @p val_str.
  * This finds the configuration handler for this subtree and calls it's
diff --git a/sys/config/src/config_store.c b/sys/config/src/config_store.c
index 2aa3802b59..7f74870156 100644
--- a/sys/config/src/config_store.c
+++ b/sys/config/src/config_store.c
@@ -32,6 +32,7 @@ struct conf_dup_check_arg {
 
 struct conf_store_head conf_load_srcs;
 struct conf_store *conf_save_dst;
+static bool conf_loading;
 static bool conf_loaded;
 
 void
@@ -75,12 +76,14 @@ conf_load(void)
      */
     conf_lock();
     conf_loaded = true;
+    conf_loading = true;
     SLIST_FOREACH(cs, &conf_load_srcs, cs_next) {
         cs->cs_itf->csi_load(cs, conf_load_cb, NULL);
         if (SLIST_NEXT(cs, cs_next)) {
             conf_commit(NULL);
         }
     }
+    conf_loading = false;
     conf_unlock();
     return conf_commit(NULL);
 }
@@ -95,6 +98,12 @@ conf_ensure_loaded(void)
     return conf_load();
 }
 
+int
+conf_set_from_storage(void)
+{
+    return conf_loading;
+}
+
 static void
 conf_dup_check_cb(char *name, char *val, void *cb_arg)
 {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services