From 113e30cb0639cefbafdad2862c5e69b0e17d9bf3 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 1 Apr 2018 16:11:39 +0200 Subject: 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 --- src/common/logging.c | 10 ---------- src/common/main.c | 2 +- src/osmo-bts-litecell15/misc/lc15bts_mgr.c | 8 +------- src/osmo-bts-omldummy/main.c | 2 +- src/osmo-bts-sysmo/l1_fwd_main.c | 8 +++++--- src/osmo-bts-sysmo/misc/sysmobts_mgr.c | 8 +------- 6 files changed, 9 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/common/logging.c b/src/common/logging.c index a4d30e6b..3315a019 100644 --- a/src/common/logging.c +++ b/src/common/logging.c @@ -148,13 +148,3 @@ const struct log_info bts_log_info = { .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 0f6f5295..9121a2ab 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -239,7 +239,7 @@ int bts_main(int argc, char **argv) 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 7886a5e2..dbdcc9f0 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c @@ -281,12 +281,6 @@ static const struct log_info mgr_log_info = { .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 @@ int main(int argc, char **argv) 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 39f2ac2b..ef945537 100644 --- a/src/osmo-bts-omldummy/main.c +++ b/src/osmo-bts-omldummy/main.c @@ -19,7 +19,7 @@ int main(int argc, char **argv) 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 92d2ea47..bc9fc21c 100644 --- a/src/osmo-bts-sysmo/l1_fwd_main.c +++ b/src/osmo-bts-sysmo/l1_fwd_main.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -169,11 +170,12 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) } /* 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 @@ int main(int argc, char **argv) } /* 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 17a6d89b..a0080738 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c @@ -245,12 +245,6 @@ static const struct log_info mgr_log_info = { .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 @@ int main(int argc, char **argv) srand(time(NULL)); - mgr_log_init(); + osmo_init_logging2(tall_mgr_ctx, &mgr_log_info); if (classify_bts() != 0) exit(2); -- cgit v1.2.3