mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 00:06:59 +00:00
warnings: ensure optimal packing in structures
Add padding where needed and order structure when it makes alignment fall naturally to better order, with a single padding at the end of structure. Reference: http://www.catb.org/esr/structure-packing/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
6f6369f517
commit
71714a0993
3 changed files with 14 additions and 9 deletions
|
|
@ -340,9 +340,9 @@ int main(int argc, char **argv)
|
||||||
.warn_count = 0x100000000, /* == 2^32 that is the entire IPv4 space */
|
.warn_count = 0x100000000, /* == 2^32 that is the entire IPv4 space */
|
||||||
.crit_count = 0x100000000, /* basically turns off the count criteria */
|
.crit_count = 0x100000000, /* basically turns off the count criteria */
|
||||||
.header_limit = 8,
|
.header_limit = 8,
|
||||||
.color_mode = color_auto,
|
|
||||||
.ranges_size = 64,
|
.ranges_size = 64,
|
||||||
.ip_version = IPvUNKNOWN,
|
.ip_version = IPvUNKNOWN,
|
||||||
|
.color_mode = color_auto,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,9 @@ struct shared_network_t {
|
||||||
double used;
|
double used;
|
||||||
double touched;
|
double touched;
|
||||||
double backups;
|
double backups;
|
||||||
int netmask;
|
|
||||||
struct shared_network_t *next;
|
struct shared_network_t *next;
|
||||||
|
int netmask;
|
||||||
|
uint32_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \struct range_t
|
/*! \struct range_t
|
||||||
|
|
@ -145,12 +146,13 @@ struct range_t {
|
||||||
* \brief Various per range and shared net temporary calculation results.
|
* \brief Various per range and shared net temporary calculation results.
|
||||||
*/
|
*/
|
||||||
struct output_helper_t {
|
struct output_helper_t {
|
||||||
int status;
|
|
||||||
double range_size;
|
double range_size;
|
||||||
double percent;
|
double percent;
|
||||||
double tc;
|
double tc;
|
||||||
double tcp;
|
double tcp;
|
||||||
double bup;
|
double bup;
|
||||||
|
int status;
|
||||||
|
uint32_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \enum ltype
|
/*! \enum ltype
|
||||||
|
|
@ -167,9 +169,10 @@ enum ltype {
|
||||||
*/
|
*/
|
||||||
struct leases_t {
|
struct leases_t {
|
||||||
union ipaddr_t ip; /* ip as key */
|
union ipaddr_t ip; /* ip as key */
|
||||||
enum ltype type;
|
|
||||||
char *ethernet;
|
char *ethernet;
|
||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
|
enum ltype type;
|
||||||
|
uint32_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \enum limbits
|
/*! \enum limbits
|
||||||
|
|
@ -209,22 +212,22 @@ struct conf_t {
|
||||||
struct shared_network_t *shared_net_head; /*!< Last entry in shared network linked list. */
|
struct shared_network_t *shared_net_head; /*!< Last entry in shared network linked list. */
|
||||||
struct range_t *ranges; /*!< Array of ranges. */
|
struct range_t *ranges; /*!< Array of ranges. */
|
||||||
unsigned int num_ranges; /*!< Number of ranges in the ranges array. */
|
unsigned int num_ranges; /*!< Number of ranges in the ranges array. */
|
||||||
|
enum dhcp_version ip_version; /*!< Designator if the dhcpd is running in IPv4 or IPv6 mode. */
|
||||||
size_t ranges_size; /*!< Size of the ranges array. */
|
size_t ranges_size; /*!< Size of the ranges array. */
|
||||||
struct leases_t *leases; /*!< An array of individual leases from dhcpd.leases file. */
|
struct leases_t *leases; /*!< An array of individual leases from dhcpd.leases file. */
|
||||||
enum dhcp_version ip_version; /*!< Designator if the dhcpd is running in IPv4 or IPv6 mode. */
|
|
||||||
const char *dhcpdconf_file; /*!< Path to dhcpd.conf file. */
|
const char *dhcpdconf_file; /*!< Path to dhcpd.conf file. */
|
||||||
const char *dhcpdlease_file; /*!< Path to dhcpd.leases file. */
|
const char *dhcpdlease_file; /*!< Path to dhcpd.leases file. */
|
||||||
int color_format; /*!< Column to use in color_tags array. */
|
|
||||||
struct output_sort *sorts; /*!< Linked list how to sort ranges. */
|
struct output_sort *sorts; /*!< Linked list how to sort ranges. */
|
||||||
const char *output_file; /*!< Output file path. */
|
const char *output_file; /*!< Output file path. */
|
||||||
char output_format; /*!< Output format, such as text, json, xml, .... */
|
|
||||||
const char *mustach_template; /*!< Mustach template file path. */
|
const char *mustach_template; /*!< Mustach template file path. */
|
||||||
double warning; /*!< Warning percent threshold. */
|
double warning; /*!< Warning percent threshold. */
|
||||||
double critical; /*!< Critical percent threshold. */
|
double critical; /*!< Critical percent threshold. */
|
||||||
double warn_count; /*!< Maximum number of free IP's before warning. */
|
double warn_count; /*!< Maximum number of free IP's before warning. */
|
||||||
double crit_count; /*!< Maximum number of free IP's before critical. */
|
double crit_count; /*!< Maximum number of free IP's before critical. */
|
||||||
double minsize; /*!< Minimum size of range or shared network to be considered exceeding threshold. */
|
double minsize; /*!< Minimum size of range or shared network to be considered exceeding threshold. */
|
||||||
unsigned int
|
int color_format; /*!< Column to use in color_tags array. */
|
||||||
|
char output_format; /*!< Output format, such as text, json, xml, .... */
|
||||||
|
uint32_t
|
||||||
print_mac_addreses:1, /*!< Print mac address in xml or json. */
|
print_mac_addreses:1, /*!< Print mac address in xml or json. */
|
||||||
reverse_order:1, /*!< Reverse sort order. */
|
reverse_order:1, /*!< Reverse sort order. */
|
||||||
backups_found:1, /*!< Indicator if dhcpd.leases file has leases in backup state. */
|
backups_found:1, /*!< Indicator if dhcpd.leases file has leases in backup state. */
|
||||||
|
|
@ -238,7 +241,8 @@ struct conf_t {
|
||||||
skip_critical:1, /*!< Skip critical values from output. */
|
skip_critical:1, /*!< Skip critical values from output. */
|
||||||
skip_minsize:1, /*!< Skip alarming values that are below minsize from output. */
|
skip_minsize:1, /*!< Skip alarming values that are below minsize from output. */
|
||||||
skip_suppressed:1, /*!< Skip alarming values that are suppressed with --snet-alarms option, or they are shared networks without IP availability. */
|
skip_suppressed:1, /*!< Skip alarming values that are suppressed with --snet-alarms option, or they are shared networks without IP availability. */
|
||||||
color_mode:2; /*!< Indicator if colors should be used in output. */
|
color_mode:2, /*!< Indicator if colors should be used in output. */
|
||||||
|
pad_bits:4;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ struct expl {
|
||||||
struct shared_network_t *shnet_p;
|
struct shared_network_t *shnet_p;
|
||||||
struct output_helper_t oh;
|
struct output_helper_t oh;
|
||||||
int current;
|
int current;
|
||||||
|
uint32_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int must_enter(void *closure, const char *name);
|
static int must_enter(void *closure, const char *name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue