Commit 9b216d2e authored by Federico G. Schwindt's avatar Federico G. Schwindt

Stringify boc_state

parent d94b4a88
......@@ -360,12 +360,9 @@ struct storeobj {
* The macro-states we expose outside the fetch code
*/
enum boc_state_e {
BOS_INVALID = 0, /* don't touch (yet) */
BOS_REQ_DONE, /* beresp.* can be examined */
BOS_PREP_STREAM, /* Prepare for streaming */
BOS_STREAM, /* beresp.* can be examined */
BOS_FINISHED, /* object is complete */
BOS_FAILED, /* something went wrong */
#define BOC_STATE(U, l) BOS_##U,
#include "tbl/boc_state.h"
#undef BOC_STATE
};
struct boc {
......
......@@ -94,6 +94,20 @@ reqbody_status_2str(enum req_body_state_e e)
/*--------------------------------------------------------------------*/
static const char *
boc_state_2str(enum boc_state_e e)
{
switch (e) {
#define BOC_STATE(U,l) case BOS_##U: return(#l);
#include "tbl/boc_state.h"
#undef BOC_STATE
default:
return ("?");
}
}
/*--------------------------------------------------------------------*/
const char *
sess_close_2str(enum sess_close sc, int want_desc)
{
......@@ -231,7 +245,7 @@ pan_boc(struct vsb *vsb, const struct boc *boc)
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, boc, BOC_MAGIC);
VSB_printf(vsb, "refcnt = %u,\n", boc->refcount);
VSB_printf(vsb, "state = %d,\n", boc->state);
VSB_printf(vsb, "state = %s,\n", boc_state_2str(boc->state));
VSB_printf(vsb, "vary = %p,\n", boc->vary);
VSB_printf(vsb, "stevedore_priv = %p,\n", boc->stevedore_priv);
VSB_indent(vsb, -2);
......
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Federico G. Schwindt <fgsch@lodoss.net>
*
* 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 */
BOC_STATE(INVALID, invalid) /* don't touch (yet) */
BOC_STATE(REQ_DONE, req_done) /* beresp.* can be examined */
BOC_STATE(PREP_STREAM, prep_stream) /* Prepare for streaming */
BOC_STATE(STREAM, stream) /* beresp.* can be examined */
BOC_STATE(FINISHED, finished) /* object is complete */
BOC_STATE(FAILED, failed) /* something went wrong */
/*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