platform: streamline fields in platform's structures

- sort the fields to better fill gaps due to alignment.
- use "bool" bitfield instead of gboolean.
This commit is contained in:
Thomas Haller
2016-02-29 15:57:37 +01:00
parent 866925e65c
commit 83d8a9e094

View File

@@ -119,7 +119,6 @@ struct _NMPlatformLink {
/* NMPlatform initializes this field with a static string. */ /* NMPlatform initializes this field with a static string. */
const char *driver; const char *driver;
gboolean initialized;
int master; int master;
/* rtnl_link_get_link(), IFLA_LINK. /* rtnl_link_get_link(), IFLA_LINK.
@@ -127,6 +126,11 @@ struct _NMPlatformLink {
* this field be set to (negative) NM_PLATFORM_LINK_OTHER_NETNS. */ * this field be set to (negative) NM_PLATFORM_LINK_OTHER_NETNS. */
int parent; int parent;
/* IFF_* flags. Note that the flags in 'struct ifinfomsg' are declared as 'unsigned'. */
guint n_ifi_flags;
guint mtu;
/* rtnl_link_get_arptype(), ifinfomsg.ifi_type. */ /* rtnl_link_get_arptype(), ifinfomsg.ifi_type. */
guint32 arptype; guint32 arptype;
@@ -147,14 +151,11 @@ struct _NMPlatformLink {
* initialized with memset(0) has and unset value.*/ * initialized with memset(0) has and unset value.*/
guint8 inet6_addr_gen_mode_inv; guint8 inet6_addr_gen_mode_inv;
/* IFF_* flags. Note that the flags in 'struct ifinfomsg' are declared as 'unsigned'. */
guint n_ifi_flags;
/* @connected is mostly identical to (@n_ifi_flags & IFF_UP). Except for bridge/bond masters, /* @connected is mostly identical to (@n_ifi_flags & IFF_UP). Except for bridge/bond masters,
* where we coerce the link as disconnect if it has no slaves. */ * where we coerce the link as disconnect if it has no slaves. */
gboolean connected; bool connected:1;
guint mtu; bool initialized:1;
}; };
typedef enum { /*< skip >*/ typedef enum { /*< skip >*/
@@ -362,16 +363,16 @@ extern const NMPlatformVTableRoute nm_platform_vtable_route_v4;
extern const NMPlatformVTableRoute nm_platform_vtable_route_v6; extern const NMPlatformVTableRoute nm_platform_vtable_route_v6;
typedef struct { typedef struct {
in_addr_t local;
in_addr_t remote;
int parent_ifindex; int parent_ifindex;
guint16 input_flags; guint16 input_flags;
guint16 output_flags; guint16 output_flags;
guint32 input_key; guint32 input_key;
guint32 output_key; guint32 output_key;
in_addr_t local;
in_addr_t remote;
guint8 ttl; guint8 ttl;
guint8 tos; guint8 tos;
gboolean path_mtu_discovery; bool path_mtu_discovery:1;
} NMPlatformLnkGre; } NMPlatformLnkGre;
typedef struct { typedef struct {
@@ -380,42 +381,42 @@ typedef struct {
} NMPlatformLnkInfiniband; } NMPlatformLnkInfiniband;
typedef struct { typedef struct {
int parent_ifindex;
struct in6_addr local; struct in6_addr local;
struct in6_addr remote; struct in6_addr remote;
int parent_ifindex;
guint8 ttl; guint8 ttl;
guint8 tclass; guint8 tclass;
guint8 encap_limit; guint8 encap_limit;
guint flow_label;
guint8 proto; guint8 proto;
guint flow_label;
} NMPlatformLnkIp6Tnl; } NMPlatformLnkIp6Tnl;
typedef struct { typedef struct {
int parent_ifindex;
in_addr_t local; in_addr_t local;
in_addr_t remote; in_addr_t remote;
int parent_ifindex;
guint8 ttl; guint8 ttl;
guint8 tos; guint8 tos;
gboolean path_mtu_discovery; bool path_mtu_discovery:1;
} NMPlatformLnkIpIp; } NMPlatformLnkIpIp;
typedef struct { typedef struct {
guint mode; guint mode;
gboolean no_promisc; bool no_promisc:1;
gboolean tap; bool tap:1;
} NMPlatformLnkMacvlan; } NMPlatformLnkMacvlan;
typedef NMPlatformLnkMacvlan NMPlatformLnkMacvtap; typedef NMPlatformLnkMacvlan NMPlatformLnkMacvtap;
typedef struct { typedef struct {
int parent_ifindex;
in_addr_t local; in_addr_t local;
in_addr_t remote; in_addr_t remote;
int parent_ifindex;
guint8 ttl; guint8 ttl;
guint8 tos; guint8 tos;
gboolean path_mtu_discovery;
guint16 flags;
guint8 proto; guint8 proto;
bool path_mtu_discovery:1;
guint16 flags;
} NMPlatformLnkSit; } NMPlatformLnkSit;
typedef struct { typedef struct {
@@ -425,33 +426,33 @@ typedef struct {
} NMPlatformLnkVlan; } NMPlatformLnkVlan;
typedef struct { typedef struct {
int parent_ifindex;
guint32 id;
in_addr_t group;
in_addr_t local;
struct in6_addr group6; struct in6_addr group6;
struct in6_addr local6; struct in6_addr local6;
guint8 tos; in_addr_t group;
guint8 ttl; in_addr_t local;
gboolean learning; int parent_ifindex;
guint32 id;
guint32 ageing; guint32 ageing;
guint32 limit; guint32 limit;
guint16 dst_port; guint16 dst_port;
guint16 src_port_min; guint16 src_port_min;
guint16 src_port_max; guint16 src_port_max;
gboolean proxy; guint8 tos;
gboolean rsc; guint8 ttl;
gboolean l2miss; bool learning:1;
gboolean l3miss; bool proxy:1;
bool rsc:1;
bool l2miss:1;
bool l3miss:1;
} NMPlatformLnkVxlan; } NMPlatformLnkVxlan;
typedef struct { typedef struct {
gint64 owner; gint64 owner;
gint64 group; gint64 group;
const char *mode; const char *mode;
gboolean no_pi; bool no_pi:1;
gboolean vnet_hdr; bool vnet_hdr:1;
gboolean multi_queue; bool multi_queue:1;
} NMPlatformTunProperties; } NMPlatformTunProperties;
/******************************************************************/ /******************************************************************/