Commit 2b6f3276 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Turn the confusion of busyobj flags into a #include table.

parent c717cf00
......@@ -527,8 +527,6 @@ struct busyobj {
struct req *req;
uint8_t *vary;
unsigned is_gzip;
unsigned is_gunzip;
#define N_VFPS 5
vfp_pull_f *vfps[N_VFPS];
......@@ -551,18 +549,11 @@ struct busyobj {
struct pool_task fetch_task;
unsigned should_close;
char *h_content_length;
unsigned do_esi;
unsigned do_gzip;
unsigned do_gunzip;
unsigned do_stream;
/* do_pass is our intent, uncacheable is the result */
unsigned do_pass;
unsigned uncacheable;
unsigned abandon;
#define BO_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/bo_flags.h"
#undef BO_FLAG
/* Timeouts */
double connect_timeout;
......
......@@ -267,13 +267,10 @@ pan_busyobj(const struct busyobj *bo)
VSB_printf(pan_vsp, " busyobj = %p {\n", bo);
pan_ws(bo->ws, 4);
if (bo->is_gzip) VSB_printf(pan_vsp, " is_gzip\n");
if (bo->is_gunzip) VSB_printf(pan_vsp, " is_gunzip\n");
if (bo->do_gzip) VSB_printf(pan_vsp, " do_gzip\n");
if (bo->do_gunzip) VSB_printf(pan_vsp, " do_gunzip\n");
if (bo->do_esi) VSB_printf(pan_vsp, " do_esi\n");
if (bo->do_stream) VSB_printf(pan_vsp, " do_stream\n");
if (bo->should_close) VSB_printf(pan_vsp, " should_close\n");
#define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, " is_" #l "\n");
#include "tbl/bo_flags.h"
#undef BO_FLAG
VSB_printf(pan_vsp, " bodystatus = %d (%s),\n",
bo->htc.body_status, body_status_2str(bo->htc.body_status));
VSB_printf(pan_vsp, " },\n");
......
......@@ -121,27 +121,31 @@ VRT_DO_STATUS(beresp)
/*--------------------------------------------------------------------*/
#define VBERESP(dir, type, onm, field) \
#define VBERESPW0(field)
#define VBERESPW1(field) \
void \
VRT_l_##dir##_##onm(const struct vrt_ctx *ctx, type a) \
VRT_l_beresp_##field(const struct vrt_ctx *ctx, unsigned a) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
ctx->bo->field = a; \
} \
\
type \
VRT_r_##dir##_##onm(const struct vrt_ctx *ctx) \
ctx->bo->field = a ? 1 : 0; \
}
#define VBERESPR0(field)
#define VBERESPR1(field) \
unsigned \
VRT_r_beresp_##field(const struct vrt_ctx *ctx) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
return (ctx->bo->field); \
}
VBERESP(beresp, unsigned, do_esi, do_esi)
VBERESP(beresp, unsigned, do_gzip, do_gzip)
VBERESP(beresp, unsigned, do_gunzip, do_gunzip)
VBERESP(beresp, unsigned, do_stream, do_stream)
#define BO_FLAG(l, r, w, d) \
VBERESPR##r(l) \
VBERESPW##r(l)
#include "tbl/bo_flags.h"
#undef BO_FLAG
/*--------------------------------------------------------------------*/
......
......@@ -5,6 +5,7 @@ nobase_pkginclude_HEADERS = \
tbl/acct_fields.h \
tbl/backend_poll.h \
tbl/ban_vars.h \
tbl/bo_flags.h \
tbl/body_status.h \
tbl/debug_bits.h \
tbl/feature_bits.h \
......
/*-
* Copyright (c) 2014 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
/* lower, vcl_r, vcl_w, doc */
BO_FLAG(do_esi, 1, 1, "")
BO_FLAG(do_gzip, 1, 1, "")
BO_FLAG(do_gunzip, 1, 1, "")
BO_FLAG(do_stream, 1, 1, "")
BO_FLAG(do_pass, 0, 0, "")
BO_FLAG(uncacheable, 0, 0, "")
BO_FLAG(abandon, 0, 0, "")
BO_FLAG(is_gzip, 0, 0, "")
BO_FLAG(is_gunzip, 0, 0, "")
BO_FLAG(should_close, 0, 0, "")
/*lint -restore */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment