From: Aurelien DARRAGON Date: Tue, 8 Apr 2025 09:56:23 +0000 (+0200) Subject: MINOR: stats: add stat_col flags X-Git-Tag: v3.3-dev1~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d04843167c5ab2367d1e98ce265e3d8b33562d43;p=thirdparty%2Fhaproxy.git MINOR: stats: add stat_col flags Add stat_col flags member to store .generic bit and prepare for upcoming flags. No functional change expected. --- diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h index 14a822d92..7a320c921 100644 --- a/include/haproxy/stats-t.h +++ b/include/haproxy/stats-t.h @@ -342,6 +342,10 @@ enum stat_idx_info { ST_I_INF_MAX }; +/* Flags for stat_col.flags */ +#define STAT_COL_FL_NONE 0x00 +#define STAT_COL_FL_GENERIC 0x01 /* stat is generic if set */ + /* Represent an exposed statistic. */ struct stat_col { const char *name; /* short name, used notably in CSV headers */ @@ -350,8 +354,8 @@ struct stat_col { uint32_t type; /* combination of field_nature and field_format */ uint8_t cap; /* mask of stats_domain_px_cap to restrain metrics to an object types subset */ - uint8_t generic; /* bit set if generic */ - /* 2 bytes hole */ + /* 1 byte hole */ + uint16_t flags; /* STAT_COL_FL_* flags */ /* used only for generic metrics */ struct { diff --git a/include/haproxy/stats.h b/include/haproxy/stats.h index f292ba4dd..b7895be2b 100644 --- a/include/haproxy/stats.h +++ b/include/haproxy/stats.h @@ -79,7 +79,7 @@ int stats_emit_field_tags(struct buffer *out, const struct field *f, /* Returns true if is fully defined, false if only used as name-desc. */ static inline int stcol_is_generic(const struct stat_col *col) { - return col->generic; + return col->flags & STAT_COL_FL_GENERIC; } static inline enum field_format stcol_format(const struct stat_col *col) diff --git a/src/stats-proxy.c b/src/stats-proxy.c index 6e4ad4649..90d82f0e9 100644 --- a/src/stats-proxy.c +++ b/src/stats-proxy.c @@ -25,7 +25,7 @@ .metric.offset[0] = offsetof(struct fe_counters, offset_f), \ .metric.offset[1] = offsetof(struct be_counters, offset_f), \ .cap = (cap_f), \ - .generic = 1, \ + .flags = STAT_COL_FL_GENERIC, \ .alt_name = alt_n, \ } @@ -34,7 +34,7 @@ { .name = (name_f), .desc = (desc_f), .type = (nature)|(format), \ .metric.offset[0] = offsetof(struct fe_counters, offset_f), \ .cap = (cap_f), \ - .generic = 1, \ + .flags = STAT_COL_FL_GENERIC, \ .alt_name = alt_n, \ } @@ -43,7 +43,7 @@ { .name = (name_f), .desc = (desc_f), .type = (nature)|(format), \ .metric.offset[1] = offsetof(struct be_counters, offset_f), \ .cap = (cap_f), \ - .generic = 1, \ + .flags = STAT_COL_FL_GENERIC, \ .alt_name = alt_n, \ }