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

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

commit b8c9abb79346a4ecd755b736dda3655e3c48b57d
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Oct 6 19:14:56 2026 +0200

    mgmt/mcumgr/omp: Remove OS abstraction layer
    
    mcumgr is now part of Mynewt core and there is no need for OS
    abstraction layer. Mynewt implementation is merged into omp.c and
    omp_impl_process_request_packet() is renamed to
    omp_process_request_packet(). Mynewt port package is removed.
    
    No functional changes.
    
    Assisted-by: Claude:claude-opus-5-5
---
 mgmt/mcumgr/omp/include/omp/omp.h            |  2 +-
 mgmt/mcumgr/omp/port/mynewt/pkg.yml          | 28 ---------
 mgmt/mcumgr/omp/port/mynewt/src/mynewt_omp.c | 91 ----------------------------
 mgmt/mcumgr/omp/src/omp.c                    | 57 +++++++++++++++++
 mgmt/oicmgr/pkg.yml                          |  1 -
 mgmt/oicmgr/src/oicmgr.c                     |  2 +-
 6 files changed, 59 insertions(+), 122 deletions(-)

diff --git a/mgmt/mcumgr/omp/include/omp/omp.h 
b/mgmt/mcumgr/omp/include/omp/omp.h
index ae99ef7e1..043ee8846 100644
--- a/mgmt/mcumgr/omp/include/omp/omp.h
+++ b/mgmt/mcumgr/omp/include/omp/omp.h
@@ -91,7 +91,7 @@ struct omp_state {
  *
  * @return                      0 on success, MGMT_ERR_[...] code on failure.
  */
-int omp_impl_process_request_packet(struct omp_state *omgr_st, void *req);
+int omp_process_request_packet(struct omp_state *omgr_st, void *req);
 
 /**
  * @brief Read the management header out from a cbor value
diff --git a/mgmt/mcumgr/omp/port/mynewt/pkg.yml 
b/mgmt/mcumgr/omp/port/mynewt/pkg.yml
deleted file mode 100644
index 98bad3b61..000000000
--- a/mgmt/mcumgr/omp/port/mynewt/pkg.yml
+++ /dev/null
@@ -1,28 +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.
-#
-
-pkg.name: mgmt/mcumgr/omp/port/mynewt
-pkg.description: 'OIC Management Protocol.'
-pkg.author: "Apache Mynewt <[email protected]>"
-pkg.homepage: "http://mynewt.apache.org/";
-pkg.keywords:
-
-pkg.deps:
-    - '@apache-mynewt-core/mgmt/mcumgr/omp'
-    - '@apache-mynewt-core/mgmt/mcumgr/mgmt'
diff --git a/mgmt/mcumgr/omp/port/mynewt/src/mynewt_omp.c 
b/mgmt/mcumgr/omp/port/mynewt/src/mynewt_omp.c
deleted file mode 100644
index 38b1ef4cd..000000000
--- a/mgmt/mcumgr/omp/port/mynewt/src/mynewt_omp.c
+++ /dev/null
@@ -1,91 +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.
- */
-
-#include <assert.h>
-#include <string.h>
-
-#include "os/mynewt.h"
-
-#include <mgmt/mgmt.h>
-#include <cborattr/cborattr.h>
-#include <tinycbor/cbor.h>
-
-#include "omp/omp.h"
-#include "omp/omp_priv.h"
-
-int
-omp_impl_process_request_packet(struct omp_state *omgr_st, void *req_buf)
-{
-    struct mgmt_ctxt ctxt;
-    struct omp_streamer *streamer;
-    struct mgmt_hdr req_hdr, rsp_hdr;
-    struct os_mbuf *req_m;
-    int rc = 0;
-
-    assert(omgr_st);
-    assert(req_buf);
-
-    streamer = &omgr_st->omp_stmr;
-    omgr_st->m_ctxt = &ctxt;
-
-    req_m = (struct os_mbuf *) req_buf;
-
-    rc = mgmt_streamer_init_reader(&streamer->mgmt_stmr, req_m);
-    if (rc != 0) {
-        rc = MGMT_ERR_EINVAL;
-        return rc;
-
-    }
-
-    rc = omp_read_hdr(&ctxt.it, &req_hdr);
-    if (rc != 0) {
-        rc = MGMT_ERR_EINVAL;
-        return rc;
-
-    }
-
-    memcpy(&rsp_hdr, &req_hdr, sizeof(struct mgmt_hdr));
-
-    rc = mgmt_streamer_init_reader(&streamer->mgmt_stmr, req_m);
-    if (rc != 0) {
-        rc = MGMT_ERR_EINVAL;
-        return rc;
-
-    }
-
-    rc = cbor_encoder_create_map(streamer->rsp_encoder,
-                                 &ctxt.encoder,
-                                 CborIndefiniteLength);
-    if (rc != 0) {
-        rc = MGMT_ERR_EINVAL;
-        return rc;
-    }
-
-    rc = omp_process_mgmt_hdr(&req_hdr, &rsp_hdr, &ctxt);
-
-    cbor_encoder_close_container(streamer->rsp_encoder, &ctxt.encoder);
-    if (rc != 0) {
-        rc = MGMT_ERR_EINVAL;
-        return rc;
-
-    }
-
-    streamer->tx_rsp_cb(streamer, rc, NULL);
-    return 0;
-}
diff --git a/mgmt/mcumgr/omp/src/omp.c b/mgmt/mcumgr/omp/src/omp.c
index c305f7539..6ff42e33e 100644
--- a/mgmt/mcumgr/omp/src/omp.c
+++ b/mgmt/mcumgr/omp/src/omp.c
@@ -26,6 +26,7 @@
 #include <cborattr/cborattr.h>
 #include <tinycbor/cbor.h>
 
+#include "omp/omp.h"
 #include "omp/omp_priv.h"
 
 int
@@ -154,3 +155,59 @@ omp_process_mgmt_hdr(struct mgmt_hdr *req_hdr, struct 
mgmt_hdr *rsp_hdr,
 
     return mgmt_err_from_cbor(rc);
 }
+
+int
+omp_process_request_packet(struct omp_state *omgr_st, void *req_buf)
+{
+    struct mgmt_ctxt ctxt;
+    struct omp_streamer *streamer;
+    struct mgmt_hdr req_hdr, rsp_hdr;
+    struct os_mbuf *req_m;
+    int rc = 0;
+
+    assert(omgr_st);
+    assert(req_buf);
+
+    streamer = &omgr_st->omp_stmr;
+    omgr_st->m_ctxt = &ctxt;
+
+    req_m = (struct os_mbuf *)req_buf;
+
+    rc = mgmt_streamer_init_reader(&streamer->mgmt_stmr, req_m);
+    if (rc != 0) {
+        rc = MGMT_ERR_EINVAL;
+        return rc;
+    }
+
+    rc = omp_read_hdr(&ctxt.it, &req_hdr);
+    if (rc != 0) {
+        rc = MGMT_ERR_EINVAL;
+        return rc;
+    }
+
+    memcpy(&rsp_hdr, &req_hdr, sizeof(struct mgmt_hdr));
+
+    rc = mgmt_streamer_init_reader(&streamer->mgmt_stmr, req_m);
+    if (rc != 0) {
+        rc = MGMT_ERR_EINVAL;
+        return rc;
+    }
+
+    rc = cbor_encoder_create_map(streamer->rsp_encoder, &ctxt.encoder,
+                                 CborIndefiniteLength);
+    if (rc != 0) {
+        rc = MGMT_ERR_EINVAL;
+        return rc;
+    }
+
+    rc = omp_process_mgmt_hdr(&req_hdr, &rsp_hdr, &ctxt);
+
+    cbor_encoder_close_container(streamer->rsp_encoder, &ctxt.encoder);
+    if (rc != 0) {
+        rc = MGMT_ERR_EINVAL;
+        return rc;
+    }
+
+    streamer->tx_rsp_cb(streamer, rc, NULL);
+    return 0;
+}
diff --git a/mgmt/oicmgr/pkg.yml b/mgmt/oicmgr/pkg.yml
index 4a22d3fb3..bfe1aace3 100644
--- a/mgmt/oicmgr/pkg.yml
+++ b/mgmt/oicmgr/pkg.yml
@@ -29,7 +29,6 @@ pkg.keywords:
 pkg.deps:
     - "@apache-mynewt-core/kernel/os"
     - "@apache-mynewt-core/net/oic"
-    - "@apache-mynewt-core/mgmt/mcumgr/omp/port/mynewt"
     - "@apache-mynewt-core/mgmt/mcumgr/omp"
 
 pkg.init:
diff --git a/mgmt/oicmgr/src/oicmgr.c b/mgmt/oicmgr/src/oicmgr.c
index 564327400..d037757dc 100644
--- a/mgmt/oicmgr/src/oicmgr.c
+++ b/mgmt/oicmgr/src/oicmgr.c
@@ -221,7 +221,7 @@ omgr_process_request(oc_request_t *req, oc_interface_mask_t 
mask)
         /* Fallthrough */
 
     case OC_IF_RW:
-        rc = omp_impl_process_request_packet(&omgr_state, m_req);
+        rc = omp_process_request_packet(&omgr_state, m_req);
         break;
 
     default:

Reply via email to