void show_strm_et(unsigned int f)
{
- printf("strm->et = ");
- if (!f) {
- printf("STRM_ET_NONE\n");
- return;
- }
-
- SHOW_FLAG(f, STRM_ET_QUEUE_TO);
- SHOW_FLAG(f, STRM_ET_QUEUE_ERR);
- SHOW_FLAG(f, STRM_ET_QUEUE_ABRT);
- SHOW_FLAG(f, STRM_ET_CONN_TO);
- SHOW_FLAG(f, STRM_ET_CONN_ERR);
- SHOW_FLAG(f, STRM_ET_CONN_ABRT);
- SHOW_FLAG(f, STRM_ET_CONN_RES);
- SHOW_FLAG(f, STRM_ET_CONN_OTHER);
- SHOW_FLAG(f, STRM_ET_DATA_TO);
- SHOW_FLAG(f, STRM_ET_DATA_ERR);
- SHOW_FLAG(f, STRM_ET_DATA_ABRT);
-
- if (f) {
- printf("EXTRA(0x%08x)", f);
- }
- putchar('\n');
+ strm_et_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
+ printf("strm->et = %s\n", tmpbuf);
}
void show_task_state(unsigned int f)
#include <haproxy/dynbuf-t.h>
#include <haproxy/filters-t.h>
#include <haproxy/obj_type-t.h>
+#include <haproxy/show_flags-t.h>
#include <haproxy/stick_table-t.h>
#include <haproxy/vars-t.h>
#define PCLI_F_PAYLOAD 0x20000
-/* error types reported on the streams for more accurate reporting */
+/* error types reported on the streams for more accurate reporting.
+ * Please also update the strm_et_show_flags() function below in case of changes.
+ */
enum {
STRM_ET_NONE = 0x0000, /* no error yet, leave it to zero */
STRM_ET_QUEUE_TO = 0x0001, /* queue timeout */
STRM_ET_DATA_ABRT = 0x0400, /* data phase aborted by external cause */
};
+/* This function is used to report flags in debugging tools. Please reflect
+ * below any single-bit flag addition above in the same order via the
+ * __APPEND_FLAG macro. The new end of the buffer is returned.
+ */
+static forceinline char *strm_et_show_flags(char *buf, size_t len, const char *delim, uint flg)
+{
+#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__)
+ /* prologue */
+ _(0);
+ /* flags */
+ _(STRM_ET_QUEUE_TO, _(STRM_ET_QUEUE_ERR, _(STRM_ET_QUEUE_ABRT,
+ _(STRM_ET_CONN_TO, _(STRM_ET_CONN_ERR, _(STRM_ET_CONN_ABRT,
+ _(STRM_ET_CONN_RES, _(STRM_ET_CONN_OTHER, _(STRM_ET_DATA_TO,
+ _(STRM_ET_DATA_ERR, _(STRM_ET_DATA_ABRT)))))))))));
+ /* epilogue */
+ _(~0U);
+ return buf;
+#undef _
+}
+
struct hlua;
struct proxy;
struct pendconn;