Mailing List Archive

[master] 76d55e740 Rename `enum sess_close` to `stream_close_t` with a typedef.
commit 76d55e740d9eb6c2075b3d7a12eef3d7c92ea957
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Tue Jan 4 09:44:10 2022 +0000

Rename `enum sess_close` to `stream_close_t` with a typedef.

This is preparation to change the enum to a struct.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 0f528d9a2..3343bab96 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -432,7 +432,7 @@ struct req {
#define REQ_MAGIC 0xfb4abf6d

body_status_t req_body_status;
- enum sess_close doclose;
+ stream_close_t doclose;
unsigned restarts;
unsigned esi_level;

@@ -628,7 +628,7 @@ int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **);
#define HTTP_FOREACH_PACK(wrk, oc, ptr) \
for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));)
const char *HTTP_GetHdrPack(struct worker *, struct objcore *, hdr_t);
-enum sess_close http_DoConnection(struct http *hp, enum sess_close sc_close);
+stream_close_t http_DoConnection(struct http *hp, stream_close_t sc_close);
int http_IsFiltered(const struct http *hp, unsigned u, unsigned how);

#define HTTPH_R_PASS (1 << 0) /* Request (c->b) in pass mode */
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 9f286a55f..132cd2f4e 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -344,11 +344,11 @@ vbe_dir_getip(VRT_CTX, VCL_BACKEND d)

/*--------------------------------------------------------------------*/

