From d60b21cc6b3fd43897e97789423a94095dda0f18 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 5 May 2021 14:12:16 +0000 Subject: log: show src file,line of lchan_set_last_error Change lchan_set_last_error() to macro so that the error log reflects where the error was encountered. Change-Id: I571fdf2d418c52d120215cf19e57a3c96d67af07 --- include/osmocom/bsc/lchan_fsm.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/osmocom') diff --git a/include/osmocom/bsc/lchan_fsm.h b/include/osmocom/bsc/lchan_fsm.h index ded7f5481..2d5307a23 100644 --- a/include/osmocom/bsc/lchan_fsm.h +++ b/include/osmocom/bsc/lchan_fsm.h @@ -12,6 +12,13 @@ LOGP(DRSL, level, "%s (not initialized) " fmt, gsm_lchan_name(lchan), ## args); \ } while(0) +#define LCHAN_SET_LAST_ERROR(LCHAN, fmt, args...) do { \ + if ((LCHAN)->last_error) \ + talloc_free((LCHAN)->last_error); \ + (LCHAN)->last_error = talloc_asprintf((LCHAN)->ts->trx, fmt, ##args); \ + LOG_LCHAN(LCHAN, LOGL_ERROR, "%s\n", (LCHAN)->last_error); \ + } while(0) + enum lchan_fsm_state { LCHAN_ST_UNUSED, LCHAN_ST_CBCH, /*< Blocked by CBCH channel combination, not usable as SDCCH. */ @@ -74,6 +81,4 @@ bool lchan_may_receive_data(struct gsm_lchan *lchan); void lchan_forget_conn(struct gsm_lchan *lchan); -void lchan_set_last_error(struct gsm_lchan *lchan, const char *fmt, ...); - void lchan_fsm_skip_error(struct gsm_lchan *lchan); -- cgit v1.2.3