summaryrefslogtreecommitdiffstats
path: root/src/vty
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-17 16:35:27 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-22 16:08:38 +0000
commit812ba6dc63a75c39678dd3fe652768e76bf63183 (patch)
tree760a4307fe5a1de5d30f6115b6801018936c15b2 /src/vty
parentbd9de2f66f82db66bbbe7e7df54bf8fee8e1a8ae (diff)
logging: centrally define ctx and filter indexes
It is too easy for calling code to use the same filter and context indexes for different filters and structs. For example, openbsc's IMSI filter and libgb's GPRS_BVC filter both fall on index 1 even though there are plenty more indexes to choose from. To alleviate this, have one central definition here, sort of like ports.h does for VTY and CTRL port numbers. Add static asserts to make sure the indexes fit in the available array and bit mask space. Calling code like openbsc.git and osmo-pcu need adjustments and/or should move to using these enum values instead of their local definitions. Taking this opportunity to also prepare for a split of struct gsm_subscriber in openbsc into bsc_subsciber and vlr_subscriber with appropriate separate filter index constants for both subscriber types. Include previous LOG_FILTER_ALL in the LOGGING_FILTER_* enum, and replace its use by (1 << LOGGING_FILTER_ALL). Change-Id: I5c343630020f4b108099696fd96c2111614c8067
Diffstat (limited to 'src/vty')
-rw-r--r--src/vty/logging_vty.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 6004c479..30ee4559 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -287,7 +287,7 @@ static void vty_print_logtarget(struct vty *vty, const struct log_info *info,
}
vty_out(vty, " Log Filter 'ALL': %s%s",
- tgt->filter_map & LOG_FILTER_ALL ? "Enabled" : "Disabled",
+ tgt->filter_map & (1 << LOGGING_FILTER_ALL) ? "Enabled" : "Disabled",
VTY_NEWLINE);
/* print application specific filters */
@@ -687,7 +687,7 @@ static int config_write_log_single(struct vty *vty, struct log_target *tgt)
}
vty_out(vty, " logging filter all %u%s",
- tgt->filter_map & LOG_FILTER_ALL ? 1 : 0, VTY_NEWLINE);
+ tgt->filter_map & (1 << LOGGING_FILTER_ALL) ? 1 : 0, VTY_NEWLINE);
/* save filters outside of libosmocore, i.e. in app code */
if (osmo_log_info->save_fn)
osmo_log_info->save_fn(vty, osmo_log_info, tgt);