platform: add nm_platform_process_events() function

(cherry picked from commit 55a67ec787)
This commit is contained in:
Thomas Haller 2015-06-19 15:38:41 +02:00
parent 5ddfc86eb8
commit 6835e80aea
3 changed files with 28 additions and 0 deletions

View file

@ -136,6 +136,7 @@ typedef enum {
static gboolean tun_get_properties_ifname (NMPlatform *platform, const char *ifname, NMPlatformTunProperties *props);
static void delayed_action_schedule (NMPlatform *platform, DelayedActionType action_type, gpointer user_data);
static gboolean delayed_action_handle_all (NMPlatform *platform, gboolean read_netlink);
static void do_request_link (NMPlatform *platform, int ifindex, const char *name, gboolean handle_delayed_action);
static void do_request_all (NMPlatform *platform, DelayedActionType action_type, gboolean handle_delayed_action);
static void cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMPCacheOpsType ops_type, gpointer user_data);
@ -807,6 +808,12 @@ check_support_user_ipv6ll (NMPlatform *platform)
return _support_user_ipv6ll_get ();
}
static void
process_events (NMPlatform *platform)
{
delayed_action_handle_all (platform, TRUE);
}
/******************************************************************/
#define DEVTYPE_PREFIX "DEVTYPE="
@ -5098,5 +5105,7 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
platform_class->check_support_kernel_extended_ifa_flags = check_support_kernel_extended_ifa_flags;
platform_class->check_support_user_ipv6ll = check_support_user_ipv6ll;
platform_class->process_events = process_events;
}

View file

@ -224,6 +224,23 @@ nm_platform_check_support_user_ipv6ll (NMPlatform *self)
return !!supported;
}
/**
* nm_platform_process_events:
* @self: platform instance
*
* Process pending events or handle pending delayed-actions.
* Effectively, this reads the netlink socket and processes
* new netlink messages. Possibly it will raise change signals.
*/
void
nm_platform_process_events (NMPlatform *self)
{
_CHECK_SELF_VOID (self, klass);
if (klass->process_events)
klass->process_events (self);
}
/******************************************************************/
/**

View file

@ -426,6 +426,7 @@ typedef struct {
gboolean (*link_get_unmanaged) (NMPlatform *, int ifindex, gboolean *managed);
gboolean (*link_refresh) (NMPlatform *, int ifindex);
void (*process_events) (NMPlatform *self);
gboolean (*link_set_up) (NMPlatform *, int ifindex, gboolean *out_no_firmware);
gboolean (*link_set_down) (NMPlatform *, int ifindex);
@ -613,6 +614,7 @@ gboolean nm_platform_link_is_software (NMPlatform *self, int ifindex);
gboolean nm_platform_link_supports_slaves (NMPlatform *self, int ifindex);
gboolean nm_platform_link_refresh (NMPlatform *self, int ifindex);
void nm_platform_process_events (NMPlatform *self);
gboolean nm_platform_link_set_up (NMPlatform *self, int ifindex, gboolean *out_no_firmware);
gboolean nm_platform_link_set_down (NMPlatform *self, int ifindex);