This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git

commit 2f1953caea2d4ed18478540a4db1faf27ab85e45
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Fri Jan 26 15:46:06 2018 -0800

    Fix some misnamed identifiers.
---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 35 +++++++++++++-------------
 mgmt/include/mgmt/mgmt.h                       | 16 ++++++------
 mgmt/src/mgmt.c                                | 14 +++++------
 3 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index dc71d8f..e17952b 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -29,14 +29,14 @@
 #include "img_mgmt/img_mgmt.h"
 #include "../../../src/img_mgmt_priv.h"
 
-static struct device *zephyr_img_flash_dev;
-static struct flash_img_context zephyr_img_flash_ctxt;
+static struct device *zephyr_img_mgmt_flash_dev;
+static struct flash_img_context zephyr_img_mgmt_flash_ctxt;
 
 /**
  * Determines if the specified area of flash is completely unwritten.
  */
 static int
-img_mgmt_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
+zephyr_img_mgmt_flash_check_empty(off_t offset, size_t size, bool *out_empty)
 {
     uint32_t data[16];
     off_t addr;
@@ -55,7 +55,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
             bytes_to_read = sizeof data;
         }
 
-        rc = flash_read(zephyr_img_flash_dev, addr, data, bytes_to_read);
+        rc = flash_read(zephyr_img_mgmt_flash_dev, addr, data, bytes_to_read);
         if (rc != 0) {
             return MGMT_ERR_EUNKNOWN;
         }
@@ -76,7 +76,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
  * Converts an offset within an image slot to an absolute address.
  */
 static off_t
-img_mgmt_impl_abs_offset(int slot, off_t sub_offset)
+zephyr_img_mgmt_abs_offset(int slot, off_t sub_offset)
 {
     off_t slot_start;
 
@@ -104,9 +104,9 @@ img_mgmt_impl_erase_slot(void)
     bool empty;
     int rc;
 
-    rc = img_mgmt_impl_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
-                                         FLASH_AREA_IMAGE_1_SIZE,
-                                         &empty);
+    rc = zephyr_img_mgmt_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
+                                           FLASH_AREA_IMAGE_1_SIZE,
+                                           &empty);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
@@ -158,8 +158,8 @@ img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
     off_t abs_offset;
     int rc;
 
