network: make several functions static
This commit is contained in:
parent
454c87b5d5
commit
4736035aaa
|
@ -15,7 +15,33 @@
|
|||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int nexthop_new(NextHop **ret) {
|
||||
void nexthop_free(NextHop *nexthop) {
|
||||
if (!nexthop)
|
||||
return;
|
||||
|
||||
if (nexthop->network) {
|
||||
LIST_REMOVE(nexthops, nexthop->network->static_nexthops, nexthop);
|
||||
|
||||
assert(nexthop->network->n_static_nexthops > 0);
|
||||
nexthop->network->n_static_nexthops--;
|
||||
|
||||
if (nexthop->section)
|
||||
hashmap_remove(nexthop->network->nexthops_by_section, nexthop->section);
|
||||
}
|
||||
|
||||
network_config_section_free(nexthop->section);
|
||||
|
||||
if (nexthop->link) {
|
||||
set_remove(nexthop->link->nexthops, nexthop);
|
||||
set_remove(nexthop->link->nexthops_foreign, nexthop);
|
||||
}
|
||||
|
||||
free(nexthop);
|
||||
}
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free);
|
||||
|
||||
static int nexthop_new(NextHop **ret) {
|
||||
_cleanup_(nexthop_freep) NextHop *nexthop = NULL;
|
||||
|
||||
nexthop = new(NextHop, 1);
|
||||
|
@ -79,30 +105,6 @@ static int nexthop_new_static(Network *network, const char *filename, unsigned s
|
|||
return 0;
|
||||
}
|
||||
|
||||
void nexthop_free(NextHop *nexthop) {
|
||||
if (!nexthop)
|
||||
return;
|
||||
|
||||
if (nexthop->network) {
|
||||
LIST_REMOVE(nexthops, nexthop->network->static_nexthops, nexthop);
|
||||
|
||||
assert(nexthop->network->n_static_nexthops > 0);
|
||||
nexthop->network->n_static_nexthops--;
|
||||
|
||||
if (nexthop->section)
|
||||
hashmap_remove(nexthop->network->nexthops_by_section, nexthop->section);
|
||||
}
|
||||
|
||||
network_config_section_free(nexthop->section);
|
||||
|
||||
if (nexthop->link) {
|
||||
set_remove(nexthop->link->nexthops, nexthop);
|
||||
set_remove(nexthop->link->nexthops_foreign, nexthop);
|
||||
}
|
||||
|
||||
free(nexthop);
|
||||
}
|
||||
|
||||
static void nexthop_hash_func(const NextHop *nexthop, struct siphash *state) {
|
||||
assert(nexthop);
|
||||
|
||||
|
@ -169,7 +171,7 @@ bool nexthop_equal(NextHop *r1, NextHop *r2) {
|
|||
return nexthop_compare_func(r1, r2) == 0;
|
||||
}
|
||||
|
||||
int nexthop_get(Link *link, NextHop *in, NextHop **ret) {
|
||||
static int nexthop_get(Link *link, NextHop *in, NextHop **ret) {
|
||||
NextHop *existing;
|
||||
|
||||
assert(link);
|
||||
|
@ -225,11 +227,11 @@ static int nexthop_add_internal(Link *link, Set **nexthops, NextHop *in, NextHop
|
|||
return 0;
|
||||
}
|
||||
|
||||
int nexthop_add_foreign(Link *link, NextHop *in, NextHop **ret) {
|
||||
static int nexthop_add_foreign(Link *link, NextHop *in, NextHop **ret) {
|
||||
return nexthop_add_internal(link, &link->nexthops_foreign, in, ret);
|
||||
}
|
||||
|
||||
int nexthop_add(Link *link, NextHop *in, NextHop **ret) {
|
||||
static int nexthop_add(Link *link, NextHop *in, NextHop **ret) {
|
||||
NextHop *nexthop;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@ struct NextHop {
|
|||
LIST_FIELDS(NextHop, nexthops);
|
||||
};
|
||||
|
||||
extern const struct hash_ops nexthop_hash_ops;
|
||||
|
||||
int nexthop_new(NextHop **ret);
|
||||
void nexthop_free(NextHop *nexthop);
|
||||
int nexthop_remove(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);
|
||||
|
||||
|
@ -40,14 +37,9 @@ int link_set_nexthop(Link *link);
|
|||
|
||||
int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
|
||||
|
||||
int nexthop_get(Link *link, NextHop *in, NextHop **ret);
|
||||
int nexthop_add(Link *link, NextHop *in, NextHop **ret);
|
||||
int nexthop_add_foreign(Link *link, NextHop *in, NextHop **ret);
|
||||
bool nexthop_equal(NextHop *r1, NextHop *r2);
|
||||
|
||||
int nexthop_section_verify(NextHop *nexthop);
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);
|
||||
|
|
Loading…
Reference in a new issue