You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/01/05 20:43:41 UTC

[mynewt-mcumgr] 04/05: Change `img` prefix to `img_mgmt`

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 a7c35650621dc51635acd159ed057c270af24243
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Jan 4 17:32:03 2018 -0800

    Change `img` prefix to `img_mgmt`
---
 cmd/img/include/img/img.h                          |  77 -----------
 .../img => img_mgmt/include/img_mgmt}/image.h      |   3 +
 cmd/img_mgmt/include/img_mgmt/img_mgmt.h           |  69 ++++++++++
 .../include/img_mgmt/img_mgmt_impl.h}              |  22 ++--
 cmd/{img => img_mgmt}/pkg.yml                      |   0
 cmd/{img => img_mgmt}/port/mynewt/pkg.yml          |   2 +-
 .../port/mynewt/src/mynewt_img_mgmt.c}             |  30 ++---
 .../port/zephyr/src/zephyr_img_mgmt.c}             |  46 +++----
 cmd/{img/src/img.c => img_mgmt/src/img_mgmt.c}     | 142 ++++++++++-----------
 .../img_priv.h => img_mgmt/src/img_mgmt_priv.h}    |  32 +----
 .../img_state.c => img_mgmt/src/img_mgmt_state.c}  | 102 +++++++--------
 .../img_util.c => img_mgmt/src/img_mgmt_util.c}    |  59 +--------
 cmd/{img => img_mgmt}/syscfg.yml                   |   0
 13 files changed, 254 insertions(+), 330 deletions(-)

