Move e1d_find_intf + e1_intf_find_line to intf_line.c

Those are generic helper functions not really related to the ctl
interface.

Change-Id: Ibbda172aa425ca1e4702bacc7e595cd73a52929d
This commit is contained in:
Harald Welte 2020-12-18 17:24:40 +01:00
parent 1923b4d832
commit e07bbb5037
3 changed files with 31 additions and 24 deletions

View File

@ -42,30 +42,6 @@
#include "log.h"
struct e1_intf *
e1d_find_intf(struct e1_daemon *e1d, uint8_t id)
{
struct e1_intf *intf;
llist_for_each_entry(intf, &e1d->interfaces, list)
if (intf->id == id)
return intf;
return NULL;
}
struct e1_line *
e1_intf_find_line(struct e1_intf *intf, uint8_t id)
{
struct e1_line *line;
llist_for_each_entry(line, &intf->lines, list)
if (line->id == id)
return line;
return NULL;
}
static struct e1_ts *
_e1d_get_ts(struct e1_line *line, uint8_t ts)
{

View File

@ -124,6 +124,13 @@ struct e1_daemon {
struct llist_head interfaces;
};
struct e1_line *
e1_intf_find_line(struct e1_intf *intf, uint8_t id);
struct e1_line *
e1_intf_find_line(struct e1_intf *intf, uint8_t id);
struct e1_intf *
e1_intf_new(struct e1_daemon *e1d, void *drv_data);

View File

@ -66,6 +66,30 @@ static const struct rate_ctr_group_desc line_ctrg_desc = {
// e1d structures
// ---------------------------------------------------------------------------
struct e1_intf *
e1d_find_intf(struct e1_daemon *e1d, uint8_t id)
{
struct e1_intf *intf;
llist_for_each_entry(intf, &e1d->interfaces, list)
if (intf->id == id)
return intf;
return NULL;
}
struct e1_line *
e1_intf_find_line(struct e1_intf *intf, uint8_t id)
{
struct e1_line *line;
llist_for_each_entry(line, &intf->lines, list)
if (line->id == id)
return line;
return NULL;
}
struct e1_intf *
e1_intf_new(struct e1_daemon *e1d, void *drv_data)
{