libnm: introduce the new get_ports() in bridge/bond API

This patch is introducing get_ports() in bridge and bond API. In
addition, the existing get_slaves() functions are being marked as
deprecated.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/878
This commit is contained in:
Fernando Fernandez Mancera 2021-06-01 18:34:16 +02:00 committed by Thomas Haller
parent 8327312c51
commit 754143f4e8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
5 changed files with 54 additions and 2 deletions

View file

@ -1787,6 +1787,8 @@ global:
libnm_1_32_0 {
global:
nm_device_bond_get_ports;
nm_device_bridge_get_ports;
nm_ethtool_optname_is_pause;
nm_setting_match_new;
nm_setting_wired_get_accept_all_mac_addresses;

View file

@ -83,9 +83,29 @@ nm_device_bond_get_carrier(NMDeviceBond *device)
* Returns: (element-type NMDevice): the #GPtrArray containing
* #NMDevices that are slaves of @device. This is the internal
* copy used by the device, and must not be modified.
*
* Deprecated: 1.32: Use nm_device_bond_get_ports().
**/
const GPtrArray *
nm_device_bond_get_slaves(NMDeviceBond *device)
{
return nm_device_bond_get_ports(device);
}
/**
* nm_device_bond_get_ports:
* @device: a #NMDeviceBond
*
* Gets the devices currently set as port of @device.
*
* Returns: (element-type NMDevice): the #GPtrArray containing
* #NMDevices that are ports of @device. This is the internal
* copy used by the device, and must not be modified.
*
* Since: 1.32
**/
const GPtrArray *
nm_device_bond_get_ports(NMDeviceBond *device)
{
g_return_val_if_fail(NM_IS_DEVICE_BOND(device), FALSE);

View file

@ -82,9 +82,29 @@ nm_device_bridge_get_carrier(NMDeviceBridge *device)
* Returns: (element-type NMDevice): the #GPtrArray containing
* #NMDevices that are slaves of @device. This is the internal
* copy used by the device, and must not be modified.
*
* Deprecated: 1.32: Use nm_device_bridge_get_ports().
**/
const GPtrArray *
nm_device_bridge_get_slaves(NMDeviceBridge *device)
{
return nm_device_bridge_get_ports(device);
}
/**
* nm_device_bridge_get_ports:
* @device: a #NMDeviceBridge
*
* Gets the devices currently set as port of @device.
*
* Returns: (element-type NMDevice): the #GPtrArray containing
* #NMDevices that are ports of @device. This is the internal
* copy used by the device, and must not be modified.
*
* Since: 1.32
**/
const GPtrArray *
nm_device_bridge_get_ports(NMDeviceBridge *device)
{
g_return_val_if_fail(NM_IS_DEVICE_BRIDGE(device), FALSE);

View file

@ -37,7 +37,12 @@ GType nm_device_bond_get_type(void);
NM_DEPRECATED_IN_1_24_FOR(nm_device_get_hw_address)
const char *nm_device_bond_get_hw_address(NMDeviceBond *device);
gboolean nm_device_bond_get_carrier(NMDeviceBond *device);
gboolean nm_device_bond_get_carrier(NMDeviceBond *device);
NM_AVAILABLE_IN_1_32
const GPtrArray *nm_device_bond_get_ports(NMDeviceBond *device);
NM_DEPRECATED_IN_1_32_FOR(nm_device_get_ports)
const GPtrArray *nm_device_bond_get_slaves(NMDeviceBond *device);
G_END_DECLS

View file

@ -38,7 +38,12 @@ GType nm_device_bridge_get_type(void);
NM_DEPRECATED_IN_1_24_FOR(nm_device_get_hw_address)
const char *nm_device_bridge_get_hw_address(NMDeviceBridge *device);
gboolean nm_device_bridge_get_carrier(NMDeviceBridge *device);
gboolean nm_device_bridge_get_carrier(NMDeviceBridge *device);
NM_AVAILABLE_IN_1_32
const GPtrArray *nm_device_bridge_get_ports(NMDeviceBridge *device);
NM_DEPRECATED_IN_1_32_FOR(nm_device_bridge_get_ports)
const GPtrArray *nm_device_bridge_get_slaves(NMDeviceBridge *device);
G_END_DECLS