diff --git a/cmd/img/include/img/img.h b/cmd/img/include/img/img.h
deleted file mode 100644
index fa5a3cb..0000000
--- a/cmd/img/include/img/img.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_IMG_
-#define H_IMG_
-
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define IMG_NMGR_ID_STATE       0
-#define IMG_NMGR_ID_UPLOAD      1
-#define IMG_NMGR_ID_FILE        2
-#define IMG_NMGR_ID_CORELIST    3
-#define IMG_NMGR_ID_CORELOAD    4
-#define IMG_NMGR_ID_ERASE	    5
-
-#define IMG_NMGR_MAX_NAME	    64
-#define IMG_NMGR_MAX_VER        25  /* 255.255.65535.4294967295\0 */
-
-#define IMG_HASH_LEN            32
-
-#define IMG_STATE_F_PENDING     0x01
-#define IMG_STATE_F_CONFIRMED   0x02
-#define IMG_STATE_F_ACTIVE      0x04
-#define IMG_STATE_F_PERMANENT   0x08
-
-#define IMG_SWAP_TYPE_NONE      0
-#define IMG_SWAP_TYPE_TEST      1
-#define IMG_SWAP_TYPE_PERM      2
-#define IMG_SWAP_TYPE_REVERT    3
-
-struct image_version;
-
-/*
- * Take version and convert it to string in dst.
- */
-int img_ver_str(const struct image_version *ver, char *dst);
-
-/*
- * Given flash_map slot id, read in image_version and/or image hash.
- */
-int img_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
-                  uint32_t *flags);
-
-/*
- * Returns version number of current image (if available).
- */
-int img_my_version(struct image_version *ver);
-
-uint8_t img_state_flags(int query_slot);
-int img_state_slot_in_use(int slot);
-int img_group_register(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_IMG_ */
diff --git a/cmd/img/include/img/image.h b/cmd/img_mgmt/include/img_mgmt/image.h
similarity index 96%
rename from cmd/img/include/img/image.h
rename to cmd/img_mgmt/include/img_mgmt/image.h
index 53c6215..63bb7fe 100644
--- a/cmd/img/include/img/image.h
+++ b/cmd/img_mgmt/include/img_mgmt/image.h
@@ -41,6 +41,9 @@ extern "C" {
  */
 #define IMAGE_TLV_SHA256            0x10   /* SHA256 of image hdr and body */
 
+/** Image TLV-specific definitions. */
+#define IMAGE_HASH_LEN              32
+
 struct image_version {
     uint8_t iv_major;
     uint8_t iv_minor;
diff --git a/cmd/img_mgmt/include/img_mgmt/img_mgmt.h b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h
new file mode 100644
index 0000000..1a7da19
--- /dev/null
+++ b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_IMG_MGMT_
+#define H_IMG_MGMT_
+
+#include <inttypes.h>
+struct image_version;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IMG_MGMT_ID_STATE           0
+#define IMG_MGMT_ID_UPLOAD          1
+#define IMG_MGMT_ID_FILE            2
+#define IMG_MGMT_ID_CORELIST        3
+#define IMG_MGMT_ID_CORELOAD        4
+#define IMG_MGMT_ID_ERASE           5
+
+#define IMG_MGMT_MAX_NAME           64
+#define IMG_MGMT_MAX_VER            25  /* 255.255.65535.4294967295\0 */
+
+#define IMG_MGMT_STATE_F_PENDING    0x01
+#define IMG_MGMT_STATE_F_CONFIRMED  0x02
+#define IMG_MGMT_STATE_F_ACTIVE     0x04
+#define IMG_MGMT_STATE_F_PERMANENT  0x08
+
+#define IMG_MGMT_SWAP_TYPE_NONE     0
+#define IMG_MGMT_SWAP_TYPE_TEST     1
+#define IMG_MGMT_SWAP_TYPE_PERM     2
+#define IMG_MGMT_SWAP_TYPE_REVERT   3
+
+/**
+ * Take version and convert it to string in dst.
+ */
+int img_mgmt_ver_str(const struct image_version *ver, char *dst);
+
+/**
+ * Given flash_map slot id, read in image_version and/or image hash.
+ */
+int img_mgmt_read_info(int image_slot, struct image_version *ver,
+                       uint8_t *hash, uint32_t *flags);
+
+uint8_t img_mgmt_state_flags(int query_slot);
+int img_mgmt_slot_in_use(int slot);
+int img_mgmt_group_register(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_IMG_MGMT_ */
diff --git a/cmd/img/include/img/img_impl.h b/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
similarity index 81%
rename from cmd/img/include/img/img_impl.h
rename to cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
index ce19838..b6b81b0 100644
--- a/cmd/img/include/img/img_impl.h
+++ b/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
@@ -1,5 +1,5 @@
-#ifndef H_IMG_IMPL_
-#define H_IMG_IMPL_
+#ifndef H_IMG_MGMT_IMPL_
+#define H_IMG_MGMT_IMPL_
 
 /* This file declares implementation-specific functions required by image
  * management.  Each function must be defined in a way that is compatible with
@@ -11,7 +11,7 @@
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int img_impl_erase_slot(void);
+int img_mgmt_impl_erase_slot(void);
 
 /**
  * @brief Marks the image in the specified slot as pending. On the next reboot,
@@ -27,7 +27,7 @@ int img_impl_erase_slot(void);
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int img_impl_write_pending(int slot, bool permanent);
+int img_mgmt_impl_write_pending(int slot, bool permanent);
 
 /**
  * @brief Marks the image in slot 0 as confirmed. The system will continue
@@ -35,7 +35,7 @@ int img_impl_write_pending(int slot, bool permanent);
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int img_impl_write_confirmed(void);
+int img_mgmt_impl_write_confirmed(void);
 
 /**
  * @brief Reads the specified chunk of data from an image slot.
@@ -47,8 +47,8 @@ int img_impl_write_confirmed(void);
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int img_impl_read(int slot, unsigned int offset, void *dst,
-                  unsigned int num_bytes);
+int img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
+                       unsigned int num_bytes);
 
 /**
  * @brief Writes the specified chunk of image data to slot 1.
@@ -64,15 +64,15 @@ int img_impl_read(int slot, unsigned int offset, void *dst,
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int img_impl_write_image_data(unsigned int offset, const void *data,
-                              unsigned int num_bytes, bool last);
+int img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
+                                   unsigned int num_bytes, bool last);
 
 /**
  * @brief Indicates the type of swap operation that will occur on the next
  * reboot, if any.
  *
- * @return                      An IMG_SWAP_TYPE_[...] code.
+ * @return                      An IMG_MGMT_SWAP_TYPE_[...] code.
  */
-int img_impl_swap_type(void);
+int img_mgmt_impl_swap_type(void);
 
 #endif
diff --git a/cmd/img/pkg.yml b/cmd/img_mgmt/pkg.yml
similarity index 100%
rename from cmd/img/pkg.yml
rename to cmd/img_mgmt/pkg.yml
diff --git a/cmd/img/port/mynewt/pkg.yml b/cmd/img_mgmt/port/mynewt/pkg.yml
similarity index 96%
rename from cmd/img/port/mynewt/pkg.yml
rename to cmd/img_mgmt/port/mynewt/pkg.yml
index 0e5ec11..f2a358e 100644
--- a/cmd/img/port/mynewt/pkg.yml
+++ b/cmd/img_mgmt/port/mynewt/pkg.yml
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-pkg.name: cmd/img/port/mynewt
+pkg.name: cmd/img_mgmt/port/mynewt
 pkg.description: XXX
 pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
 pkg.homepage: "http://mynewt.apache.org/"
diff --git a/cmd/img/port/mynewt/src/mynewt_img.c b/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
similarity index 84%
rename from cmd/img/port/mynewt/src/mynewt_img.c
rename to cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
index 28d39f3..1ae7950 100644
--- a/cmd/img/port/mynewt/src/mynewt_img.c
+++ b/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
@@ -1,7 +1,7 @@
 #include "sysinit/sysinit.h"
 
 int
-img_impl_erase_slot(void)
+img_mgmt_impl_erase_slot(void)
 {
     const struct flash_area *fa;
     bool empty;
@@ -28,7 +28,7 @@ img_impl_erase_slot(void)
 }
 
 int
-img_impl_write_pending(int slot, bool permanent)
+img_mgmt_impl_write_pending(int slot, bool permanent)
 {
     uint32_t image_flags;
     uint8_t state_flags;
@@ -87,7 +87,7 @@ img_impl_write_pending(int slot, bool permanent)
 }
 
 int
-img_impl_write_confirmed(void)
+img_mgmt_impl_write_confirmed(void)
 {
     /* Confirm the unified image or loader in slot 0. */
     rc = boot_set_confirmed();
@@ -112,8 +112,8 @@ img_impl_write_confirmed(void)
 }
 
 int
-img_impl_read(int slot, unsigned int offset, void *dst,
-              unsigned int num_bytes)
+img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
+                   unsigned int num_bytes)
 {
     const struct flash_area *fa;
     int area_id;
@@ -135,8 +135,8 @@ img_impl_read(int slot, unsigned int offset, void *dst,
 }
 
 int
-img_impl_write_image_data(unsigned int offset, const void *data,
-                          unsigned int num_bytes, bool last)
+img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
+                               unsigned int num_bytes, bool last)
 {
     const struct flash_area *fa;
     int rc;
@@ -156,32 +156,32 @@ img_impl_write_image_data(unsigned int offset, const void *data,
 }
 
 int
-img_impl_swap_type(void)
+img_mgmt_impl_swap_type(void)
 {
     switch (boot_swap_type()) {
     case BOOT_SWAP_TYPE_NONE:
-        return IMG_SWAP_TYPE_NONE;
+        return IMG_MGMT_SWAP_TYPE_NONE;
     case BOOT_SWAP_TYPE_TEST:
-        return IMG_SWAP_TYPE_TEST;
+        return IMG_MGMT_SWAP_TYPE_TEST;
     case BOOT_SWAP_TYPE_PERM:
-        return IMG_SWAP_TYPE_PERM;
+        return IMG_MGMT_SWAP_TYPE_PERM;
     case BOOT_SWAP_TYPE_REVERT:
-        return IMG_SWAP_TYPE_REVERT;
+        return IMG_MGMT_SWAP_TYPE_REVERT;
     default:
         assert(0);
-        return IMG_SWAP_TYPE_NONE;
+        return IMG_MGMT_SWAP_TYPE_NONE;
     }
 }
 
 void
-img_module_init(void)
+img_mgmt_module_init(void)
 {
     int rc;
 
     /* Ensure this function only gets called by sysinit. */
     SYSINIT_ASSERT_ACTIVE();
 
-    rc = img_group_register();
+    rc = img_mgmt_group_register();
     SYSINIT_PANIC_ASSERT(rc == 0);
 
 #if MYNEWT_VAL(IMGMGR_CLI)
diff --git a/cmd/img/port/zephyr/src/zephyr_img.c b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
similarity index 72%
rename from cmd/img/port/zephyr/src/zephyr_img.c
rename to cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index 2bee3e1..0a3ed5a 100644
--- a/cmd/img/port/zephyr/src/zephyr_img.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -6,14 +6,14 @@
 #include <dfu/mcuboot.h>
 #include <dfu/flash_img.h>
 #include "mgmt/mgmt.h"
-#include "img/img_impl.h"
-#include "img/img.h"
+#include "img_mgmt/img_mgmt_impl.h"
+#include "img_mgmt/img_mgmt.h"
 
 static struct device *zephyr_img_flash_dev;
 static struct flash_img_context zephyr_img_flash_ctxt;
 
 static int
-img_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
+img_mgmt_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
 {
     uint32_t data[16];
     off_t addr;
@@ -50,7 +50,7 @@ img_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
 }
 
 static off_t
-img_impl_abs_offset(int slot, off_t sub_offset)
+img_mgmt_impl_abs_offset(int slot, off_t sub_offset)
 {
     off_t slot_start;
 
@@ -73,14 +73,14 @@ img_impl_abs_offset(int slot, off_t sub_offset)
 }
 
 int
-img_impl_erase_slot(void)
+img_mgmt_impl_erase_slot(void)
 {
     bool empty;
     int rc;
 
-    rc = img_impl_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
-                                    FLASH_AREA_IMAGE_1_SIZE,
-                                    &empty);
+    rc = img_mgmt_impl_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
+                                         FLASH_AREA_IMAGE_1_SIZE,
+                                         &empty);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
@@ -96,7 +96,7 @@ img_impl_erase_slot(void)
 }
 
 int
-img_impl_write_pending(int slot, bool permanent)
+img_mgmt_impl_write_pending(int slot, bool permanent)
 {
     int rc;
 
@@ -113,7 +113,7 @@ img_impl_write_pending(int slot, bool permanent)
 }
 
 int
-img_impl_write_confirmed(void)
+img_mgmt_impl_write_confirmed(void)
 {
     int rc;
 
@@ -126,13 +126,13 @@ img_impl_write_confirmed(void)
 }
 
 int
-img_impl_read(int slot, unsigned int offset, void *dst,
-              unsigned int num_bytes)
+img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
+                   unsigned int num_bytes)
 {
     off_t abs_offset;
     int rc;
 
-    abs_offset = img_impl_abs_offset(slot, offset);
+    abs_offset = img_mgmt_impl_abs_offset(slot, offset);
     rc = flash_read(zephyr_img_flash_dev, abs_offset, dst, num_bytes);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
@@ -142,8 +142,8 @@ img_impl_read(int slot, unsigned int offset, void *dst,
 }
 
 int
-img_impl_write_image_data(unsigned int offset, const void *data,
-                          unsigned int num_bytes, bool last)
+img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
+                               unsigned int num_bytes, bool last)
 {
     int rc;
 
@@ -169,25 +169,25 @@ img_impl_write_image_data(unsigned int offset, const void *data,
 }
 
 int
-img_impl_swap_type(void)
+img_mgmt_impl_swap_type(void)
 {
     switch (boot_swap_type()) {
     case BOOT_SWAP_TYPE_NONE:
-        return IMG_SWAP_TYPE_NONE;
+        return IMG_MGMT_SWAP_TYPE_NONE;
     case BOOT_SWAP_TYPE_TEST:
-        return IMG_SWAP_TYPE_TEST;
+        return IMG_MGMT_SWAP_TYPE_TEST;
     case BOOT_SWAP_TYPE_PERM:
-        return IMG_SWAP_TYPE_PERM;
+        return IMG_MGMT_SWAP_TYPE_PERM;
     case BOOT_SWAP_TYPE_REVERT:
-        return IMG_SWAP_TYPE_REVERT;
+        return IMG_MGMT_SWAP_TYPE_REVERT;
     default:
         assert(0);
-        return IMG_SWAP_TYPE_NONE;
+        return IMG_MGMT_SWAP_TYPE_NONE;
     }
 }
 
 static int
-img_impl_init(struct device *dev)
+img_mgmt_impl_init(struct device *dev)
 {
     ARG_UNUSED(dev);
 
@@ -198,4 +198,4 @@ img_impl_init(struct device *dev)
     return 0;
 }
 
-SYS_INIT(img_impl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
+SYS_INIT(img_mgmt_impl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
diff --git a/cmd/img/src/img.c b/cmd/img_mgmt/src/img_mgmt.c
similarity index 64%
rename from cmd/img/src/img.c
rename to cmd/img_mgmt/src/img_mgmt.c
index 9a2019c..970030e 100644
--- a/cmd/img/src/img.c
+++ b/cmd/img_mgmt/src/img_mgmt.c
@@ -24,43 +24,43 @@
 #include "cborattr/cborattr.h"
 #include "mgmt/mgmt.h"
 
-#include "img/img.h"
-#include "img/image.h"
-#include "img/img_impl.h"
-#include "img_priv.h"
+#include "img_mgmt/image.h"
+#include "img_mgmt/img_mgmt.h"
+#include "img_mgmt/img_mgmt_impl.h"
+#include "img_mgmt_priv.h"
 
-#define IMG_MAX_CHUNK_SIZE 512
+#define IMG_MGMT_MAX_CHUNK_SIZE 512
 
-static int img_upload(struct mgmt_cbuf *);
-static int img_erase(struct mgmt_cbuf *);
+static mgmt_handler_fn img_mgmt_upload;
+static mgmt_handler_fn img_mgmt_erase;
 
-static const struct mgmt_handler img_nmgr_handlers[] = {
-    [IMG_NMGR_ID_STATE] = {
-        .mh_read = img_state_read,
-        .mh_write = img_state_write,
+static const struct mgmt_handler img_mgmt_handlers[] = {
+    [IMG_MGMT_ID_STATE] = {
+        .mh_read = img_mgmt_state_read,
+        .mh_write = img_mgmt_state_write,
     },
-    [IMG_NMGR_ID_UPLOAD] = {
+    [IMG_MGMT_ID_UPLOAD] = {
         .mh_read = NULL,
-        .mh_write = img_upload
+        .mh_write = img_mgmt_upload
     },
-    [IMG_NMGR_ID_ERASE] = {
+    [IMG_MGMT_ID_ERASE] = {
         .mh_read = NULL,
-        .mh_write = img_erase
+        .mh_write = img_mgmt_erase
     },
 #if 0
-    [IMG_NMGR_ID_CORELIST] = {
-#if MYNEWT_VAL(IMG_COREDUMP)
-        .mh_read = img_core_list,
+    [IMG_MGMT_ID_CORELIST] = {
+#if MYNEWT_VAL(IMG_MGMT_COREDUMP)
+        .mh_read = img_mgmt_core_list,
         .mh_write = NULL
 #else
         .mh_read = NULL,
         .mh_write = NULL
 #endif
     },
-    [IMG_NMGR_ID_CORELOAD] = {
-#if MYNEWT_VAL(IMG_COREDUMP)
-        .mh_read = img_core_load,
-        .mh_write = img_core_erase,
+    [IMG_MGMT_ID_CORELOAD] = {
+#if MYNEWT_VAL(IMG_MGMT_COREDUMP)
+        .mh_read = img_mgmt_core_load,
+        .mh_write = img_mgmt_core_erase,
 #else
         .mh_read = NULL,
         .mh_write = NULL
@@ -69,12 +69,12 @@ static const struct mgmt_handler img_nmgr_handlers[] = {
 #endif
 };
 
-#define IMG_HANDLER_CNT                                                \
-    sizeof(img_nmgr_handlers) / sizeof(img_nmgr_handlers[0])
+#define IMG_MGMT_HANDLER_CNT                                    \
+    sizeof(img_mgmt_handlers) / sizeof(img_mgmt_handlers[0])
 
-static struct mgmt_group img_nmgr_group = {
-    .mg_handlers = (struct mgmt_handler *)img_nmgr_handlers,
-    .mg_handlers_count = IMG_HANDLER_CNT,
+static struct mgmt_group img_mgmt_group = {
+    .mg_handlers = (struct mgmt_handler *)img_mgmt_handlers,
+    .mg_handlers_count = IMG_MGMT_HANDLER_CNT,
     .mg_group_id = MGMT_GROUP_ID_IMAGE,
 };
 
@@ -82,16 +82,16 @@ static struct {
     off_t off;
     size_t image_len;
     bool uploading;
-} img_ctxt;
+} img_mgmt_ctxt;
 
 static int
-img_img_tlvs(const struct image_header *hdr,
-             int slot, off_t *start_off, off_t *end_off)
+img_mgmt_tlvs(const struct image_header *hdr,
+              int slot, off_t *start_off, off_t *end_off)
 {
     struct image_tlv_info tlv_info;
     int rc;
 
-    rc = img_impl_read(slot, *start_off, &tlv_info, sizeof tlv_info);
+    rc = img_mgmt_impl_read(slot, *start_off, &tlv_info, sizeof tlv_info);
     if (rc != 0) {
         return -1;
     }
@@ -122,8 +122,8 @@ img_img_tlvs(const struct image_header *hdr,
  * XXX Define return code macros.
  */
 int
-img_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
-              uint32_t *flags)
+img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
+                   uint32_t *flags)
 {
     struct image_header hdr;
     struct image_tlv tlv;
@@ -131,7 +131,7 @@ img_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
     uint32_t data_end;
     int rc;
 
-    rc = img_impl_read(image_slot, 0, &hdr, sizeof hdr);
+    rc = img_mgmt_impl_read(image_slot, 0, &hdr, sizeof hdr);
     if (rc != 0) {
         return -1;
     }
@@ -155,29 +155,29 @@ img_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
 
     /* The hash is contained in a TLV after the image. */
     data_off = hdr.ih_hdr_size + hdr.ih_img_size;
-    rc = img_img_tlvs(&hdr, image_slot, &data_off, &data_end);
+    rc = img_mgmt_tlvs(&hdr, image_slot, &data_off, &data_end);
     if (rc != 0) {
         return rc;
     }
 
     while (data_off + sizeof tlv <= data_end) {
-        rc = img_impl_read(image_slot, data_off, &tlv, sizeof tlv);
+        rc = img_mgmt_impl_read(image_slot, data_off, &tlv, sizeof tlv);
         if (rc != 0) {
             return 0;
         }
         if (tlv.it_type == 0xff && tlv.it_len == 0xffff) {
             return 1;
         }
-        if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMG_HASH_LEN) {
+        if (tlv.it_type != IMAGE_TLV_SHA256 || tlv.it_len != IMAGE_HASH_LEN) {
             data_off += sizeof tlv + tlv.it_len;
             continue;
         }
         data_off += sizeof tlv;
         if (hash != NULL) {
-            if (data_off + IMG_HASH_LEN > data_end) {
+            if (data_off + IMAGE_HASH_LEN > data_end) {
                 return 0;
             }
-            rc = img_impl_read(image_slot, data_off, hash, IMG_HASH_LEN);
+            rc = img_mgmt_impl_read(image_slot, data_off, hash, IMAGE_HASH_LEN);
             if (rc != 0) {
                 return 0;
             }
@@ -193,13 +193,13 @@ img_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
  * or -1 if not found.
  */
 int
-img_find_by_ver(struct image_version *find, uint8_t *hash)
+img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash)
 {
     int i;
     struct image_version ver;
 
     for (i = 0; i < 2; i++) {
-        if (img_read_info(i, &ver, hash, NULL) != 0) {
+        if (img_mgmt_read_info(i, &ver, hash, NULL) != 0) {
             continue;
         }
         if (!memcmp(find, &ver, sizeof(ver))) {
@@ -214,16 +214,16 @@ img_find_by_ver(struct image_version *find, uint8_t *hash)
  * or -1 if not found.
  */
 int
-img_find_by_hash(uint8_t *find, struct image_version *ver)
+img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver)
 {
     int i;
-    uint8_t hash[IMG_HASH_LEN];
+    uint8_t hash[IMAGE_HASH_LEN];
 
     for (i = 0; i < 2; i++) {
-        if (img_read_info(i, ver, hash, NULL) != 0) {
+        if (img_mgmt_read_info(i, ver, hash, NULL) != 0) {
             continue;
         }
-        if (!memcmp(hash, find, IMG_HASH_LEN)) {
+        if (!memcmp(hash, find, IMAGE_HASH_LEN)) {
             return i;
         }
     }
@@ -231,12 +231,12 @@ img_find_by_hash(uint8_t *find, struct image_version *ver)
 }
 
 static int
-img_erase(struct mgmt_cbuf *cb)
+img_mgmt_erase(struct mgmt_cbuf *cb)
 {
     CborError err;
     int rc;
 
-    rc = img_impl_erase_slot();
+    rc = img_mgmt_impl_erase_slot();
 
     err = 0;
     err |= cbor_encode_text_stringz(&cb->encoder, "rc");
@@ -250,7 +250,7 @@ img_erase(struct mgmt_cbuf *cb)
 }
 
 static int
-img_write_upload_rsp(struct mgmt_cbuf *cb, int status)
+img_mgmt_write_upload_rsp(struct mgmt_cbuf *cb, int status)
 {
     CborError err;
 
@@ -258,7 +258,7 @@ img_write_upload_rsp(struct mgmt_cbuf *cb, int status)
     err |= cbor_encode_text_stringz(&cb->encoder, "rc");
     err |= cbor_encode_int(&cb->encoder, status);
     err |= cbor_encode_text_stringz(&cb->encoder, "off");
-    err |= cbor_encode_int(&cb->encoder, img_ctxt.off);
+    err |= cbor_encode_int(&cb->encoder, img_mgmt_ctxt.off);
 
     if (err != 0) {
         return MGMT_ERR_ENOMEM;
@@ -268,7 +268,7 @@ img_write_upload_rsp(struct mgmt_cbuf *cb, int status)
 
 /* XXX: Rename */
 static int
-img_upload_first(struct mgmt_cbuf *cb, const uint8_t *req_data, size_t len)
+img_mgmt_upload_first(struct mgmt_cbuf *cb, const uint8_t *req_data, size_t len)
 {
     struct image_header hdr;
     int rc;
@@ -282,29 +282,29 @@ img_upload_first(struct mgmt_cbuf *cb, const uint8_t *req_data, size_t len)
         return MGMT_ERR_EINVAL;
     }
 
-    if (img_state_slot_in_use(1)) {
+    if (img_mgmt_slot_in_use(1)) {
         /* No free slot. */
         return MGMT_ERR_ENOMEM;
     }
 
-    rc = img_impl_erase_slot();
+    rc = img_mgmt_impl_erase_slot();
     if (rc != 0) {
         return rc;
     }
 
-    img_ctxt.uploading = true;
-    img_ctxt.off = 0;
-    img_ctxt.image_len = 0;
+    img_mgmt_ctxt.uploading = true;
+    img_mgmt_ctxt.off = 0;
+    img_mgmt_ctxt.image_len = 0;
 
     return 0;
 }
 
 static int
-img_upload(struct mgmt_cbuf *cb)
+img_mgmt_upload(struct mgmt_cbuf *cb)
 {
     long long unsigned int off = UINT_MAX;
     long long unsigned int size = UINT_MAX;
-    uint8_t img_data[IMG_MAX_CHUNK_SIZE];
+    uint8_t img_mgmt_data[IMG_MGMT_MAX_CHUNK_SIZE];
     size_t data_len = 0;
     bool last;
     int rc;
@@ -313,9 +313,9 @@ img_upload(struct mgmt_cbuf *cb)
         [0] = {
             .attribute = "data",
             .type = CborAttrByteStringType,
-            .addr.bytestring.data = img_data,
+            .addr.bytestring.data = img_mgmt_data,
             .addr.bytestring.len = &data_len,
-            .len = sizeof(img_data)
+            .len = sizeof(img_mgmt_data)
         },
         [1] = {
             .attribute = "len",
@@ -338,42 +338,42 @@ img_upload(struct mgmt_cbuf *cb)
     }
 
     if (off == 0) {
-        rc = img_upload_first(cb, img_data, data_len);
+        rc = img_mgmt_upload_first(cb, img_mgmt_data, data_len);
         if (rc != 0) {
             return rc;
         }
-        img_ctxt.image_len = size;
+        img_mgmt_ctxt.image_len = size;
     } else {
-        if (!img_ctxt.uploading) {
+        if (!img_mgmt_ctxt.uploading) {
             return MGMT_ERR_EINVAL;
         }
 
-        if (off != img_ctxt.off) {
+        if (off != img_mgmt_ctxt.off) {
             /* Invalid offset. Drop the data, and respond with the offset we're
              * expecting data for.
              */
-            return img_write_upload_rsp(cb, 0);
+            return img_mgmt_write_upload_rsp(cb, 0);
         }
     }
 
     if (data_len > 0) {
-        last = img_ctxt.off + data_len == img_ctxt.image_len;
-        rc = img_impl_write_image_data(off, img_data, data_len, last);
+        last = img_mgmt_ctxt.off + data_len == img_mgmt_ctxt.image_len;
+        rc = img_mgmt_impl_write_image_data(off, img_mgmt_data, data_len, last);
         if (rc != 0) {
             return rc;
         }
 
-        img_ctxt.off += data_len;
+        img_mgmt_ctxt.off += data_len;
         if (last) {
-            img_ctxt.uploading = false;
+            img_mgmt_ctxt.uploading = false;
         }
     }
 
-    return img_write_upload_rsp(cb, 0);
+    return img_mgmt_write_upload_rsp(cb, 0);
 }
 
 int
-img_group_register(void)
+img_mgmt_group_register(void)
 {
-    return mgmt_group_register(&img_nmgr_group);
+    return mgmt_group_register(&img_mgmt_group);
 }
diff --git a/cmd/img/src/img_priv.h b/cmd/img_mgmt/src/img_mgmt_priv.h
similarity index 72%
rename from cmd/img/src/img_priv.h
rename to cmd/img_mgmt/src/img_mgmt_priv.h
index 8140856..f763b56 100644
--- a/cmd/img/src/img_priv.h
+++ b/cmd/img_mgmt/src/img_mgmt_priv.h
@@ -26,18 +26,6 @@
 extern "C" {
 #endif
 
-#define IMG_MAX_IMGS		2
-
-#define IMG_HASH_STR		48
-
-/*
- * When accompanied by image, it's this structure followed by data.
- * Response contains just the offset.
- */
-struct img_upload_cmd {
-    uint32_t iuc_off;
-};
-
 /*
  * Response to list:
  * {
@@ -82,21 +70,15 @@ struct img_upload_cmd {
  * }
  */
 
-struct nmgr_hdr;
-struct os_mbuf;
-struct fs_file;
 struct mgmt_cbuf;
 
-struct nmgr_jbuf;
-
-int img_core_list(struct mgmt_cbuf *);
-int img_core_load(struct mgmt_cbuf *);
-int img_core_erase(struct mgmt_cbuf *);
-int img_state_read(struct mgmt_cbuf *cb);
-int img_state_write(struct mgmt_cbuf *njb);
-int img_find_by_ver(struct image_version *find, uint8_t *hash);
-int img_find_by_hash(uint8_t *find, struct image_version *ver);
-int img_cli_register(void);
+int img_mgmt_core_list(struct mgmt_cbuf *);
+int img_mgmt_core_load(struct mgmt_cbuf *);
+int img_mgmt_core_erase(struct mgmt_cbuf *);
+int img_mgmt_state_read(struct mgmt_cbuf *cb);
+int img_mgmt_state_write(struct mgmt_cbuf *njb);
+int img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash);
+int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver);
 
 #ifdef __cplusplus
 }
diff --git a/cmd/img/src/img_state.c b/cmd/img_mgmt/src/img_mgmt_state.c
similarity index 68%
rename from cmd/img/src/img_state.c
rename to cmd/img_mgmt/src/img_mgmt_state.c
index 84b797f..91be314 100644
--- a/cmd/img/src/img_state.c
+++ b/cmd/img_mgmt/src/img_mgmt_state.c
@@ -24,13 +24,13 @@
 #include "cborattr/cborattr.h"
 #include "cbor.h"
 #include "mgmt/mgmt.h"
-#include "img/img.h"
-#include "img/image.h"
-#include "img_priv.h"
-#include "img/img_impl.h"
+#include "img_mgmt/img_mgmt.h"
+#include "img_mgmt/image.h"
+#include "img_mgmt_priv.h"
+#include "img_mgmt/img_mgmt_impl.h"
 
 uint8_t
-img_state_flags(int query_slot)
+img_mgmt_state_flags(int query_slot)
 {
     uint8_t flags;
     int swap_type;
@@ -42,36 +42,36 @@ img_state_flags(int query_slot)
     /* Determine if this is is pending or confirmed (only applicable for
      * unified images and loaders.
      */
-    swap_type = img_impl_swap_type();
+    swap_type = img_mgmt_impl_swap_type();
     switch (swap_type) {
-    case IMG_SWAP_TYPE_NONE:
+    case IMG_MGMT_SWAP_TYPE_NONE:
         if (query_slot == 0) {
-            flags |= IMG_STATE_F_CONFIRMED;
-            flags |= IMG_STATE_F_ACTIVE;
+            flags |= IMG_MGMT_STATE_F_CONFIRMED;
+            flags |= IMG_MGMT_STATE_F_ACTIVE;
         }
         break;
 
-    case IMG_SWAP_TYPE_TEST:
+    case IMG_MGMT_SWAP_TYPE_TEST:
         if (query_slot == 0) {
-            flags |= IMG_STATE_F_CONFIRMED;
+            flags |= IMG_MGMT_STATE_F_CONFIRMED;
         } else if (query_slot == 1) {
-            flags |= IMG_STATE_F_PENDING;
+            flags |= IMG_MGMT_STATE_F_PENDING;
         }
         break;
 
-    case IMG_SWAP_TYPE_PERM:
+    case IMG_MGMT_SWAP_TYPE_PERM:
         if (query_slot == 0) {
-            flags |= IMG_STATE_F_CONFIRMED;
+            flags |= IMG_MGMT_STATE_F_CONFIRMED;
         } else if (query_slot == 1) {
-            flags |= IMG_STATE_F_PENDING | IMG_STATE_F_PERMANENT;
+            flags |= IMG_MGMT_STATE_F_PENDING | IMG_MGMT_STATE_F_PERMANENT;
         }
         break;
 
-    case IMG_SWAP_TYPE_REVERT:
+    case IMG_MGMT_SWAP_TYPE_REVERT:
         if (query_slot == 0) {
-            flags |= IMG_STATE_F_ACTIVE;
+            flags |= IMG_MGMT_STATE_F_ACTIVE;
         } else if (query_slot == 1) {
-            flags |= IMG_STATE_F_CONFIRMED;
+            flags |= IMG_MGMT_STATE_F_CONFIRMED;
         }
         break;
     }
@@ -79,46 +79,46 @@ img_state_flags(int query_slot)
     /* Slot 0 is always active. */
     /* XXX: The slot 0 assumption only holds when running from flash. */
     if (query_slot == 0) {
-        flags |= IMG_STATE_F_ACTIVE;
+        flags |= IMG_MGMT_STATE_F_ACTIVE;
     }
 
     return flags;
 }
 
 static int
-img_state_any_pending(void)
+img_mgmt_state_any_pending(void)
 {
-    return img_state_flags(0) & IMG_STATE_F_PENDING ||
-           img_state_flags(1) & IMG_STATE_F_PENDING;
+    return img_mgmt_state_flags(0) & IMG_MGMT_STATE_F_PENDING ||
+           img_mgmt_state_flags(1) & IMG_MGMT_STATE_F_PENDING;
 }
 
 int
-img_state_slot_in_use(int slot)
+img_mgmt_slot_in_use(int slot)
 {
     uint8_t state_flags;
 
-    state_flags = img_state_flags(slot);
-    return state_flags & IMG_STATE_F_ACTIVE       ||
-           state_flags & IMG_STATE_F_CONFIRMED    ||
-           state_flags & IMG_STATE_F_PENDING;
+    state_flags = img_mgmt_state_flags(slot);
+    return state_flags & IMG_MGMT_STATE_F_ACTIVE       ||
+           state_flags & IMG_MGMT_STATE_F_CONFIRMED    ||
+           state_flags & IMG_MGMT_STATE_F_PENDING;
 }
 
 int
-img_state_set_pending(int slot, int permanent)
+img_mgmt_state_set_pending(int slot, int permanent)
 {
     uint8_t state_flags;
     int rc;
 
-    state_flags = img_state_flags(slot);
+    state_flags = img_mgmt_state_flags(slot);
 
     /* Unconfirmed slots are always runable.  A confirmed slot can only be
      * run if it is a loader in a split image setup.
      */
-    if (state_flags & IMG_STATE_F_CONFIRMED && slot != 0) {
+    if (state_flags & IMG_MGMT_STATE_F_CONFIRMED && slot != 0) {
         return MGMT_ERR_EBADSTATE;
     }
 
-    rc = img_impl_write_pending(slot, permanent);
+    rc = img_mgmt_impl_write_pending(slot, permanent);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
@@ -127,16 +127,16 @@ img_state_set_pending(int slot, int permanent)
 }
 
 int
-img_state_confirm(void)
+img_mgmt_state_confirm(void)
 {
     int rc;
 
     /* Confirm disallowed if a test is pending. */
-    if (img_state_any_pending()) {
+    if (img_mgmt_state_any_pending()) {
         return MGMT_ERR_EBADSTATE;
     }
 
-    rc = img_impl_write_confirmed();
+    rc = img_mgmt_impl_write_confirmed();
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
@@ -145,14 +145,14 @@ img_state_confirm(void)
 }
 
 int
-img_state_read(struct mgmt_cbuf *cb)
+img_mgmt_state_read(struct mgmt_cbuf *cb)
 {
     int i;
     int rc;
     uint32_t flags;
     struct image_version ver;
-    uint8_t hash[IMG_HASH_LEN]; /* SHA256 hash */
-    char vers_str[IMG_NMGR_MAX_VER];
+    uint8_t hash[IMAGE_HASH_LEN]; /* SHA256 hash */
+    char vers_str[IMG_MGMT_MAX_VER];
     int any_non_bootable;
     uint8_t state_flags;
     CborError g_err = CborNoError;
@@ -166,7 +166,7 @@ img_state_read(struct mgmt_cbuf *cb)
     g_err |= cbor_encoder_create_array(&cb->encoder, &images,
                                        CborIndefiniteLength);
     for (i = 0; i < 2; i++) {
-        rc = img_read_info(i, &ver, hash, &flags);
+        rc = img_mgmt_read_info(i, &ver, hash, &flags);
         if (rc != 0) {
             continue;
         }
@@ -175,7 +175,7 @@ img_state_read(struct mgmt_cbuf *cb)
             any_non_bootable = 1;
         }
 
-        state_flags = img_state_flags(i);
+        state_flags = img_mgmt_state_flags(i);
 
         g_err |= cbor_encoder_create_map(&images, &image,
                                          CborIndefiniteLength);
@@ -183,30 +183,30 @@ img_state_read(struct mgmt_cbuf *cb)
         g_err |= cbor_encode_int(&image, i);
 
         g_err |= cbor_encode_text_stringz(&image, "version");
-        img_ver_str(&ver, vers_str);
+        img_mgmt_ver_str(&ver, vers_str);
         g_err |= cbor_encode_text_stringz(&image, vers_str);
 
         g_err |= cbor_encode_text_stringz(&image, "hash");
-        g_err |= cbor_encode_byte_string(&image, hash, IMG_HASH_LEN);
+        g_err |= cbor_encode_byte_string(&image, hash, IMAGE_HASH_LEN);
 
         g_err |= cbor_encode_text_stringz(&image, "bootable");
         g_err |= cbor_encode_boolean(&image, !(flags & IMAGE_F_NON_BOOTABLE));
 
         g_err |= cbor_encode_text_stringz(&image, "pending");
         g_err |= cbor_encode_boolean(&image,
-                                     state_flags & IMG_STATE_F_PENDING);
+                                     state_flags & IMG_MGMT_STATE_F_PENDING);
 
         g_err |= cbor_encode_text_stringz(&image, "confirmed");
         g_err |= cbor_encode_boolean(&image,
-                                     state_flags & IMG_STATE_F_CONFIRMED);
+                                     state_flags & IMG_MGMT_STATE_F_CONFIRMED);
 
         g_err |= cbor_encode_text_stringz(&image, "active");
         g_err |= cbor_encode_boolean(&image,
-                                     state_flags & IMG_STATE_F_ACTIVE);
+                                     state_flags & IMG_MGMT_STATE_F_ACTIVE);
 
         g_err |= cbor_encode_text_stringz(&image, "permanent");
         g_err |= cbor_encode_boolean(&image,
-                                     state_flags & IMG_STATE_F_PERMANENT);
+                                     state_flags & IMG_MGMT_STATE_F_PERMANENT);
 
         g_err |= cbor_encoder_close_container(&images, &image);
     }
@@ -223,9 +223,9 @@ img_state_read(struct mgmt_cbuf *cb)
 }
 
 int
-img_state_write(struct mgmt_cbuf *cb)
+img_mgmt_state_write(struct mgmt_cbuf *cb)
 {
-    uint8_t hash[IMG_HASH_LEN];
+    uint8_t hash[IMAGE_HASH_LEN];
     size_t hash_len = 0;
     bool confirm;
     int slot;
@@ -262,7 +262,7 @@ img_state_write(struct mgmt_cbuf *cb)
             return MGMT_ERR_EINVAL;
         }
     } else {
-        slot = img_find_by_hash(hash, NULL);
+        slot = img_mgmt_find_by_hash(hash, NULL);
         if (slot < 0) {
             return MGMT_ERR_EINVAL;
         }
@@ -270,16 +270,16 @@ img_state_write(struct mgmt_cbuf *cb)
 
     if (slot == 0 && confirm) {
         /* Confirm current setup. */
-        rc = img_state_confirm();
+        rc = img_mgmt_state_confirm();
     } else {
-        rc = img_state_set_pending(slot, confirm);
+        rc = img_mgmt_state_set_pending(slot, confirm);
     }
     if (rc != 0) {
         return rc;
     }
 
     /* Send the current image state in the response. */
-    rc = img_state_read(cb);
+    rc = img_mgmt_state_read(cb);
     if (rc != 0) {
         return rc;
     }
diff --git a/cmd/img/src/img_util.c b/cmd/img_mgmt/src/img_mgmt_util.c
similarity index 50%
rename from cmd/img/src/img_util.c
rename to cmd/img_mgmt/src/img_mgmt_util.c
index ae9ca1e..7b4124b 100644
--- a/cmd/img/src/img_util.c
+++ b/cmd/img_mgmt/src/img_mgmt_util.c
@@ -22,64 +22,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "img/image.h"
-#include "img/img.h"
+#include "img_mgmt/image.h"
+#include "img_mgmt/img_mgmt.h"
 
-// Removed due to missing strsep().
-#if 0
 int
-img_ver_parse(char *src, struct image_version *ver)
-{
-    unsigned long ul;
-    char *tok;
-    char *nxt;
-    char *ep;
-
-    memset(ver, 0, sizeof(*ver));
-
-    nxt = src;
-    tok = strsep(&nxt, ".");
-    ul = strtoul(tok, &ep, 10);
-    if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT8_MAX) {
-        return -1;
-    }
-    ver->iv_major = ul;
-    if (nxt == NULL) {
-        return 0;
-    }
-    tok = strsep(&nxt, ".");
-    ul = strtoul(tok, &ep, 10);
-    if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT8_MAX) {
-        return -1;
-    }
-    ver->iv_minor = ul;
-    if (nxt == NULL) {
-        return 0;
-    }
-
-    tok = strsep(&nxt, ".");
-    ul = strtoul(tok, &ep, 10);
-    if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT16_MAX) {
-        return -1;
-    }
-    ver->iv_revision = ul;
-    if (nxt == NULL) {
-        return 0;
-    }
-
-    tok = nxt;
-    ul = strtoul(tok, &ep, 10);
-    if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT32_MAX) {
-        return -1;
-    }
-    ver->iv_build_num = ul;
-
-    return 0;
-}
-#endif
-
-int
-img_ver_str(const struct image_version *ver, char *dst)
+img_mgmt_ver_str(const struct image_version *ver, char *dst)
 {
     if (ver->iv_build_num) {
         return sprintf(dst, "%u.%u.%u.%lu",
diff --git a/cmd/img/syscfg.yml b/cmd/img_mgmt/syscfg.yml
similarity index 100%
rename from cmd/img/syscfg.yml
rename to cmd/img_mgmt/syscfg.yml

-- 
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.