network: rename NetworkConfigSection -> ConfigSection
And move it and relevant functions to conf-parser.[ch].
This commit is contained in:
@@ -77,7 +77,7 @@ static int qdisc_new(QDiscKind kind, QDisc **ret) {
|
||||
}
|
||||
|
||||
int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, unsigned section_line, QDisc **ret) {
|
||||
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
||||
_cleanup_(config_section_freep) ConfigSection *n = NULL;
|
||||
_cleanup_(qdisc_freep) QDisc *qdisc = NULL;
|
||||
TrafficControl *existing;
|
||||
QDisc *q = NULL;
|
||||
@@ -88,7 +88,7 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||
assert(filename);
|
||||
assert(section_line > 0);
|
||||
|
||||
r = network_config_section_new(filename, section_line, &n);
|
||||
r = config_section_new(filename, section_line, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -126,7 +126,7 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||
qdisc->network = network;
|
||||
qdisc->section = TAKE_PTR(n);
|
||||
|
||||
r = ordered_hashmap_ensure_put(&network->tc_by_section, &network_config_hash_ops, qdisc->section, TC(qdisc));
|
||||
r = ordered_hashmap_ensure_put(&network->tc_by_section, &config_section_hash_ops, qdisc->section, TC(qdisc));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -141,7 +141,7 @@ QDisc* qdisc_free(QDisc *qdisc) {
|
||||
if (qdisc->network && qdisc->section)
|
||||
ordered_hashmap_remove(qdisc->network->tc_by_section, qdisc->section);
|
||||
|
||||
network_config_section_free(qdisc->section);
|
||||
config_section_free(qdisc->section);
|
||||
|
||||
free(qdisc->tca_kind);
|
||||
return mfree(qdisc);
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef enum QDiscKind {
|
||||
typedef struct QDisc {
|
||||
TrafficControl meta;
|
||||
|
||||
NetworkConfigSection *section;
|
||||
ConfigSection *section;
|
||||
Network *network;
|
||||
|
||||
int family;
|
||||
@@ -80,7 +80,7 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||
int qdisc_configure(Link *link, QDisc *qdisc);
|
||||
int qdisc_section_verify(QDisc *qdisc, bool *has_root, bool *has_clsact);
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(QDisc, qdisc_free);
|
||||
DEFINE_SECTION_CLEANUP_FUNCTIONS(QDisc, qdisc_free);
|
||||
|
||||
DEFINE_TC_CAST(QDISC, QDisc);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static int tclass_new(TClassKind kind, TClass **ret) {
|
||||
}
|
||||
|
||||
int tclass_new_static(TClassKind kind, Network *network, const char *filename, unsigned section_line, TClass **ret) {
|
||||
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
||||
_cleanup_(config_section_freep) ConfigSection *n = NULL;
|
||||
_cleanup_(tclass_freep) TClass *tclass = NULL;
|
||||
TrafficControl *existing;
|
||||
int r;
|
||||
@@ -55,7 +55,7 @@ int tclass_new_static(TClassKind kind, Network *network, const char *filename, u
|
||||
assert(filename);
|
||||
assert(section_line > 0);
|
||||
|
||||
r = network_config_section_new(filename, section_line, &n);
|
||||
r = config_section_new(filename, section_line, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -82,7 +82,7 @@ int tclass_new_static(TClassKind kind, Network *network, const char *filename, u
|
||||
tclass->network = network;
|
||||
tclass->section = TAKE_PTR(n);
|
||||
|
||||
r = ordered_hashmap_ensure_put(&network->tc_by_section, &network_config_hash_ops, tclass->section, tclass);
|
||||
r = ordered_hashmap_ensure_put(&network->tc_by_section, &config_section_hash_ops, tclass->section, tclass);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -97,7 +97,7 @@ TClass* tclass_free(TClass *tclass) {
|
||||
if (tclass->network && tclass->section)
|
||||
ordered_hashmap_remove(tclass->network->tc_by_section, tclass->section);
|
||||
|
||||
network_config_section_free(tclass->section);
|
||||
config_section_free(tclass->section);
|
||||
|
||||
return mfree(tclass);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef enum TClassKind {
|
||||
typedef struct TClass {
|
||||
TrafficControl meta;
|
||||
|
||||
NetworkConfigSection *section;
|
||||
ConfigSection *section;
|
||||
Network *network;
|
||||
|
||||
uint32_t classid;
|
||||
@@ -59,7 +59,7 @@ int tclass_new_static(TClassKind kind, Network *network, const char *filename, u
|
||||
int tclass_configure(Link *link, TClass *tclass);
|
||||
int tclass_section_verify(TClass *tclass);
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(TClass, tclass_free);
|
||||
DEFINE_SECTION_CLEANUP_FUNCTIONS(TClass, tclass_free);
|
||||
|
||||
DEFINE_TC_CAST(TCLASS, TClass);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user