transaction: accept trans_type enum in trans_log_subsys()

Change-Id: I3c373d20ebd6e96ebd57f84b74dc15a6b69c03ac
This commit is contained in:
Vadim Yanitskiy 2019-05-11 02:17:16 +07:00 committed by Harald Welte
parent a3cdab4481
commit b683dcfe6b
2 changed files with 6 additions and 7 deletions

View File

@ -159,11 +159,9 @@ int trans_assign_trans_id(const struct gsm_network *net, const struct vlr_subscr
struct gsm_trans *trans_has_conn(const struct msc_a *msc_a);
void trans_conn_closed(const struct msc_a *msc_a);
static inline int trans_log_subsys(const struct gsm_trans *trans)
static inline int trans_log_subsys(enum trans_type type)
{
if (!trans)
return DMSC;
switch (trans->type) {
switch (type) {
case TRANS_CC:
case TRANS_SILENT_CALL:
return DCC;

View File

@ -127,11 +127,12 @@ struct gsm_trans *trans_alloc(struct gsm_network *net,
enum trans_type type, uint8_t trans_id,
uint32_t callref)
{
struct gsm_trans *trans = NULL; /* (NULL for LOG_TRANS() before allocation) */
int subsys = trans_log_subsys(type);
struct gsm_trans *trans;
/* a valid subscriber is indispensable */
if (vsub == NULL) {
LOG_TRANS(trans, LOGL_ERROR, "unable to alloc transaction, invalid subscriber (NULL)\n");
LOGP(subsys, LOGL_ERROR, "unable to alloc transaction, invalid subscriber (NULL)\n");
return NULL;
}
@ -142,11 +143,11 @@ struct gsm_trans *trans_alloc(struct gsm_network *net,
*trans = (struct gsm_trans){
.vsub = vsub,
.type = type,
.log_subsys = subsys,
.transaction_id = trans_id,
.callref = callref,
.net = net,
};
trans->log_subsys = trans_log_subsys(trans);
vlr_subscr_get(vsub, trans_vsub_use(type));
llist_add_tail(&trans->entry, &net->trans_list);