static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMSettingInfiniband *setting = NM_SETTING_INFINIBAND (object); switch (prop_id) { case PROP_MAC_ADDRESS: g_value_set_boxed (value, nm_setting_infiniband_get_mac_address (setting)); break; case PROP_MTU: g_value_set_uint (value, nm_setting_infiniband_get_mtu (setting)); break; case PROP_TRANSPORT_MODE: g_value_set_string (value, nm_setting_infiniband_get_transport_mode (setting)); break; case PROP_P_KEY: g_value_set_int (value, nm_setting_infiniband_get_p_key (setting)); break; case PROP_PARENT: g_value_set_string (value, nm_setting_infiniband_get_parent (setting)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static NMDevice * create_virtual_device_for_connection (NMDeviceFactory *factory, NMConnection *connection, NMDevice *parent, GError **error) { NMSettingInfiniband *s_infiniband; int p_key, parent_ifindex; const char *iface; if (!nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) return NULL; g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (parent), NULL); s_infiniband = nm_connection_get_setting_infiniband (connection); iface = nm_setting_infiniband_get_virtual_interface_name (s_infiniband); g_return_val_if_fail (iface != NULL, NULL); parent_ifindex = nm_device_get_ifindex (parent); p_key = nm_setting_infiniband_get_p_key (s_infiniband); if ( !nm_platform_infiniband_partition_add (parent_ifindex, p_key) && nm_platform_get_error () != NM_PLATFORM_ERROR_EXISTS) { nm_log_warn (LOGD_DEVICE | LOGD_INFINIBAND, "(%s): failed to add InfiniBand P_Key interface for '%s': %s", iface, nm_connection_get_id (connection), nm_platform_get_error_msg ()); return NULL; } return (NMDevice *) g_object_new (NM_TYPE_DEVICE_INFINIBAND, NM_DEVICE_IFACE, iface, NM_DEVICE_DRIVER, nm_device_get_driver (parent), NM_DEVICE_TYPE_DESC, "InfiniBand", NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_INFINIBAND, NULL); }