mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 00:30:09 +01:00
platform: move special link-add functions to header
These are thin abstractions over nm_platform_link_add(). Move them to the header.
This commit is contained in:
parent
4a743aba65
commit
9763d9f8a9
2 changed files with 60 additions and 91 deletions
|
|
@ -1167,7 +1167,7 @@ _link_add_check_existing (NMPlatform *self, const char *name, NMLinkType type, c
|
|||
*
|
||||
* Returns: the negative nm-error on failure.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
nm_platform_link_add (NMPlatform *self,
|
||||
NMLinkType type,
|
||||
const char *name,
|
||||
|
|
@ -1217,31 +1217,6 @@ nm_platform_link_add (NMPlatform *self,
|
|||
return klass->link_add (self, type, name, address, address_len, extra_data, out_link);
|
||||
}
|
||||
|
||||
int
|
||||
nm_platform_link_veth_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const char *peer,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_VETH, name, NULL, 0, peer, out_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_link_dummy_add:
|
||||
* @self: platform instance
|
||||
* @name: New interface name
|
||||
* @out_link: on success, the link object
|
||||
*
|
||||
* Create a software ethernet-like interface
|
||||
*/
|
||||
int
|
||||
nm_platform_link_dummy_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_DUMMY, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_link_delete:
|
||||
* @self: platform instance
|
||||
|
|
@ -2262,14 +2237,6 @@ NM_UTILS_FLAGS2STR_DEFINE_STATIC (_wireguard_change_peer_flags_to_string, NMPlat
|
|||
NM_UTILS_FLAGS2STR (NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_REPLACE_ALLOWEDIPS, "remove-aips"),
|
||||
);
|
||||
|
||||
int
|
||||
nm_platform_link_wireguard_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_WIREGUARD, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
int
|
||||
nm_platform_link_wireguard_change (NMPlatform *self,
|
||||
int ifindex,
|
||||
|
|
@ -2328,58 +2295,6 @@ nm_platform_link_wireguard_change (NMPlatform *self,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_platform_link_bridge_add:
|
||||
* @self: platform instance
|
||||
* @name: New interface name
|
||||
* @address: (allow-none): set the mac address of the new bridge
|
||||
* @address_len: the length of the @address
|
||||
* @out_link: on success, the link object
|
||||
*
|
||||
* Create a software bridge.
|
||||
*/
|
||||
int
|
||||
nm_platform_link_bridge_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const void *address,
|
||||
size_t address_len,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_BRIDGE, name, address, address_len, NULL, out_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_link_bond_add:
|
||||
* @self: platform instance
|
||||
* @name: New interface name
|
||||
* @out_link: on success, the link object
|
||||
*
|
||||
* Create a software bonding device.
|
||||
*/
|
||||
int
|
||||
nm_platform_link_bond_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_BOND, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_link_team_add:
|
||||
* @self: platform instance
|
||||
* @name: New interface name
|
||||
* @out_link: on success, the link object
|
||||
*
|
||||
* Create a software teaming device.
|
||||
*/
|
||||
int
|
||||
nm_platform_link_team_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_TEAM, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_link_vlan_add:
|
||||
* @self: platform instance
|
||||
|
|
|
|||
|
|
@ -1363,11 +1363,65 @@ const NMPlatformLink *nm_platform_link_get_by_ifname (NMPlatform *self, const ch
|
|||
const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, NMLinkType link_type, gconstpointer address, size_t length);
|
||||
|
||||
GPtrArray *nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name);
|
||||
int nm_platform_link_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
|
||||
int nm_platform_link_bridge_add (NMPlatform *self, const char *name, const void *address, size_t address_len, const NMPlatformLink **out_link);
|
||||
int nm_platform_link_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
|
||||
int nm_platform_link_team_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
|
||||
int nm_platform_link_veth_add (NMPlatform *self, const char *name, const char *peer, const NMPlatformLink **out_link);
|
||||
|
||||
int nm_platform_link_add (NMPlatform *self,
|
||||
NMLinkType type,
|
||||
const char *name,
|
||||
const void *address,
|
||||
size_t address_len,
|
||||
gconstpointer extra_data,
|
||||
const NMPlatformLink **out_link);
|
||||
|
||||
static inline int
|
||||
nm_platform_link_veth_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const char *peer,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_VETH, name, NULL, 0, peer, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_dummy_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_DUMMY, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_bridge_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const void *address,
|
||||
size_t address_len,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_BRIDGE, name, address, address_len, NULL, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_bond_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_BOND, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_team_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_TEAM, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_wireguard_add (NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add (self, NM_LINK_TYPE_WIREGUARD, name, NULL, 0, NULL, out_link);
|
||||
}
|
||||
|
||||
gboolean nm_platform_link_delete (NMPlatform *self, int ifindex);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue