From 4303618a30c2bab01dabef7fa9a566bc084be4c5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 12 Nov 2020 23:20:56 +0100 Subject: [PATCH] core/ovs: move definitions of structs in "nm-ovsdb.c" It's in general nicer to have all definitions of structs and enums a the top of the source file. As enums and structs are commonly used by functions, it's often nice to have the enums and structs defined first, before all functions. --- src/devices/ovs/nm-ovsdb.c | 86 +++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index bd55a8b341..a63038ce03 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -51,6 +51,49 @@ typedef struct { /*****************************************************************************/ +typedef void (*OvsdbMethodCallback)(NMOvsdb *self, + json_t * response, + GError * error, + gpointer user_data); + +typedef enum { + OVSDB_MONITOR, + OVSDB_ADD_INTERFACE, + OVSDB_DEL_INTERFACE, + OVSDB_SET_INTERFACE_MTU, +} OvsdbCommand; + +#define CALL_ID_UNSPEC G_MAXUINT64 + +typedef union { + struct { + } monitor; + struct { + NMConnection *bridge; + NMConnection *port; + NMConnection *interface; + NMDevice * bridge_device; + NMDevice * interface_device; + } add_interface; + struct { + char *ifname; + } del_interface; + struct { + char * ifname; + guint32 mtu; + } set_interface_mtu; +} OvsdbMethodPayload; + +typedef struct { + guint64 call_id; + OvsdbCommand command; + OvsdbMethodCallback callback; + gpointer user_data; + OvsdbMethodPayload payload; +} OvsdbMethodCall; + +/*****************************************************************************/ + enum { DEVICE_ADDED, DEVICE_REMOVED, INTERFACE_FAILED, LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = {0}; @@ -100,41 +143,6 @@ static void ovsdb_next_command(NMOvsdb *self); /*****************************************************************************/ -/* ovsdb command abstraction. */ - -typedef void (*OvsdbMethodCallback)(NMOvsdb *self, - json_t * response, - GError * error, - gpointer user_data); - -typedef enum { - OVSDB_MONITOR, - OVSDB_ADD_INTERFACE, - OVSDB_DEL_INTERFACE, - OVSDB_SET_INTERFACE_MTU, -} OvsdbCommand; - -#define CALL_ID_UNSPEC G_MAXUINT64 - -typedef union { - struct { - } monitor; - struct { - NMConnection *bridge; - NMConnection *port; - NMConnection *interface; - NMDevice * bridge_device; - NMDevice * interface_device; - } add_interface; - struct { - char *ifname; - } del_interface; - struct { - char * ifname; - guint32 mtu; - } set_interface_mtu; -} OvsdbMethodPayload; - #define OVSDB_METHOD_PAYLOAD_MONITOR() \ (&((const OvsdbMethodPayload){ \ .monitor = {}, \ @@ -173,14 +181,6 @@ typedef union { }, \ })) -typedef struct { - guint64 call_id; - OvsdbCommand command; - OvsdbMethodCallback callback; - gpointer user_data; - OvsdbMethodPayload payload; -} OvsdbMethodCall; - /*****************************************************************************/ static void