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 2020/02/07 22:09:07 UTC
[GitHub] [mynewt-core] ccollins476ad opened a new pull request #2181: [RFC]
sys/config: Extended callbacks
ccollins476ad opened a new pull request #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181
This PR is needed for the "scfg" feature (PR link coming soon).
The four conf_handler callbacks (get, set, commit, and export) do not accept a `void *arg` parameter. This means every config group must define a dedicated set of callback functions, making it impossible wrap the config API in a generic way.
This PR allows config groups to be defined as "extended". An extended config group uses slightly different callbacks. These callbacks do take a `void *arg` parameter.
To define an extended config group, set its `ch_ext` member to 1.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] ccollins476ad commented on a change in pull request
#2181: [RFC] sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
ccollins476ad commented on a change in pull request #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#discussion_r378526340
##########
File path: sys/config/include/config/config.h
##########
@@ -157,14 +162,40 @@ struct conf_handler {
* The name of the conifguration item/subtree
*/
char *ch_name;
+
+ /**
+ * Whether to use the extended callbacks.
+ * 0=standard
+ * 1=extended
+ */
+ uint8_t ch_ext : 1;
Review comment:
I agree, it should be a bool. I think I was bothered by the size increase of this struct so I went overboard. But since there is only one field like this, we're not saving any space anyway. I'll change it to bool.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2181: [RFC]
sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#issuecomment-583638565
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### sys/config/include/config/config.h
<details>
```diff
@@ -149,9 +149,9 @@
* @return 0 on success, non-zero error code on failure.
*/
typedef int (*conf_export_handler_t)(conf_export_func_t export_func,
- conf_export_tgt_t tgt);
+ conf_export_tgt_t tgt);
typedef int (*conf_export_handler_ext_t)(conf_export_func_t export_func,
- conf_export_tgt_t tgt, void *arg);
+ conf_export_tgt_t tgt, void *arg);
/**
* Configuration handler, used to register a config item/subtree.
@@ -168,7 +168,7 @@
* 0=standard
* 1=extended
*/
- uint8_t ch_ext:1;
+ uint8_t ch_ext : 1;
/** Get configuration value */
union {
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2181: [RFC]
sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#issuecomment-585447213
<!-- style-bot -->
## Style check summary
#### No suggestions at this time!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2181:
[RFC] sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#issuecomment-583649110
<!-- style-bot -->
## Style check summary
#### No suggestions at this time!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] utzig commented on a change in pull request #2181:
[RFC] sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#discussion_r378362675
##########
File path: sys/config/include/config/config.h
##########
@@ -157,14 +162,40 @@ struct conf_handler {
* The name of the conifguration item/subtree
*/
char *ch_name;
+
+ /**
+ * Whether to use the extended callbacks.
+ * 0=standard
+ * 1=extended
+ */
+ uint8_t ch_ext : 1;
Review comment:
I think this should rather be `bool`, although it would not be a problem to use a bitfield in practice, unless someone wrote a configuration to flash and moved that flash to a CPU with different endiannes! :-P
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] ccollins476ad merged pull request #2181: sys/config:
Extended callbacks
Posted by GitBox <gi...@apache.org>.
ccollins476ad merged pull request #2181: sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2181:
[RFC] sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#issuecomment-583638565
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### sys/config/include/config/config.h
<details>
```diff
@@ -149,9 +149,9 @@
* @return 0 on success, non-zero error code on failure.
*/
typedef int (*conf_export_handler_t)(conf_export_func_t export_func,
- conf_export_tgt_t tgt);
+ conf_export_tgt_t tgt);
typedef int (*conf_export_handler_ext_t)(conf_export_func_t export_func,
- conf_export_tgt_t tgt, void *arg);
+ conf_export_tgt_t tgt, void *arg);
/**
* Configuration handler, used to register a config item/subtree.
@@ -168,7 +168,7 @@
* 0=standard
* 1=extended
*/
- uint8_t ch_ext:1;
+ uint8_t ch_ext : 1;
/** Get configuration value */
union {
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2181: [RFC]
sys/config: Extended callbacks
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2181: [RFC] sys/config: Extended callbacks
URL: https://github.com/apache/mynewt-core/pull/2181#issuecomment-583649110
<!-- style-bot -->
## Style check summary
#### No suggestions at this time!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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