diff options
Diffstat (limited to 'libnm')
| -rw-r--r-- | libnm/nm-client.c | 16 | ||||
| -rw-r--r-- | libnm/nm-enum-types.c.template | 77 | ||||
| -rw-r--r-- | libnm/nm-enum-types.h.template | 23 | ||||
| -rw-r--r-- | libnm/nm-libnm-utils.c | 9 |
4 files changed, 119 insertions, 6 deletions
diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 2c775196..f1b25970 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -2930,11 +2930,15 @@ _dbus_handle_properties_changed(NMClient * self, gs_free char *ss = NULL; NML_NMCLIENT_LOG_T(self, - "[%s]: %s: properties changed for interface %s { %s }", + "[%s]: %s: properties changed for interface %s %s%s%s", object_path, log_context, interface_name, - (ss = g_variant_print(changed_properties, TRUE))); + NM_PRINT_FMT_QUOTED(changed_properties, + "{ ", + (ss = g_variant_print(changed_properties, TRUE)), + " }", + "(no changed properties)")); } if (inout_dbobj) { @@ -2946,12 +2950,16 @@ _dbus_handle_properties_changed(NMClient * self, dbobj = _dbobjs_dbobj_get_r(self, dbus_path); } - if (dbobj) + if (dbobj) { + nm_assert(dbobj->obj_state >= NML_DBUS_OBJ_STATE_WATCHED_ONLY); db_iface_data = nml_dbus_object_iface_data_get(dbobj, interface_name, allow_add_iface); - else if (allow_add_iface) { + if (db_iface_data && dbobj->obj_state == NML_DBUS_OBJ_STATE_WATCHED_ONLY) + nml_dbus_object_set_obj_state(dbobj, NML_DBUS_OBJ_STATE_ON_DBUS, self); + } else if (allow_add_iface) { dbobj = _dbobjs_dbobj_create(self, g_steal_pointer(&dbus_path)); nml_dbus_object_set_obj_state(dbobj, NML_DBUS_OBJ_STATE_ON_DBUS, self); db_iface_data = nml_dbus_object_iface_data_get(dbobj, interface_name, TRUE); + nm_assert(db_iface_data); } NM_SET_OUT(inout_dbobj, dbobj); diff --git a/libnm/nm-enum-types.c.template b/libnm/nm-enum-types.c.template new file mode 100644 index 00000000..ccad218c --- /dev/null +++ b/libnm/nm-enum-types.c.template @@ -0,0 +1,77 @@ +/*** BEGIN file-header ***/ +#include "config.h" + +#include "nm-enum-types.h" +# +#include "libnm/nm-default-libnm.h" + +#include "nm-version-macros.h" +#include "NetworkManager.h" +#include "nm-access-point.h" +#include "nm-active-connection.h" +#include "nm-checkpoint.h" +#include "nm-client.h" +#include "nm-device-adsl.h" +#include "nm-device-bond.h" +#include "nm-device-bridge.h" +#include "nm-device-bt.h" +#include "nm-device-dummy.h" +#include "nm-device-ethernet.h" +#include "nm-device-generic.h" +#include "nm-device-infiniband.h" +#include "nm-device-ip-tunnel.h" +#include "nm-device-macsec.h" +#include "nm-device-macvlan.h" +#include "nm-device-modem.h" +#include "nm-device-olpc-mesh.h" +#include "nm-device-ovs-interface.h" +#include "nm-device-ovs-port.h" +#include "nm-device-ovs-bridge.h" +#include "nm-device-ppp.h" +#include "nm-device-team.h" +#include "nm-device-tun.h" +#include "nm-device-vlan.h" +#include "nm-device-vxlan.h" +#include "nm-device-wifi.h" +#include "nm-device-wimax.h" +#include "nm-device.h" +#include "nm-dhcp-config.h" +#include "nm-ip-config.h" +#include "nm-object.h" +#include "nm-remote-connection.h" +#include "nm-types.h" +#include "nm-vpn-connection.h" +#include "nm-vpn-editor.h" +#include "nm-wimax-nsp.h" +#include "nm-secret-agent-old.h" +#include "nm-vpn-plugin-old.h" +#include "nm-vpn-service-plugin.h" +/*** END file-header ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ diff --git a/libnm/nm-enum-types.h.template b/libnm/nm-enum-types.h.template new file mode 100644 index 00000000..bc70af13 --- /dev/null +++ b/libnm/nm-enum-types.h.template @@ -0,0 +1,23 @@ +/*** BEGIN file-header ***/ +#ifndef __NM_ENUM_TYPES_H__ +#define __NM_ENUM_TYPES_H__ + +#include "nm-core-enum-types.h" +# +#include <glib-object.h> + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN enumeration-production ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __NM_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/libnm/nm-libnm-utils.c b/libnm/nm-libnm-utils.c index 1fb6a47c..1000e04d 100644 --- a/libnm/nm-libnm-utils.c +++ b/libnm/nm-libnm-utils.c @@ -46,6 +46,7 @@ _nml_dbus_log(NMLDBusLogLevel level, gboolean use_stdout, const char *fmt, ...) va_list args; const char * prefix = ""; gint64 ts; + pid_t pid; /* we only call _nml_dbus_log() after nml_dbus_log_enabled(), which already does * an atomic access to the variable. Since the value is only initialized once and @@ -89,14 +90,18 @@ _nml_dbus_log(NMLDBusLogLevel level, gboolean use_stdout, const char *fmt, ...) ts = nm_utils_clock_gettime_nsec(CLOCK_BOOTTIME); + pid = getpid(); + if (use_stdout) { - g_print("libnm-dbus: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + g_print("libnm-dbus[%lld]: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + (long long) pid, prefix, ts / NM_UTILS_NSEC_PER_SEC, (ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000, msg); } else { - g_printerr("libnm-dbus: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + g_printerr("libnm-dbus[%lld]: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + (long long) pid, prefix, ts / NM_UTILS_NSEC_PER_SEC, (ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000, |