Hello Jenkins Builder, I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/7603 to look at the new patch set (#3). use osmo_init_logging2() with proper talloc ctx Completely drop bts_log_init(), call osmo_init_logging2() directly instead: all callers of bts_log_init() passed NULL as category string, so all it ever did was call osmo_init_logging(). The bts_log_info is already declared in the .h. Here and there also define a proper talloc root context instead of using NULL. Change-Id: Ic049f77bef74123b95350bcae182a468e0086b9c --- M doc/startup.txt M include/osmo-bts/logging.h M src/common/logging.c M src/common/main.c M src/osmo-bts-litecell15/misc/lc15bts_mgr.c M src/osmo-bts-omldummy/main.c M src/osmo-bts-sysmo/l1_fwd_main.c M src/osmo-bts-sysmo/misc/sysmobts_mgr.c M tests/agch/agch_test.c M tests/cipher/cipher_test.c M tests/handover/handover_test.c M tests/meas/meas_test.c M tests/misc/misc_test.c M tests/paging/paging_test.c M tests/tx_power/tx_power_test.c 15 files changed, 23 insertions(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/03/7603/3 diff --git a/doc/startup.txt b/doc/startup.txt index cc64375..50766e4 100644 --- a/doc/startup.txt +++ b/doc/startup.txt @@ -6,7 +6,7 @@ |=== | bts-specific | main() | | common | bts_main() | initialization of talloc contexts -| common | bts_log_init() | initialization of logging +| common | osmo_init_logging2() | initialization of logging | common | handle_options() | common option parsing | bts-specific | bts_model_handle_options() | model-specific option parsing | common | gsm_bts_alloc() | allocation of BTS/TRX/TS data structures diff --git a/include/osmo-bts/logging.h b/include/osmo-bts/logging.h index 68f379c..852c383 100644 --- a/include/osmo-bts/logging.h +++ b/include/osmo-bts/logging.h @@ -25,8 +25,6 @@ extern const struct log_info bts_log_info; -int bts_log_init(const char *category_mask); - /* LOGP with gsm_time prefix */ #define LOGPGT(ss, lvl, gt, fmt, args...) \ LOGP(ss, lvl, "%s " fmt, osmo_dump_gsmtime(gt), ## args) diff --git a/src/common/logging.c b/src/common/logging.c index a4d30e6..3315a01 100644 --- a/src/common/logging.c +++ b/src/common/logging.c @@ -148,13 +148,3 @@ .cat = bts_log_info_cat, .num_cat = ARRAY_SIZE(bts_log_info_cat), }; - -int bts_log_init(const char *category_mask) -{ - osmo_init_logging(&bts_log_info); - - if (category_mask) - log_parse_category_mask(osmo_stderr_target, category_mask); - - return 0; -} diff --git a/src/common/main.c b/src/common/main.c index 0f6f529..9121a2a 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -239,7 +239,7 @@ msgb_talloc_ctx_init(tall_bts_ctx, 100*1024); bts_vty_info.tall_ctx = tall_bts_ctx; - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); vty_init(&bts_vty_info); ctrl_vty_init(tall_bts_ctx); rate_ctr_init(tall_bts_ctx); diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c index 7886a5e..dbdcc9f 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c @@ -281,12 +281,6 @@ .num_cat = ARRAY_SIZE(mgr_log_info_cat), }; -static int mgr_log_init(void) -{ - osmo_init_logging(&mgr_log_info); - return 0; -} - int main(int argc, char **argv) { int rc; @@ -294,7 +288,7 @@ tall_mgr_ctx = talloc_named_const(NULL, 1, "bts manager"); msgb_talloc_ctx_init(tall_mgr_ctx, 0); - mgr_log_init(); + osmo_init_logging2(tall_mgr_ctx, &mgr_log_info); osmo_init_ignore_signals(); signal(SIGINT, &signal_handler); diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c index 39f2ac2..ef94553 100644 --- a/src/osmo-bts-omldummy/main.c +++ b/src/osmo-bts-omldummy/main.c @@ -19,7 +19,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 10*1024); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); bts = gsm_bts_alloc(tall_bts_ctx, 0); if (!bts) diff --git a/src/osmo-bts-sysmo/l1_fwd_main.c b/src/osmo-bts-sysmo/l1_fwd_main.c index 92d2ea4..bc9fc21 100644 --- a/src/osmo-bts-sysmo/l1_fwd_main.c +++ b/src/osmo-bts-sysmo/l1_fwd_main.c @@ -37,6 +37,7 @@ #include <osmocom/core/write_queue.h> #include <osmocom/core/logging.h> #include <osmocom/core/socket.h> +#include <osmocom/core/application.h> #include <osmocom/gsm/gsm_utils.h> #include <osmo-bts/logging.h> @@ -169,11 +170,12 @@ struct l1fwd_hdl *l1fh; struct femtol1_hdl *fl1h; int rc, i; + void *ctx = talloc_named_const(NULL, 0, "l1_fwd"); printf("sizeof(GsmL1_Prim_t) = %zu\n", sizeof(GsmL1_Prim_t)); printf("sizeof(SuperFemto_Prim_t) = %zu\n", sizeof(SuperFemto_Prim_t)); - bts_log_init(NULL); + osmo_init_logging2(ctx, &bts_log_info); /* * hack and prevent that two l1fwd-proxy/sysmobts run at the same @@ -187,7 +189,7 @@ } /* allocate new femtol1_handle */ - fl1h = talloc_zero(NULL, struct femtol1_hdl); + fl1h = talloc_zero(ctx, struct femtol1_hdl); INIT_LLIST_HEAD(&fl1h->wlc_list); /* open the actual hardware transport */ @@ -198,7 +200,7 @@ } /* create our fwd handle */ - l1fh = talloc_zero(NULL, struct l1fwd_hdl); + l1fh = talloc_zero(ctx, struct l1fwd_hdl); l1fh->fl1h = fl1h; fl1h->priv = l1fh; diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c index 17a6d89..a008073 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c @@ -245,12 +245,6 @@ .num_cat = ARRAY_SIZE(mgr_log_info_cat), }; -static int mgr_log_init(void) -{ - osmo_init_logging(&mgr_log_info); - return 0; -} - int main(int argc, char **argv) { int rc; @@ -261,7 +255,7 @@ srand(time(NULL)); - mgr_log_init(); + osmo_init_logging2(tall_mgr_ctx, &mgr_log_info); if (classify_bts() != 0) exit(2); diff --git a/tests/agch/agch_test.c b/tests/agch/agch_test.c index 6efbc24..ab59ebf 100644 --- a/tests/agch/agch_test.c +++ b/tests/agch/agch_test.c @@ -222,7 +222,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); bts = gsm_bts_alloc(tall_bts_ctx, 0); if (bts_init(bts) < 0) { diff --git a/tests/cipher/cipher_test.c b/tests/cipher/cipher_test.c index 5e2bdc0..a7343c0 100644 --- a/tests/cipher/cipher_test.c +++ b/tests/cipher/cipher_test.c @@ -68,7 +68,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); bts = gsm_bts_alloc(tall_bts_ctx, 0); if (bts_init(bts) < 0) { diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 1c0a4da..c7bd8f8 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -67,7 +67,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); osmo_stderr_target->categories[DHO].loglevel = LOGL_DEBUG; bts = gsm_bts_alloc(tall_bts_ctx, 0); diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c index a283c47..cbc673f 100644 --- a/tests/meas/meas_test.c +++ b/tests/meas/meas_test.c @@ -69,7 +69,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); osmo_stderr_target->categories[DMEAS].loglevel = LOGL_DEBUG; bts = gsm_bts_alloc(tall_bts_ctx, 0); diff --git a/tests/misc/misc_test.c b/tests/misc/misc_test.c index e454235..c4d3a59 100644 --- a/tests/misc/misc_test.c +++ b/tests/misc/misc_test.c @@ -24,10 +24,13 @@ #include <osmo-bts/msg_utils.h> #include <osmo-bts/logging.h> +#include <osmocom/core/application.h> #include <osmocom/gsm/protocol/ipaccess.h> #include <stdlib.h> #include <stdio.h> + +void *ctx = NULL; static const uint8_t ipa_rsl_connect[] = { 0x00, 0x1c, 0xff, 0x10, 0x80, 0x00, 0x0a, 0x0d, @@ -161,7 +164,7 @@ { struct gsm_bts *bts; - bts = gsm_bts_alloc(NULL, 0); + bts = gsm_bts_alloc(ctx, 0); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1); @@ -184,7 +187,9 @@ int main(int argc, char **argv) { - bts_log_init(NULL); + ctx = talloc_named_const(NULL, 0, "misc_test"); + + osmo_init_logging2(ctx, &bts_log_info); test_sacch_get(); test_msg_utils_ipa(); diff --git a/tests/paging/paging_test.c b/tests/paging/paging_test.c index f4f0934..bf28661 100644 --- a/tests/paging/paging_test.c +++ b/tests/paging/paging_test.c @@ -114,7 +114,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); bts = gsm_bts_alloc(tall_bts_ctx, 0); if (bts_init(bts) < 0) { diff --git a/tests/tx_power/tx_power_test.c b/tests/tx_power/tx_power_test.c index a47d186..ad3f68c 100644 --- a/tests/tx_power/tx_power_test.c +++ b/tests/tx_power/tx_power_test.c @@ -211,7 +211,7 @@ tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context"); msgb_talloc_ctx_init(tall_bts_ctx, 0); - bts_log_init(NULL); + osmo_init_logging2(tall_bts_ctx, &bts_log_info); osmo_stderr_target->categories[DL1C].loglevel = LOGL_DEBUG; log_set_print_filename(osmo_stderr_target, 0); -- To view, visit https://gerrit.osmocom.org/7603 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic049f77bef74123b95350bcae182a468e0086b9c Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder