aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-07-28 00:44:49 +0200
committerHarald Welte <laforge@gnumonks.org>2009-07-28 00:44:49 +0200
commit3366a94d6c3cd28c71bf76133a3ead3212fd04f1 (patch)
tree6423887a7c52271cce815c8864b51791a4e32410
parentf3efc597d162e6e5f80e926c992dafe4e9f7dfc6 (diff)
parent7bfc26749662e3a3227037cce4a24748343b50be (diff)
Merge branch 'master' into sms
Conflicts: openbsc/include/openbsc/transaction.h openbsc/src/gsm_04_11.c openbsc/src/transaction.c
-rw-r--r--openbsc/src/abis_nm.c11
-rw-r--r--openbsc/src/e1_input.c10
-rw-r--r--openbsc/src/gsm_04_08.c5
-rw-r--r--openbsc/src/gsm_04_11.c14
-rw-r--r--openbsc/src/gsm_subscriber.c16
-rw-r--r--openbsc/src/mncc.c11
-rw-r--r--openbsc/src/msgb.c8
-rw-r--r--openbsc/src/paging.c8
-rw-r--r--openbsc/src/signal.c8
-rw-r--r--openbsc/src/subchan_demux.c9
-rw-r--r--openbsc/src/trau_mux.c17
11 files changed, 64 insertions, 53 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 2b5647962..dec4b2957 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2056,10 +2056,6 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
FILE *swl;
int rc = 0;
- if (!tall_fle_ctx)
- tall_fle_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "bs11_file_list_entry");
-
swl = fopen(bs11_sw->swl_fname, "r");
if (!swl)
return -ENODEV;
@@ -2373,3 +2369,10 @@ int abis_nm_ipaccess_restart(struct gsm_bts *bts)
{
return __simple_cmd(bts, NM_MT_IPACC_RESTART);
}
+
+
+static __attribute__((constructor)) void on_dso_load_abis_nm(void)
+{
+ tall_fle_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "bs11_file_list_entry");
+}
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index 2d0c1340f..7531755c2 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -370,10 +370,6 @@ e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
if (ts->type != E1INP_TS_TYPE_SIGN)
return NULL;
- if (!tall_sigl_ctx)
- tall_sigl_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "e1inp_sign_link");
-
link = talloc_zero(tall_sigl_ctx, struct e1inp_sign_link);
if (!link)
return NULL;
@@ -505,3 +501,9 @@ int e1inp_line_register(struct e1inp_line *line)
return 0;
}
+
+static __attribute__((constructor)) void on_dso_load_e1_inp(void)
+{
+ tall_sigl_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "e1inp_sign_link");
+}
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index a5c562faf..bc110a39c 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -350,9 +350,6 @@ static void allocate_loc_updating_req(struct gsm_lchan *lchan)
use_lchan(lchan);
release_loc_updating_req(lchan);
- if (!tall_locop_ctx)
- tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "loc_updating_oper");
lchan->loc_operation = talloc_zero(tall_locop_ctx,
struct gsm_loc_updating_operation);
}
@@ -408,6 +405,8 @@ static int gsm0408_handle_lchan_signal(unsigned int subsys, unsigned int signal,
*/
static __attribute__((constructor)) void on_dso_load_0408(void)
{
+ tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "loc_updating_oper");
register_signal_handler(SS_LCHAN, gsm0408_handle_lchan_signal, NULL);
}
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c
index 1260eee1c..5ce25f3dc 100644
--- a/openbsc/src/gsm_04_11.c
+++ b/openbsc/src/gsm_04_11.c
@@ -286,19 +286,11 @@ static int gsm340_rx_tpdu(struct msgb *msg)
u_int8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */
int rc = 0;
- if (!tall_sms_ctx)
- tall_sms_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "sms_submit");
-
sms = talloc(tall_sms_ctx, struct sms_submit);
if (!sms)
return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
memset(sms, 0, sizeof(*sms));
- if (!tall_gsms_ctx)
- tall_gsms_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "sms");
-
gsms = talloc(tall_gsms_ctx, struct gsm_sms);
if (!gsms) {
talloc_free(sms);
@@ -772,3 +764,9 @@ int gsm0411_send_sms(struct gsm_lchan *lchan, struct sms_deliver *sms)
smsd->ud = FIXME;
}
#endif
+
+static __attribute__((constructor)) void on_dso_load_sms(void)
+{
+ tall_sms_ctx = talloc_named_const(tall_bsc_ctx, 1, "sms_submit");
+ tall_gsms_ctx = talloc_named_const(tall_bsc_ctx, 1, "sms");
+}
diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c
index 60dec4321..0bcbdf402 100644
--- a/openbsc/src/gsm_subscriber.c
+++ b/openbsc/src/gsm_subscriber.c
@@ -103,10 +103,6 @@ struct gsm_subscriber *subscr_alloc(void)
{
struct gsm_subscriber *s;
- if (!tall_subscr_ctx)
- tall_subscr_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "subscriber");
-
s = talloc(tall_subscr_ctx, struct gsm_subscriber);
if (!s)
return NULL;
@@ -212,10 +208,6 @@ void subscr_get_channel(struct gsm_subscriber *subscr,
{
struct subscr_request *request;
- if (!tall_sub_req_ctx)
- tall_sub_req_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "subscr_request");
-
request = talloc(tall_sub_req_ctx, struct subscr_request);
if (!request) {
if (cbfn)
@@ -272,3 +264,11 @@ void subscr_put_channel(struct gsm_lchan *lchan)
subscr_send_paging_request(lchan->subscr);
}
+
+static __attribute__((constructor)) void on_dso_load_subscr(void)
+{
+ tall_subscr_ctx = talloc_named_const(tall_bsc_ctx, 1, "subscriber");
+
+ tall_sub_req_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "subscr_request");
+}
diff --git a/openbsc/src/mncc.c b/openbsc/src/mncc.c
index b2dab078e..8cd62f6ce 100644
--- a/openbsc/src/mncc.c
+++ b/openbsc/src/mncc.c
@@ -140,9 +140,6 @@ static int mncc_setup_ind(struct gsm_call *call, int msg_type,
if (call->remote_ref)
return 0;
- if (!tall_call_ctx)
- tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "gsm_call");
/* create remote call */
if (!(remote = talloc(tall_call_ctx, struct gsm_call))) {
memset(&mncc, 0, sizeof(struct gsm_mncc));
@@ -306,9 +303,6 @@ int mncc_recv(struct gsm_network *net, int msg_type, void *arg)
if (!call) {
if (msg_type != MNCC_SETUP_IND)
return 0; /* drop */
- if (!tall_call_ctx)
- tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "gsm_call");
/* create call */
if (!(call = talloc_zero(tall_call_ctx, struct gsm_call))) {
struct gsm_mncc rel;
@@ -395,3 +389,8 @@ int mncc_recv(struct gsm_network *net, int msg_type, void *arg)
return rc;
}
+
+static __attribute__((constructor)) void on_dso_load_trau_mncc(void)
+{
+ tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, "gsm_call");
+}
diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c
index ae1334614..52edf2dcd 100644
--- a/openbsc/src/msgb.c
+++ b/openbsc/src/msgb.c
@@ -33,9 +33,6 @@ struct msgb *msgb_alloc(u_int16_t size, const char *name)
{
struct msgb *msg;
- if (!tall_msgb_ctx)
- tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 1, "msgb");
-
msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name);
if (!msg)
@@ -76,3 +73,8 @@ struct msgb *msgb_dequeue(struct llist_head *queue)
return llist_entry(lh, struct msgb, list);
}
+
+static __attribute__((constructor)) void on_dso_load_trau_msgb(void)
+{
+ tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 1, "msgb");
+}
diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c
index 0703e932f..b63a717b0 100644
--- a/openbsc/src/paging.c
+++ b/openbsc/src/paging.c
@@ -219,9 +219,6 @@ static void _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req;
- if (!tall_paging_ctx)
- tall_paging_ctx = talloc_named_const(NULL, 1, "paging_request");
-
if (paging_pending_request(bts_entry, subscr)) {
DEBUGP(DPAG, "Paging request already pending\n");
return;
@@ -310,3 +307,8 @@ void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots)
{
bts->paging.available_slots = free_slots;
}
+
+static __attribute__((constructor)) void on_dso_load_paging(void)
+{
+ tall_paging_ctx = talloc_named_const(NULL, 1, "paging_request");
+}
diff --git a/openbsc/src/signal.c b/openbsc/src/signal.c
index 41352fb1a..bf5671ee1 100644
--- a/openbsc/src/signal.c
+++ b/openbsc/src/signal.c
@@ -39,9 +39,6 @@ int register_signal_handler(unsigned int subsys, signal_cbfn *cbfn, void *data)
{
struct signal_handler *sig_data;
- if (!tall_sigh_ctx)
- tall_sigh_ctx = talloc_named_const(NULL, 1, "signal_handler");
-
sig_data = talloc(tall_sigh_ctx, struct signal_handler);
if (!sig_data)
return -ENOMEM;
@@ -84,3 +81,8 @@ void dispatch_signal(unsigned int subsys, unsigned int signal, void *signal_data
(*handler->cbfn)(subsys, signal, handler->data, signal_data);
}
}
+
+static __attribute__((constructor)) void on_dso_load_signal(void)
+{
+ tall_sigh_ctx = talloc_named_const(NULL, 1, "signal_handler");
+}
diff --git a/openbsc/src/subchan_demux.c b/openbsc/src/subchan_demux.c
index ccd4fadc6..368b9853c 100644
--- a/openbsc/src/subchan_demux.c
+++ b/openbsc/src/subchan_demux.c
@@ -312,9 +312,6 @@ int subchan_mux_init(struct subch_mux *mx)
{
int i;
- if (!tall_tqe_ctx)
- tall_tqe_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "subch_txq_entry");
memset(mx, 0, sizeof(*mx));
for (i = 0; i < NR_SUBCH; i++) {
struct mux_subch *sch = &mx->subch[i];
@@ -323,3 +320,9 @@ int subchan_mux_init(struct subch_mux *mx)
return 0;
}
+
+static __attribute__((constructor)) void on_dso_load_ss_demux(void)
+{
+ tall_tqe_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "subch_txq_entry");
+}
diff --git a/openbsc/src/trau_mux.c b/openbsc/src/trau_mux.c
index 04febbd63..9ff7001d3 100644
--- a/openbsc/src/trau_mux.c
+++ b/openbsc/src/trau_mux.c
@@ -55,10 +55,6 @@ int trau_mux_map(const struct gsm_e1_subslot *src,
{
struct map_entry *me;
- if (!tall_map_ctx)
- tall_map_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "trau_map_entry");
-
me = talloc(tall_map_ctx, struct map_entry);
if (!me)
return -ENOMEM;
@@ -201,10 +197,6 @@ int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref)
struct gsm_e1_subslot *src_ss;
struct upqueue_entry *ue;
- if (!tall_upq_ctx)
- tall_upq_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "trau_upq_entry");
-
ue = talloc(tall_upq_ctx, struct upqueue_entry);
if (!ue)
return -ENOMEM;
@@ -243,3 +235,12 @@ int trau_send_lchan(struct gsm_lchan *lchan, struct decoded_trau_frame *tf)
return subchan_mux_enqueue(mx, dst_e1_ss->e1_ts_ss, trau_bits_out,
TRAU_FRAME_BITS);
}
+
+static __attribute__((constructor)) void on_dso_load_trau_mux(void)
+{
+ tall_map_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "trau_map_entry");
+
+ tall_upq_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "trau_upq_entry");
+}