This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10461 Change subject: Drop gprs_msgb_copy with libosmocore replacement ...................................................................... Drop gprs_msgb_copy with libosmocore replacement gprs_msgb_copy was introduced in libosmocore 0.94 (f78ec5ce0d0f6038147d9b9e14d81094309ba5d5) as bssgp_msgb_copy. Let's use that one to avoid code duplication. Change-Id: I42a65fd8e4045fafadf5694f2d8d0c5e7ab350a0 --- M include/osmocom/sgsn/gprs_utils.h M src/gprs/gb_proxy.c M src/gprs/gprs_gmm.c M src/gprs/gprs_utils.c M tests/gbproxy/gbproxy_test.c 5 files changed, 6 insertions(+), 56 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/61/10461/1 diff --git a/include/osmocom/sgsn/gprs_utils.h b/include/osmocom/sgsn/gprs_utils.h index e06364d..8e47e90 100644 --- a/include/osmocom/sgsn/gprs_utils.h +++ b/include/osmocom/sgsn/gprs_utils.h @@ -29,7 +29,6 @@ struct msgb; struct gprs_ra_id; -struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name); int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area, size_t old_size, size_t new_size); int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str); diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c index 447772f..dc3c810 100644 --- a/src/gprs/gb_proxy.c +++ b/src/gprs/gb_proxy.c @@ -499,7 +499,7 @@ msgb_nsei(msg), parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP"); - stored_msg = gprs_msgb_copy(msg, "process_bssgp_ul"); + stored_msg = bssgp_msgb_copy(msg, "process_bssgp_ul"); msgb_enqueue(&link_info->stored_msgs, stored_msg); if (!link_info->imsi_acq_pending) { @@ -763,7 +763,7 @@ { /* create a copy of the message so the old one can * be free()d safely when we return from gbprox_rcvmsg() */ - struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2sgsn"); + struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2sgsn"); int rc; DEBUGP(DGPRS, "NSEI=%u proxying BTS->SGSN (NS_BVCI=%u, NSEI=%u)\n", @@ -787,7 +787,7 @@ { /* create a copy of the message so the old one can * be free()d safely when we return from gbprox_rcvmsg() */ - struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2peer"); + struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2peer"); int rc; DEBUGP(DGPRS, "NSEI=%u proxying SGSN->BSS (NS_BVCI=%u, NSEI=%u)\n", @@ -1179,7 +1179,7 @@ return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, orig_msg); } - msg = gprs_msgb_copy(orig_msg, "rx_sig_from_sgsn"); + msg = bssgp_msgb_copy(orig_msg, "rx_sig_from_sgsn"); gbprox_process_bssgp_dl(cfg, msg, NULL); /* Update message info */ bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 91f769d..bea63dc 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -2648,7 +2648,7 @@ * and the dynamic resolution will be the right thing * in the long run. */ - msg = gprs_msgb_copy(_msg, __func__); + msg = bssgp_msgb_copy(_msg, __func__); if (!msg) { struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(_msg); uint8_t transaction_id = gsm48_hdr_trans_id(gh); diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c index d7cef1c..c4b66d6 100644 --- a/src/gprs/gprs_utils.c +++ b/src/gprs/gprs_utils.c @@ -30,55 +30,6 @@ #include <string.h> -/* FIXME: this needs to go to libosmocore/msgb.c */ -struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name) -{ - struct libgb_msgb_cb *old_cb, *new_cb; - struct msgb *new_msg; - - new_msg = msgb_alloc(msg->data_len, name); - if (!new_msg) - return NULL; - - /* copy data */ - memcpy(new_msg->_data, msg->_data, new_msg->data_len); - - /* copy header */ - new_msg->len = msg->len; - new_msg->data += msg->data - msg->_data; - new_msg->head += msg->head - msg->_data; - new_msg->tail += msg->tail - msg->_data; - - if (msg->l1h) - new_msg->l1h = new_msg->_data + (msg->l1h - msg->_data); - if (msg->l2h) - new_msg->l2h = new_msg->_data + (msg->l2h - msg->_data); - if (msg->l3h) - new_msg->l3h = new_msg->_data + (msg->l3h - msg->_data); - if (msg->l4h) - new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data); - - /* copy GB specific data */ - old_cb = LIBGB_MSGB_CB(msg); - new_cb = LIBGB_MSGB_CB(new_msg); - - if (old_cb->bssgph) - new_cb->bssgph = new_msg->_data + (old_cb->bssgph - msg->_data); - if (old_cb->llch) - new_cb->llch = new_msg->_data + (old_cb->llch - msg->_data); - - /* bssgp_cell_id is a pointer into the old msgb, so we need to make - * it a pointer into the new msgb */ - if (old_cb->bssgp_cell_id) - new_cb->bssgp_cell_id = new_msg->_data + - (old_cb->bssgp_cell_id - msg->_data); - new_cb->nsei = old_cb->nsei; - new_cb->bvci = old_cb->bvci; - new_cb->tlli = old_cb->tlli; - - return new_msg; -} - /* TODO: Move this to libosmocore/msgb.c */ int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area, size_t old_size, size_t new_size) diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c index 157da8b..a183320 100644 --- a/tests/gbproxy/gbproxy_test.c +++ b/tests/gbproxy/gbproxy_test.c @@ -1061,7 +1061,7 @@ if (received_messages) { struct msgb *msg_copy; - msg_copy = gprs_msgb_copy(msg, "received_messages"); + msg_copy = bssgp_msgb_copy(msg, "received_messages"); llist_add_tail(&msg_copy->list, received_messages); } -- To view, visit https://gerrit.osmocom.org/10461 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I42a65fd8e4045fafadf5694f2d8d0c5e7ab350a0 Gerrit-Change-Number: 10461 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180815/760d900f/attachment.htm>