-    abs_offset = img_mgmt_impl_abs_offset(slot, offset);
-    rc = flash_read(zephyr_img_flash_dev, abs_offset, dst, num_bytes);
+    abs_offset = zephyr_img_mgmt_abs_offset(slot, offset);
+    rc = flash_read(zephyr_img_mgmt_flash_dev, abs_offset, dst, num_bytes);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
@@ -174,18 +174,19 @@ img_mgmt_impl_write_image_data(unsigned int offset, const 
void *data,
     int rc;
 
     if (offset == 0) {
-        flash_img_init(&zephyr_img_flash_ctxt, zephyr_img_flash_dev);
+        flash_img_init(&zephyr_img_mgmt_flash_ctxt, zephyr_img_mgmt_flash_dev);
     }
 
     /* Cast away const. */
-    rc = flash_img_buffered_write(&zephyr_img_flash_ctxt, (void *)data,
+    rc = flash_img_buffered_write(&zephyr_img_mgmt_flash_ctxt, (void *)data,
                                   num_bytes, false);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
 
     if (last) {
-        rc = flash_img_buffered_write(&zephyr_img_flash_ctxt, NULL, 0, true);
+        rc = flash_img_buffered_write(&zephyr_img_mgmt_flash_ctxt,
+                                      NULL, 0, true);
         if (rc != 0) {
             return MGMT_ERR_EUNKNOWN;
         }
@@ -213,15 +214,15 @@ img_mgmt_impl_swap_type(void)
 }
 
 static int
-img_mgmt_impl_init(struct device *dev)
+zephyr_img_mgmt_init(struct device *dev)
 {
     ARG_UNUSED(dev);
 
-    zephyr_img_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
-    if (zephyr_img_flash_dev == NULL) {
+    zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
+    if (zephyr_img_mgmt_flash_dev == NULL) {
         return -ENODEV;
     }
     return 0;
 }
 
-SYS_INIT(img_mgmt_impl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
+SYS_INIT(zephyr_img_mgmt_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
diff --git a/mgmt/include/mgmt/mgmt.h b/mgmt/include/mgmt/mgmt.h
index 549fcdc..2762aa8 100644
--- a/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/include/mgmt/mgmt.h
@@ -41,7 +41,7 @@ extern "C" {
 #define MGMT_GROUP_ID_IMAGE     1
 #define MGMT_GROUP_ID_STATS     2
 #define MGMT_GROUP_ID_CONFIG    3
-#define MGMT_GROUP_ID_LOGS      4
+#define MGMT_GROUP_ID_LOG       4
 #define MGMT_GROUP_ID_CRASH     5
 #define MGMT_GROUP_ID_SPLIT     6
 #define MGMT_GROUP_ID_RUN       7
@@ -203,12 +203,12 @@ struct mgmt_ctxt {
  *
  * A separate handler is required for each supported op-ID pair.
  *
- * @param cbuf                  The mcumgr context to use.
+ * @param ctxt                  The mcumgr context to use.
  *
  * @return                      0 if a response was successfully encoded,
- *                                 MGMT_ERR_[...] code on failure.
+ *                                  MGMT_ERR_[...] code on failure.
  */
-typedef int mgmt_handler_fn(struct mgmt_ctxt *cbuf);
+typedef int mgmt_handler_fn(struct mgmt_ctxt *ctxt);
 
 /**
  * @brief Read handler and write handler for a single command ID.
@@ -340,23 +340,23 @@ const struct mgmt_handler *mgmt_find_handler(uint16_t 
group_id,
 /**
  * @brief Encodes a response status into the specified management context.
  *
- * @param cbuf                  The management context to encode into.
+ * @param ctxt                  The management context to encode into.
  * @param status                The response status to write.
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int mgmt_write_rsp_status(struct mgmt_ctxt *cbuf, int status);
+int mgmt_write_rsp_status(struct mgmt_ctxt *ctxt, int status);
 
 /**
  * @brief Initializes a management context object with the specified streamer.
  *
- * @param cbuf                  The context object to initialize.
+ * @param ctxt                  The context object to initialize.
  * @param streamer              The streamer that will be used with the
  *                                  context.
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int mgmt_ctxt_init(struct mgmt_ctxt *cbuf, struct mgmt_streamer *streamer);
+int mgmt_ctxt_init(struct mgmt_ctxt *ctxt, struct mgmt_streamer *streamer);
 
 /**
  * @brief Converts a CBOR status code to a MGMT_ERR_[...] code.
diff --git a/mgmt/src/mgmt.c b/mgmt/src/mgmt.c
index ccea65a..c6318ce 100644
--- a/mgmt/src/mgmt.c
+++ b/mgmt/src/mgmt.c
@@ -112,16 +112,16 @@ mgmt_find_handler(uint16_t group_id, uint16_t command_id)
 }
 
 int
-mgmt_write_rsp_status(struct mgmt_ctxt *cbuf, int errcode)
+mgmt_write_rsp_status(struct mgmt_ctxt *ctxt, int errcode)
 {
     int rc;
 
-    rc = cbor_encode_text_stringz(&cbuf->encoder, "rc");
+    rc = cbor_encode_text_stringz(&ctxt->encoder, "rc");
     if (rc != 0) {
         return rc;
     }
 
-    rc = cbor_encode_int(&cbuf->encoder, errcode);
+    rc = cbor_encode_int(&ctxt->encoder, errcode);
     if (rc != 0) {
         return rc;
     }
@@ -140,17 +140,17 @@ mgmt_err_from_cbor(int cbor_status)
 }
 
 int
-mgmt_ctxt_init(struct mgmt_ctxt *cbuf, struct mgmt_streamer *streamer)
+mgmt_ctxt_init(struct mgmt_ctxt *ctxt, struct mgmt_streamer *streamer)
 {
     int rc;
 
-    rc = cbor_parser_cust_reader_init(streamer->reader, 0, &cbuf->parser,
-                                      &cbuf->it);
+    rc = cbor_parser_cust_reader_init(streamer->reader, 0, &ctxt->parser,
+                                      &ctxt->it);
     if (rc != CborNoError) {
         return mgmt_err_from_cbor(rc);
     }
 
-    cbor_encoder_cust_writer_init(&cbuf->encoder, streamer->writer, 0);
+    cbor_encoder_cust_writer_init(&ctxt->encoder, streamer->writer, 0);
 
     return 0;
 }

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.

Reply via email to