mgmt; expect function handler array to be const.
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/ab85825e Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ab85825e Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ab85825e Branch: refs/heads/develop Commit: ab85825ec6898bd17d745d83a26107693e4e0670 Parents: f4a08b4 Author: Marko Kiiskila <ma...@runtime.io> Authored: Wed Oct 5 19:21:18 2016 -0700 Committer: Marko Kiiskila <ma...@runtime.io> Committed: Wed Oct 5 19:21:18 2016 -0700 ---------------------------------------------------------------------- mgmt/mgmt/include/mgmt/mgmt.h | 7 +++++-- mgmt/mgmt/src/mgmt.c | 6 +++--- mgmt/newtmgr/src/newtmgr.c | 2 +- mgmt/oicmgr/src/oicmgr.c | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ab85825e/mgmt/mgmt/include/mgmt/mgmt.h ---------------------------------------------------------------------- diff --git a/mgmt/mgmt/include/mgmt/mgmt.h b/mgmt/mgmt/include/mgmt/mgmt.h index c83c61b..24bf2e7 100644 --- a/mgmt/mgmt/include/mgmt/mgmt.h +++ b/mgmt/mgmt/include/mgmt/mgmt.h @@ -75,7 +75,7 @@ struct mgmt_handler { }; struct mgmt_group { - struct mgmt_handler *mg_handlers; + const struct mgmt_handler *mg_handlers; uint16_t mg_handlers_count; uint16_t mg_group_id; STAILQ_ENTRY(mgmt_group) mg_next; @@ -86,9 +86,12 @@ struct mgmt_group { (__group)->mg_handlers_count = (sizeof((__handlers)) / \ sizeof(struct mgmt_handler)); +extern struct os_eventq *mgmt_evq; + int mgmt_group_register(struct mgmt_group *group); void mgmt_jbuf_setoerr(struct mgmt_jbuf *njb, int errcode); -struct mgmt_handler *mgmt_find_handler(uint16_t group_id, uint16_t handler_id); +const struct mgmt_handler *mgmt_find_handler(uint16_t group_id, + uint16_t handler_id); #ifdef __cplusplus } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ab85825e/mgmt/mgmt/src/mgmt.c ---------------------------------------------------------------------- diff --git a/mgmt/mgmt/src/mgmt.c b/mgmt/mgmt/src/mgmt.c index 5064fe3..aacf814 100644 --- a/mgmt/mgmt/src/mgmt.c +++ b/mgmt/mgmt/src/mgmt.c @@ -23,6 +23,7 @@ static struct os_mutex mgmt_group_lock; static STAILQ_HEAD(, mgmt_group) mgmt_group_list = STAILQ_HEAD_INITIALIZER(mgmt_group_list); +struct os_eventq *mgmt_evq; static int mgmt_group_list_lock(void) @@ -113,11 +114,11 @@ err: return (NULL); } -struct mgmt_handler * +const struct mgmt_handler * mgmt_find_handler(uint16_t group_id, uint16_t handler_id) { struct mgmt_group *group; - struct mgmt_handler *handler; + const struct mgmt_handler *handler; group = mgmt_find_group(group_id); if (!group) { @@ -145,4 +146,3 @@ mgmt_jbuf_setoerr(struct mgmt_jbuf *njb, int errcode) json_encode_object_entry(&njb->mjb_enc, "rc", &jv); json_encode_object_finish(&njb->mjb_enc); } - http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ab85825e/mgmt/newtmgr/src/newtmgr.c ---------------------------------------------------------------------- diff --git a/mgmt/newtmgr/src/newtmgr.c b/mgmt/newtmgr/src/newtmgr.c index 314b5e8..bb91c85 100644 --- a/mgmt/newtmgr/src/newtmgr.c +++ b/mgmt/newtmgr/src/newtmgr.c @@ -310,7 +310,7 @@ static void nmgr_handle_req(struct nmgr_transport *nt, struct os_mbuf *req) { struct os_mbuf *rsp; - struct mgmt_handler *handler; + const struct mgmt_handler *handler; struct nmgr_hdr *rsp_hdr; struct nmgr_hdr hdr; int off; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ab85825e/mgmt/oicmgr/src/oicmgr.c ---------------------------------------------------------------------- diff --git a/mgmt/oicmgr/src/oicmgr.c b/mgmt/oicmgr/src/oicmgr.c index 0f426ac..811e9fe 100644 --- a/mgmt/oicmgr/src/oicmgr.c +++ b/mgmt/oicmgr/src/oicmgr.c @@ -172,7 +172,7 @@ omgr_jbuf_setobuf(struct omgr_jbuf *ob, char *ptr, uint16_t maxlen) ob->ob_mj.mjb_enc.je_wr_commas = 0; } -static struct mgmt_handler * +static const struct mgmt_handler * omgr_oic_find_handler(const char *q, int qlen) { char id_str[8]; @@ -207,7 +207,7 @@ static void omgr_oic_op(oc_request_t *req, oc_interface_mask_t mask, int isset) { struct omgr_state *o = &omgr_state; - struct mgmt_handler *handler; + const struct mgmt_handler *handler; oc_rep_t *data; int rc;