libnm: add 390-subchannels property to NMDeviceEthernet

This commit is contained in:
Jiří Klimeš 2015-09-23 14:55:55 +02:00
parent 4219aa9a56
commit bbaca1b24e
3 changed files with 45 additions and 0 deletions

View file

@ -858,6 +858,7 @@ libnm_1_0_6 {
libnm_1_2_0 {
global:
nm_access_point_get_last_seen;
nm_device_ethernet_get_s390_subchannels;
nm_device_get_metered;
nm_device_get_nm_plugin_missing;
nm_device_set_managed;

View file

@ -42,6 +42,7 @@ typedef struct {
char *perm_hw_address;
guint32 speed;
gboolean carrier;
char **s390_subchannels;
} NMDeviceEthernetPrivate;
enum {
@ -50,6 +51,7 @@ enum {
PROP_PERM_HW_ADDRESS,
PROP_SPEED,
PROP_CARRIER,
PROP_S390_SUBCHANNELS,
LAST_PROP
};
@ -120,6 +122,25 @@ nm_device_ethernet_get_carrier (NMDeviceEthernet *device)
return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->carrier;
}
/**
* nm_device_ethernet_get_s390_subchannels:
* @device: a #NMDeviceEthernet
*
* Return the list of s390 subchannels if the device supports them.
*
* Returns: (transfer none) (element-type utf8): array of strings, each specifying
* one subchannel the s390 device uses to communicate to the host.
*
* Since: 1.2
**/
const char * const *
nm_device_ethernet_get_s390_subchannels (NMDeviceEthernet *device)
{
g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL);
return (const char * const *) NM_DEVICE_ETHERNET_GET_PRIVATE (device)->s390_subchannels;
}
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
@ -193,6 +214,7 @@ init_dbus (NMObject *object)
{ NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, &priv->perm_hw_address },
{ NM_DEVICE_ETHERNET_SPEED, &priv->speed },
{ NM_DEVICE_ETHERNET_CARRIER, &priv->carrier },
{ NM_DEVICE_ETHERNET_S390_SUBCHANNELS, &priv->s390_subchannels },
{ NULL },
};
@ -210,6 +232,7 @@ finalize (GObject *object)
g_free (priv->hw_address);
g_free (priv->perm_hw_address);
g_strfreev (priv->s390_subchannels);
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->finalize (object);
}
@ -221,6 +244,7 @@ get_property (GObject *object,
GParamSpec *pspec)
{
NMDeviceEthernet *device = NM_DEVICE_ETHERNET (object);
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
switch (prop_id) {
case PROP_HW_ADDRESS:
@ -235,6 +259,9 @@ get_property (GObject *object,
case PROP_CARRIER:
g_value_set_boolean (value, nm_device_ethernet_get_carrier (device));
break;
case PROP_S390_SUBCHANNELS:
g_value_set_boxed (value, priv->s390_subchannels);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -312,4 +339,18 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMDeviceEthernet:s390-subchannels:
*
* Identifies subchannels of this network device used for
* communication with z/VM or s390 host.
*
* Since: 1.2
**/
g_object_class_install_property
(object_class, PROP_S390_SUBCHANNELS,
g_param_spec_boxed (NM_DEVICE_ETHERNET_S390_SUBCHANNELS, "", "",
G_TYPE_STRV,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
}

View file

@ -41,6 +41,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS "perm-hw-address"
#define NM_DEVICE_ETHERNET_SPEED "speed"
#define NM_DEVICE_ETHERNET_CARRIER "carrier"
#define NM_DEVICE_ETHERNET_S390_SUBCHANNELS "s390-subchannels"
struct _NMDeviceEthernet {
NMDevice parent;
@ -59,6 +60,8 @@ const char * nm_device_ethernet_get_hw_address (NMDeviceEthernet *device);
const char * nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device);
guint32 nm_device_ethernet_get_speed (NMDeviceEthernet *device);
gboolean nm_device_ethernet_get_carrier (NMDeviceEthernet *device);
NM_AVAILABLE_IN_1_2
const char * const *nm_device_ethernet_get_s390_subchannels (NMDeviceEthernet *device);
G_END_DECLS