diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-31 14:19:40 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-01-09 10:42:32 +0100 |
commit | cb4093fc8fb739d4627b83ad514254080ec6c2e0 (patch) | |
tree | a0e00475ad70d5e87ed20ae07195757c7f55e402 | |
parent | f30ae566087cd3434eb9e32447325142677f33f5 (diff) | |
download | NetworkManager-cb4093fc8fb739d4627b83ad514254080ec6c2e0.tar.gz |
platform: drop NMPlatformLnkMacvtap typedef
In several cases, the layer 2 and layer 3 type are very similar, also from
kernel's point of view. For example, "gre"/"gretap" and "ip6tnl"/"ip6gre"/"ip6gretap"
and "macvlan"/"macvtap".
While it makes sense that these have different NMLinkType types
(NM_LINK_TYPE_MACV{LAN,TAP}) and different NMPObject types
(NMPObjectLnkMacv{lan,tap}), it makes less sense that they have
different NMPlatformLnk* structs.
Remove the NMPlatformLnkMacvtap typedef. A typedef does not make things simpler,
but is rather confusing. Because several API that we would usually have, does
not exist for the typedef (e.g. there is no nm_platform_lnk_macvtap_to_string()).
Note that we also don't have such a typedef for NMPlatformLnkIp6Tnl
and NMPlatformLnkGre, which has the same ambiguity between the link type
and the struct with the data.
-rw-r--r-- | src/platform/nm-platform.c | 2 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 4 | ||||
-rw-r--r-- | src/platform/nmp-object.c | 2 | ||||
-rw-r--r-- | src/platform/tests/test-link.c | 4 |
4 files changed, 5 insertions, 7 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 3d6376b4f7..fbb5e7e2fa 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2228,7 +2228,7 @@ nm_platform_link_get_lnk_macvlan (NMPlatform *self, int ifindex, const NMPlatfor return _link_get_lnk (self, ifindex, NM_LINK_TYPE_MACVLAN, out_link); } -const NMPlatformLnkMacvtap * +const NMPlatformLnkMacvlan * nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link) { return _link_get_lnk (self, ifindex, NM_LINK_TYPE_MACVTAP, out_link); diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index b3243bbd9d..f2632a1fd0 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -795,8 +795,6 @@ typedef struct { bool tap:1; } NMPlatformLnkMacvlan; -typedef NMPlatformLnkMacvlan NMPlatformLnkMacvtap; - typedef struct { in_addr_t local; in_addr_t remote; @@ -1617,7 +1615,7 @@ const NMPlatformLnkInfiniband *nm_platform_link_get_lnk_infiniband (NMPlatform * const NMPlatformLnkIpIp *nm_platform_link_get_lnk_ipip (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkMacsec *nm_platform_link_get_lnk_macsec (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkMacvlan *nm_platform_link_get_lnk_macvlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); -const NMPlatformLnkMacvtap *nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); +const NMPlatformLnkMacvlan *nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkSit *nm_platform_link_get_lnk_sit (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkTun *nm_platform_link_get_lnk_tun (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkVlan *nm_platform_link_get_lnk_vlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index 97aa4f28f5..240c1e7d8a 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -3291,7 +3291,7 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = { .parent = DEDUP_MULTI_OBJ_CLASS_INIT(), .obj_type = NMP_OBJECT_TYPE_LNK_MACVTAP, .sizeof_data = sizeof (NMPObjectLnkMacvtap), - .sizeof_public = sizeof (NMPlatformLnkMacvtap), + .sizeof_public = sizeof (NMPlatformLnkMacvlan), .obj_type_name = "macvtap", .lnk_link_type = NM_LINK_TYPE_MACVTAP, .cmd_plobj_to_string = (const char *(*) (const NMPlatformObject *obj, char *buf, gsize len)) nm_platform_lnk_macvlan_to_string, diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 0e166a5f7f..4a54af2a19 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -1144,7 +1144,7 @@ test_software_detect (gconstpointer user_data) break; } case NM_LINK_TYPE_MACVTAP: { - NMPlatformLnkMacvtap lnk_macvtap = { }; + NMPlatformLnkMacvlan lnk_macvtap = { }; lnk_macvtap.mode = MACVLAN_MODE_PRIVATE; lnk_macvtap.no_promisc = FALSE; @@ -1389,7 +1389,7 @@ test_software_detect (gconstpointer user_data) break; } case NM_LINK_TYPE_MACVTAP: { - const NMPlatformLnkMacvtap *plnk = &lnk->lnk_macvlan; + const NMPlatformLnkMacvlan *plnk = &lnk->lnk_macvlan; g_assert (plnk == nm_platform_link_get_lnk_macvtap (NM_PLATFORM_GET, ifindex, NULL)); g_assert_cmpint (plnk->no_promisc, ==, FALSE); |