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.
This commit is contained in:
Thomas Haller 2020-11-12 23:20:56 +01:00
parent c45041f1fc
commit 4303618a30
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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