1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-01 14:38:28 +00:00

DIET/MINOR: stream-int: rearrange a few fields in struct stream_interface to save 8 bytes

The current and previous states are now packed enums instead of ints. This will
also help in gdb. The flags have been turned to 16-bit instead of 32 since only
10 are used. This resulted in saving 8 bytes per streamm interface, or 16 per
session.
This commit is contained in:
Willy Tarreau 2013-12-06 23:31:58 +01:00
parent 2518db4bfa
commit 721854f0ac

View File

@ -35,7 +35,7 @@
* interface is performing some retries (eg: connection error). Some states are
* transient and do not last beyond process_session().
*/
enum {
enum si_state {
SI_ST_INI = 0, /* interface not sollicitated yet */
SI_ST_REQ, /* [transient] connection initiation desired and not started yet */
SI_ST_QUE, /* interface waiting in queue */
@ -46,7 +46,7 @@ enum {
SI_ST_EST, /* connection established (resource exists) */
SI_ST_DIS, /* [transient] disconnected from other side, but cleanup not done yet */
SI_ST_CLO, /* stream intf closed, might not existing anymore. Buffers shut. */
};
} __attribute__((packed));
/* error types reported on the streams interface for more accurate reporting */
enum {
@ -63,7 +63,7 @@ enum {
SI_ET_DATA_ABRT = 0x0200, /* data phase aborted by external cause */
};
/* flags set after I/O */
/* flags set after I/O (16 bit) */
enum {
SI_FL_NONE = 0x0000, /* nothing */
SI_FL_EXP = 0x0001, /* timeout has expired */
@ -93,6 +93,7 @@ struct si_ops {
/* Context of a running applet. */
struct appctx {
enum obj_type obj_type; /* OBJ_TYPE_APPCTX */
/* 3 unused bytes here */
unsigned int st0; /* CLI state for stats, session state for peers */
unsigned int st1; /* prompt for stats, session error for peers */
unsigned int st2; /* output state for stats, unused by peers */
@ -155,9 +156,9 @@ struct appctx {
*/
struct stream_interface {
/* struct members used by the "buffer" side */
unsigned int state; /* SI_ST* */
unsigned int prev_state;/* SI_ST*, copy of previous state */
unsigned int flags; /* SI_FL_* */
enum si_state state; /* SI_ST* */
enum si_state prev_state;/* SI_ST*, copy of previous state */
unsigned short flags; /* SI_FL_* */
unsigned int exp; /* wake up time for connect, queue, turn-around, ... */
struct channel *ib, *ob; /* input and output buffers */
void *owner; /* generally a (struct task*) */
@ -172,6 +173,7 @@ struct stream_interface {
/* An applet designed to run in a stream interface */
struct si_applet {
enum obj_type obj_type; /* object type = OBJ_TYPE_APPLET */
/* 3 unused bytes here */
char *name; /* applet's name to report in logs */
void (*fct)(struct stream_interface *); /* internal I/O handler, may never be NULL */
void (*release)(struct stream_interface *); /* callback to release resources, may be NULL */