Change in osmocom-bb[master]: trxcon/scheduler: pass talloc ctx directly to sched_prim_init()

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Sep 28 09:54:55 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11137 )

Change subject: trxcon/scheduler: pass talloc ctx directly to sched_prim_init()
......................................................................

trxcon/scheduler: pass talloc ctx directly to sched_prim_init()

Enforcing pointer to a 'trx_instance' structure is not flexible,
because it is used as parent talloc context only.

Change-Id: I5ab2ef5cea76f955bf72ef54541b3b75cdc2d23f
---
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.h
2 files changed, 5 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index e71109b..e03f93f 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -42,16 +42,15 @@
  * Initializes a new primitive by allocating memory
  * and filling some meta-information (e.g. lchan type).
  *
- * @param  trx     TRX instance to be used as initial talloc context
+ * @param  ctx     parent talloc context
  * @param  prim    external prim pointer (will point to the allocated prim)
  * @param  pl_len  prim payload length
  * @param  chan_nr RSL channel description (used to set a proper chan)
  * @param  link_id RSL link description (used to set a proper chan)
  * @return         zero in case of success, otherwise a error number
  */
-int sched_prim_init(struct trx_instance *trx,
-	struct trx_ts_prim **prim, size_t pl_len,
-	uint8_t chan_nr, uint8_t link_id)
+int sched_prim_init(void *ctx, struct trx_ts_prim **prim,
+	size_t pl_len, uint8_t chan_nr, uint8_t link_id)
 {
 	enum trx_lchan_type lchan_type;
 	struct trx_ts_prim *new_prim;
@@ -70,7 +69,7 @@
 	len += pl_len; /* Requested payload size */
 
 	/* Allocate a new primitive */
-	new_prim = talloc_zero_size(trx, len);
+	new_prim = talloc_zero_size(ctx, len);
 	if (new_prim == NULL) {
 		LOGP(DSCH, LOGL_ERROR, "Failed to allocate memory\n");
 		return -ENOMEM;
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index ff288f2..818c95a 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -273,7 +273,7 @@
 	enum trx_lchan_type chan);
 
 /* Primitive management functions */
-int sched_prim_init(struct trx_instance *trx, struct trx_ts_prim **prim,
+int sched_prim_init(void *ctx, struct trx_ts_prim **prim,
 	size_t pl_len, uint8_t chan_nr, uint8_t link_id);
 int sched_prim_push(struct trx_instance *trx,
 	struct trx_ts_prim *prim, uint8_t chan_nr);

-- 
To view, visit https://gerrit.osmocom.org/11137
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5ab2ef5cea76f955bf72ef54541b3b75cdc2d23f
Gerrit-Change-Number: 11137
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180928/df774b4f/attachment.htm>


More information about the gerrit-log mailing list