summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-09-23 14:55:55 +0200
committerJiří Klimeš <jklimes@redhat.com>2015-09-29 09:31:25 +0200
commitbbaca1b24e73c4d680dadf4f041cf06d59e0d680 (patch)
tree54abef2bec228fff54dd8941f7c9d44d9da02065
parent4219aa9a56bfbf047a2a05a34e552a297e074b2f (diff)
downloadNetworkManager-bbaca1b24e73c4d680dadf4f041cf06d59e0d680.tar.gz
libnm: add 390-subchannels property to NMDeviceEthernet
-rw-r--r--libnm/libnm.ver1
-rw-r--r--libnm/nm-device-ethernet.c41
-rw-r--r--libnm/nm-device-ethernet.h3
3 files changed, 45 insertions, 0 deletions
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 6551bc3863..c04bfacf8d 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -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;
diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c
index b0f710f8a2..a98f9588c9 100644
--- a/libnm/nm-device-ethernet.c
+++ b/libnm/nm-device-ethernet.c
@@ -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));
}
diff --git a/libnm/nm-device-ethernet.h b/libnm/nm-device-ethernet.h
index 09286e73a7..07cf4c4de6 100644
--- a/libnm/nm-device-ethernet.h
+++ b/libnm/nm-device-ethernet.h
@@ -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