Skip to content

Commit 29d9672

Browse files
committed
network/radv: rename pref64Prefix -> Prefix64
Also this made several coding style cleanups.
1 parent 30eab38 commit 29d9672

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

src/network/networkd-network.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ static Network *network_free(Network *network) {
795795
hashmap_free_with_destructor(network->address_labels_by_section, address_label_free);
796796
hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
797797
hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
798-
hashmap_free_with_destructor(network->pref64_prefixes_by_section, pref64_prefix_free);
798+
hashmap_free_with_destructor(network->pref64_prefixes_by_section, prefix64_free);
799799
hashmap_free_with_destructor(network->rules_by_section, routing_policy_rule_free);
800800
hashmap_free_with_destructor(network->dhcp_static_leases_by_section, dhcp_static_lease_free);
801801
ordered_hashmap_free_with_destructor(network->sr_iov_by_section, sr_iov_free);

src/network/networkd-radv.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool link_radv_enabled(Link *link) {
3535
return link->network->router_prefix_delegation;
3636
}
3737

38-
Prefix *prefix_free(Prefix *prefix) {
38+
Prefix* prefix_free(Prefix *prefix) {
3939
if (!prefix)
4040
return NULL;
4141

@@ -93,7 +93,7 @@ static int prefix_new_static(Network *network, const char *filename, unsigned se
9393
return 0;
9494
}
9595

96-
RoutePrefix *route_prefix_free(RoutePrefix *prefix) {
96+
RoutePrefix* route_prefix_free(RoutePrefix *prefix) {
9797
if (!prefix)
9898
return NULL;
9999

@@ -148,7 +148,7 @@ static int route_prefix_new_static(Network *network, const char *filename, unsig
148148
return 0;
149149
}
150150

151-
pref64Prefix *pref64_prefix_free(pref64Prefix *prefix) {
151+
Prefix64* prefix64_free(Prefix64 *prefix) {
152152
if (!prefix)
153153
return NULL;
154154

@@ -162,11 +162,11 @@ pref64Prefix *pref64_prefix_free(pref64Prefix *prefix) {
162162
return mfree(prefix);
163163
}
164164

165-
DEFINE_SECTION_CLEANUP_FUNCTIONS(pref64Prefix, pref64_prefix_free);
165+
DEFINE_SECTION_CLEANUP_FUNCTIONS(Prefix64, prefix64_free);
166166

167-
static int pref64_prefix_new_static(Network *network, const char *filename, unsigned section_line, pref64Prefix **ret) {
167+
static int prefix64_new_static(Network *network, const char *filename, unsigned section_line, Prefix64 **ret) {
168168
_cleanup_(config_section_freep) ConfigSection *n = NULL;
169-
_cleanup_(pref64_prefix_freep) pref64Prefix *prefix = NULL;
169+
_cleanup_(prefix64_freep) Prefix64 *prefix = NULL;
170170
int r;
171171

172172
assert(network);
@@ -184,11 +184,11 @@ static int pref64_prefix_new_static(Network *network, const char *filename, unsi
184184
return 0;
185185
}
186186

187-
prefix = new(pref64Prefix, 1);
187+
prefix = new(Prefix64, 1);
188188
if (!prefix)
189189
return -ENOMEM;
190190

191-
*prefix = (pref64Prefix) {
191+
*prefix = (Prefix64) {
192192
.network = network,
193193
.section = TAKE_PTR(n),
194194

@@ -331,7 +331,7 @@ static int radv_set_route_prefix(Link *link, RoutePrefix *prefix) {
331331
return sd_radv_add_route_prefix(link->radv, p);
332332
}
333333

334-
static int radv_set_pref64_prefix(Link *link, pref64Prefix *prefix) {
334+
static int radv_set_pref64_prefix(Link *link, Prefix64 *prefix) {
335335
_cleanup_(sd_radv_pref64_prefix_unrefp) sd_radv_pref64_prefix *p = NULL;
336336
int r;
337337

@@ -496,9 +496,6 @@ static int radv_find_uplink(Link *link, Link **ret) {
496496

497497
static int radv_configure(Link *link) {
498498
Link *uplink = NULL;
499-
RoutePrefix *q;
500-
pref64Prefix *n;
501-
Prefix *p;
502499
int r;
503500

504501
assert(link);
@@ -553,18 +550,21 @@ static int radv_configure(Link *link) {
553550
if (r < 0)
554551
return r;
555552

553+
Prefix *p;
556554
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
557555
r = radv_set_prefix(link, p);
558556
if (r < 0 && r != -EEXIST)
559557
return r;
560558
}
561559

560+
RoutePrefix *q;
562561
HASHMAP_FOREACH(q, link->network->route_prefixes_by_section) {
563562
r = radv_set_route_prefix(link, q);
564563
if (r < 0 && r != -EEXIST)
565564
return r;
566565
}
567566

567+
Prefix64 *n;
568568
HASHMAP_FOREACH(n, link->network->pref64_prefixes_by_section) {
569569
r = radv_set_pref64_prefix(link, n);
570570
if (r < 0 && r != -EEXIST)
@@ -855,7 +855,7 @@ void network_adjust_radv(Network *network) {
855855
if (!FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_STATIC)) {
856856
network->prefixes_by_section = hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
857857
network->route_prefixes_by_section = hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
858-
network->pref64_prefixes_by_section = hashmap_free_with_destructor(network->pref64_prefixes_by_section, pref64_prefix_free);
858+
network->pref64_prefixes_by_section = hashmap_free_with_destructor(network->pref64_prefixes_by_section, prefix64_free);
859859
}
860860

861861
if (!network->router_prefix_delegation)
@@ -883,10 +883,10 @@ void network_adjust_radv(Network *network) {
883883
if (route_prefix_section_verify(route) < 0)
884884
route_prefix_free(route);
885885

886-
pref64Prefix *pref64;
886+
Prefix64 *pref64;
887887
HASHMAP_FOREACH(pref64, network->pref64_prefixes_by_section)
888888
if (section_is_invalid(pref64->section))
889-
pref64_prefix_free(pref64);
889+
prefix64_free(pref64);
890890
}
891891

892892
int config_parse_prefix(
@@ -1190,7 +1190,7 @@ int config_parse_pref64_prefix(
11901190
void *data,
11911191
void *userdata) {
11921192

1193-
_cleanup_(pref64_prefix_free_or_set_invalidp) pref64Prefix *p = NULL;
1193+
_cleanup_(prefix64_free_or_set_invalidp) Prefix64 *p = NULL;
11941194
Network *network = ASSERT_PTR(userdata);
11951195
union in_addr_union a;
11961196
uint8_t prefixlen;
@@ -1201,7 +1201,7 @@ int config_parse_pref64_prefix(
12011201
assert(lvalue);
12021202
assert(rvalue);
12031203

1204-
r = pref64_prefix_new_static(network, filename, section_line, &p);
1204+
r = prefix64_new_static(network, filename, section_line, &p);
12051205
if (r < 0)
12061206
return log_oom();
12071207

@@ -1238,7 +1238,7 @@ int config_parse_pref64_prefix_lifetime(
12381238
void *data,
12391239
void *userdata) {
12401240

1241-
_cleanup_(pref64_prefix_free_or_set_invalidp) pref64Prefix *p = NULL;
1241+
_cleanup_(prefix64_free_or_set_invalidp) Prefix64 *p = NULL;
12421242
Network *network = ASSERT_PTR(userdata);
12431243
usec_t usec;
12441244
int r;
@@ -1248,7 +1248,7 @@ int config_parse_pref64_prefix_lifetime(
12481248
assert(lvalue);
12491249
assert(rvalue);
12501250

1251-
r = pref64_prefix_new_static(network, filename, section_line, &p);
1251+
r = prefix64_new_static(network, filename, section_line, &p);
12521252
if (r < 0)
12531253
return log_oom();
12541254

src/network/networkd-radv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ typedef struct RoutePrefix {
5050
usec_t lifetime;
5151
} RoutePrefix;
5252

53-
typedef struct pref64Prefix {
53+
typedef struct Prefix64 {
5454
Network *network;
5555
ConfigSection *section;
5656

5757
struct in6_addr prefix;
5858
uint8_t prefixlen;
5959
usec_t lifetime;
60-
} pref64Prefix;
60+
} Prefix64;
6161

62-
Prefix *prefix_free(Prefix *prefix);
63-
RoutePrefix *route_prefix_free(RoutePrefix *prefix);
64-
pref64Prefix *pref64_prefix_free(pref64Prefix *prefix);
62+
Prefix* prefix_free(Prefix *prefix);
63+
RoutePrefix* route_prefix_free(RoutePrefix *prefix);
64+
Prefix64* prefix64_free(Prefix64 *prefix);
6565

6666
void network_adjust_radv(Network *network);
6767

0 commit comments

Comments
 (0)