-static enum sess_close v_matchproto_(vdi_http1pipe_f)
+static stream_close_t v_matchproto_(vdi_http1pipe_f)
vbe_dir_http1pipe(VRT_CTX, VCL_BACKEND d)
{
int i;
- enum sess_close retval;
+ stream_close_t retval;
struct backend *bp;
struct v1p_acct v1a;
struct pfd *pfd;
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 5bb3ac7b7..166916da4 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -197,7 +197,7 @@ VDI_Finish(struct busyobj *bo)

/* Get a connection --------------------------------------------------*/

-enum sess_close
+stream_close_t
VDI_Http1Pipe(struct req *req, struct busyobj *bo)
{
const struct director *d;
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 516e09648..148cb9e94 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -956,11 +956,11 @@ http_GetRange(const struct http *hp, ssize_t *lo, ssize_t *hi)
/*--------------------------------------------------------------------
*/

-enum sess_close
-http_DoConnection(struct http *hp, enum sess_close sc_close)
+stream_close_t
+http_DoConnection(struct http *hp, stream_close_t sc_close)
{
const char *h, *b, *e;
- enum sess_close retval;
+ stream_close_t retval;
unsigned u, v;
struct http_hdrflg *f;

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 734b801e3..e5468397e 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -88,7 +88,7 @@ boc_state_2str(enum boc_state_e e)
/*--------------------------------------------------------------------*/

const char *
-sess_close_2str(enum sess_close sc, int want_desc)
+sess_close_2str(stream_close_t sc, int want_desc)
{
switch (sc) {
case SC_NULL: return (want_desc ? "(null)" : "NULL");
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 27cfe3034..99e9653a1 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -300,7 +300,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
*/

void v_matchproto_(vtr_req_fail_f)
-Req_Fail(struct req *req, enum sess_close reason)
+Req_Fail(struct req *req, stream_close_t reason)
{
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index f0013de1b..1e646e5ae 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -510,7 +510,7 @@ SES_Wait(struct sess *sp, const struct transport *xp)
*/

static void
-ses_close_acct(enum sess_close reason)
+ses_close_acct(stream_close_t reason)
{
int i = 0;

@@ -537,7 +537,7 @@ ses_close_acct(enum sess_close reason)
*/

void
-SES_Close(struct sess *sp, enum sess_close reason)
+SES_Close(struct sess *sp, stream_close_t reason)
{
int i;

@@ -554,7 +554,7 @@ SES_Close(struct sess *sp, enum sess_close reason)
*/

void
-SES_Delete(struct sess *sp, enum sess_close reason, vtim_real now)
+SES_Delete(struct sess *sp, stream_close_t reason, vtim_real now)
{

CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -576,7 +576,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, vtim_real now)
}

if (reason == SC_NULL)
- reason = (enum sess_close)-sp->fd;
+ reason = (stream_close_t)-sp->fd;

VSL(SLT_SessClose, sp->vxid, "%s %.3f",
sess_close_2str(reason, 0), now - sp->t_open);
@@ -589,7 +589,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, vtim_real now)
void
SES_DeleteHS(struct sess *sp, enum htc_status_e hs, vtim_real now)
{
- enum sess_close reason;
+ stream_close_t reason;

switch (hs) {
case HTC_S_JUNK:
diff --git a/bin/varnishd/cache/cache_transport.h b/bin/varnishd/cache/cache_transport.h
index 6815ce446..0e5f03c65 100644
--- a/bin/varnishd/cache/cache_transport.h
+++ b/bin/varnishd/cache/cache_transport.h
@@ -42,7 +42,7 @@ typedef void vtr_deliver_f (struct req *, struct boc *, int sendbody);
typedef void vtr_req_body_f (struct req *);
typedef void vtr_sess_panic_f (struct vsb *, const struct sess *);
typedef void vtr_req_panic_f (struct vsb *, const struct req *);
-typedef void vtr_req_fail_f (struct req *, enum sess_close);
+typedef void vtr_req_fail_f (struct req *, stream_close_t);
typedef void vtr_reembark_f (struct worker *, struct req *);
typedef int vtr_minimal_response_f (struct req *, uint16_t status);

@@ -87,8 +87,8 @@ int VPX_Send_Proxy(int fd, int version, const struct sess *);

/* cache_session.c */
struct sess *SES_New(struct pool *);
-void SES_Delete(struct sess *, enum sess_close reason, vtim_real now);
+void SES_Delete(struct sess *, stream_close_t reason, vtim_real now);
void SES_DeleteHS(struct sess *, enum htc_status_e hs, vtim_real now);
-void SES_Close(struct sess *, enum sess_close reason);
+void SES_Close(struct sess *, stream_close_t reason);
void SES_SetTransport(struct worker *, struct sess *, struct req *,
const struct transport *);
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 59ea9b1cb..5d534df6a 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -97,7 +97,7 @@ struct http_conn {
#define HTTP_CONN_MAGIC 0x3e19edd1

int *rfd;
- enum sess_close doclose;
+ stream_close_t doclose;
body_status_t body_status;
struct ws *ws;
char *rxbuf_b;
@@ -183,7 +183,7 @@ void VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **busyobj);
int VDI_GetHdr(struct busyobj *);
VCL_IP VDI_GetIP(struct busyobj *);
void VDI_Finish(struct busyobj *bo);
-enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
+stream_close_t VDI_Http1Pipe(struct req *, struct busyobj *);
void VDI_Panic(const struct director *, struct vsb *, const char *nm);
void VDI_Event(const struct director *d, enum vcl_event_e ev);
void VDI_Init(void);
@@ -382,7 +382,7 @@ int PAN__DumpStruct(struct vsb *vsb, int block, int track, const void *ptr,
#define PAN_dump_once_oneline(vsb, ptr, magic, ...) \
PAN__DumpStruct(vsb, 0, 0, ptr, #magic, magic, __VA_ARGS__)

-const char *sess_close_2str(enum sess_close sc, int want_desc);
+const char *sess_close_2str(stream_close_t sc, int want_desc);

/* cache_pool.c */
void Pool_Init(void);
@@ -403,7 +403,7 @@ struct req *Req_New(struct sess *);
void Req_Release(struct req *);
void Req_Rollback(VRT_CTX);
void Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req);
-void Req_Fail(struct req *req, enum sess_close reason);
+void Req_Fail(struct req *req, stream_close_t reason);
void Req_AcctLogCharge(struct VSC_main_wrk *, struct req *);
void Req_LogHit(struct worker *, struct req *, struct objcore *, intmax_t);

diff --git a/bin/varnishd/http1/cache_http1.h b/bin/varnishd/http1/cache_http1.h
index 2e8b03ac3..a9f905376 100644
--- a/bin/varnishd/http1/cache_http1.h
+++ b/bin/varnishd/http1/cache_http1.h
@@ -62,6 +62,6 @@ void V1L_Chunked(const struct worker *w);
void V1L_EndChunk(const struct worker *w);
void V1L_Open(struct worker *, struct ws *, int *fd, struct vsl_log *,
vtim_real deadline, unsigned niov);
-enum sess_close V1L_Flush(const struct worker *w);
-enum sess_close V1L_Close(struct worker *w, uint64_t *cnt);
+stream_close_t V1L_Flush(const struct worker *w);
+stream_close_t V1L_Close(struct worker *w, uint64_t *cnt);
size_t V1L_Write(const struct worker *w, const void *ptr, ssize_t len);
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index b051499ee..282f4d9a0 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -89,7 +89,7 @@ void v_matchproto_(vtr_deliver_f)
V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
{
int err = 0, chunked = 0;
- enum sess_close sc;
+ stream_close_t sc;
uint64_t hdrbytes, bytes;

CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 1861d9a12..57df205ce 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -74,7 +74,7 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
uint64_t *ctr_bodybytes)
{
struct http *hp;
- enum sess_close sc;
+ stream_close_t sc;
ssize_t i;
uint64_t bytes, hdrbytes;
struct http_conn *htc;
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index ccd9ee340..d27d8485e 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -174,7 +174,7 @@ http1_req_panic(struct vsb *vsb, const struct req *req)
}

static void v_matchproto_(vtr_req_fail_f)
-http1_req_fail(struct req *req, enum sess_close reason)
+http1_req_fail(struct req *req, stream_close_t reason)
{
assert(reason > 0);
assert(req->sp->fd != 0);
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index 006119e98..7274b446f 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -55,7 +55,7 @@ struct v1l {
unsigned magic;
#define V1L_MAGIC 0x2f2142e5
int *wfd;
- enum sess_close werr; /* valid after V1L_Flush() */
+ stream_close_t werr; /* valid after V1L_Flush() */
struct iovec *iov;
unsigned siov;
unsigned niov;
@@ -123,13 +123,13 @@ V1L_Open(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
WS_Release(ws, u * sizeof(struct iovec));
}

-enum sess_close
+stream_close_t
V1L_Close(struct worker *wrk, uint64_t *cnt)
{
struct v1l *v1l;
struct ws *ws;
uintptr_t ws_snap;
- enum sess_close sc;
+ stream_close_t sc;

CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AN(cnt);
@@ -169,7 +169,7 @@ v1l_prune(struct v1l *v1l, size_t bytes)
AZ(v1l->liov);
}

-enum sess_close
+stream_close_t
V1L_Flush(const struct worker *wrk)
{
ssize_t i;
diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index 09c88187a..eb6e8f6a9 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -44,7 +44,7 @@ struct h2_error_s {
uint32_t val;
int stream;
int connection;
- enum sess_close reason;
+ stream_close_t reason;
};

typedef const struct h2_error_s *h2_error;
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index f2d238769..fc05f7779 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -1161,7 +1161,7 @@ h2_req_body(struct req *req)
/**********************************************************************/

void v_matchproto_(vtr_req_fail_f)
-h2_req_fail(struct req *req, enum sess_close reason)
+h2_req_fail(struct req *req, stream_close_t reason)
{
assert(reason > 0);
assert(req->sp->fd != 0);
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 1740d2a0a..846b319f1 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -136,7 +136,7 @@ h2_init_sess(struct sess *sp,
}

static void
-h2_del_sess(struct worker *wrk, struct h2_sess *h2, enum sess_close reason)
+h2_del_sess(struct worker *wrk, struct h2_sess *h2, stream_close_t reason)
{
struct sess *sp;
struct req *req;
diff --git a/include/tbl/h2_error.h b/include/tbl/h2_error.h
index e8104f8aa..2cd06f011 100644
--- a/include/tbl/h2_error.h
+++ b/include/tbl/h2_error.h
@@ -30,7 +30,7 @@
* RFC7540 section 11.4
*
* Types: conn=1|stream=2
- * Reason: enum sess_close
+ * Reason: stream_close_t
*/

/*lint -save -e525 -e539 */
diff --git a/include/tbl/sess_close.h b/include/tbl/sess_close.h
index 97483147c..3660bb9bb 100644
--- a/include/tbl/sess_close.h
+++ b/include/tbl/sess_close.h
@@ -31,7 +31,7 @@

/*lint -save -e525 -e539 */

-// enum sess_close sc_* stat is_err Description
+// stream_close_t sc_* stat is_err Description
SESS_CLOSE(REM_CLOSE, rem_close, 0, "Client Closed")
SESS_CLOSE(REQ_CLOSE, req_close, 0, "Client requested close")
SESS_CLOSE(REQ_HTTP10, req_http10, 1, "Proto < HTTP/1.1")
diff --git a/include/vrt.h b/include/vrt.h
index 1a47ac8ba..0efc616b1 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -268,6 +268,8 @@ struct vsl_log;
struct vsmw_cluster;
struct ws;

+typedef enum sess_close stream_close_t;
+
/***********************************************************************
* VCL_STRANDS:
*
@@ -662,7 +664,7 @@ typedef VCL_BACKEND vdi_resolve_f(VRT_CTX, VCL_BACKEND);
typedef int vdi_gethdrs_f(VRT_CTX, VCL_BACKEND);
typedef VCL_IP vdi_getip_f(VRT_CTX, VCL_BACKEND);
typedef void vdi_finish_f(VRT_CTX, VCL_BACKEND);
-typedef enum sess_close vdi_http1pipe_f(VRT_CTX, VCL_BACKEND);
+typedef stream_close_t vdi_http1pipe_f(VRT_CTX, VCL_BACKEND);
typedef void vdi_event_f(VCL_BACKEND, enum vcl_event_e);
typedef void vdi_destroy_f(VCL_BACKEND);
typedef void vdi_panic_f(VCL_BACKEND, struct vsb *);
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit