[6.0] 14cfe437d vtim-ification

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Feb 8 12:31:13 UTC 2019


commit 14cfe437dd177ef4170f2175ab92e1b6c0a57dd5
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Dec 3 12:30:13 2018 +0100

    vtim-ification
    
    Inclused re-declaration fixes for some places which I got wrong in the
    past.
    
    Conflicts:
            bin/varnishd/cache/cache_objhead.h

diff --git a/bin/varnishd/cache/cache_obj.h b/bin/varnishd/cache/cache_obj.h
index bdb6795bd..5229b7e00 100644
--- a/bin/varnishd/cache/cache_obj.h
+++ b/bin/varnishd/cache/cache_obj.h
@@ -46,7 +46,7 @@ typedef const void *objgetattr_f(struct worker *, struct objcore *,
     enum obj_attr attr, ssize_t *len);
 typedef void *objsetattr_f(struct worker *, struct objcore *,
     enum obj_attr attr, ssize_t len, const void *ptr);
-typedef void objtouch_f(struct worker *, struct objcore *, double now);
+typedef void objtouch_f(struct worker *, struct objcore *, vtim_real now);
 
 struct obj_methods {
 	objfree_f	*objfree;
diff --git a/bin/varnishd/cache/cache_objhead.h b/bin/varnishd/cache/cache_objhead.h
index 6bcb7b301..9e90d5b32 100644
--- a/bin/varnishd/cache/cache_objhead.h
+++ b/bin/varnishd/cache/cache_objhead.h
@@ -72,7 +72,7 @@ enum lookup_e HSH_Lookup(struct req *, struct objcore **, struct objcore **,
     int always_insert);
 void HSH_Ref(struct objcore *o);
 void HSH_AddString(struct req *, void *ctx, const char *str);
-unsigned HSH_Purge(struct worker *, struct objhead *, double ttl_now,
-    double ttl, double grace, double keep);
+unsigned HSH_Purge(struct worker *, struct objhead *, vtim_real ttl_now,
+    vtim_dur ttl, vtim_dur grace, vtim_dur keep);
 struct objcore *HSH_Private(const struct worker *wrk);
 void HSH_Abandon(struct objcore *oc);
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index ddecb9c4e..c9341fdd0 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -62,11 +62,11 @@
  */
 
 void
-RFC2616_Ttl(struct busyobj *bo, double now, double *t_origin,
+RFC2616_Ttl(struct busyobj *bo, vtim_real now, vtim_real *t_origin,
     float *ttl, float *grace, float *keep)
 {
 	unsigned max_age, age;
-	double h_date, h_expires;
+	vtim_real h_date, h_expires;
 	const char *p;
 	const struct http *hp;
 
@@ -258,7 +258,7 @@ int
 RFC2616_Do_Cond(const struct req *req)
 {
 	const char *p, *e;
-	double ims, lm;
+	vtim_real ims, lm;
 
 	/*
 	 * We MUST ignore If-Modified-Since if we have an If-None-Match
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index b6faa8222..4141dfa21 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -253,7 +253,7 @@ HTC_RxPipeline(struct http_conn *htc, void *p)
 
 enum htc_status_e
 HTC_RxStuff(struct http_conn *htc, htc_complete_f *func,
-    double *t1, double *t2, double ti, double tn, int maxbytes)
+    vtim_real *t1, vtim_real *t2, vtim_real ti, vtim_real tn, int maxbytes)
 {
 	vtim_dur tmo;
 	vtim_real now;
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index e4db8158f..83e22f2f9 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -373,8 +373,8 @@ VSLb(struct vsl_log *vsl, enum VSL_tag_e tag, const char *fmt, ...)
 }
 
 void
-VSLb_ts(struct vsl_log *vsl, const char *event, double first, double *pprev,
-    double now)
+VSLb_ts(struct vsl_log *vsl, const char *event, vtim_real first,
+    vtim_real *pprev, vtim_real now)
 {
 
 	/* XXX: Make an option to turn off some unnecessary timestamp
diff --git a/bin/varnishd/cache/cache_tcp_pool.c b/bin/varnishd/cache/cache_tcp_pool.c
index dbc12c685..9d623ef9c 100644
--- a/bin/varnishd/cache/cache_tcp_pool.c
+++ b/bin/varnishd/cache/cache_tcp_pool.c
@@ -66,7 +66,8 @@ struct pfd {
 /*--------------------------------------------------------------------
  */
 
-typedef int cp_open_f(const struct conn_pool *, double tmo, const void **privp);
+typedef int cp_open_f(const struct conn_pool *, vtim_dur tmo,
+    const void **privp);
 typedef void cp_close_f(struct pfd *);
 typedef int cp_cmp_f(const struct conn_pool *, const void *priv);
 typedef void cp_name_f(const struct pfd *, char *, unsigned, char *, unsigned);
@@ -100,7 +101,7 @@ struct conn_pool {
 
 	int					n_used;
 
-	double					holddown;
+	vtim_mono				holddown;
 	int					holddown_errno;
 };
 
@@ -158,7 +159,7 @@ PFD_RemoteName(const struct pfd *p, char *abuf, unsigned alen, char *pbuf,
  */
 
 static void  v_matchproto_(waiter_handle_f)
-vcp_handle(struct waited *w, enum wait_event ev, double now)
+vcp_handle(struct waited *w, enum wait_event ev, vtim_real now)
 {
 	struct pfd *pfd;
 	struct conn_pool *cp;
@@ -377,10 +378,10 @@ VCP_Recycle(const struct worker *wrk, struct pfd **pfdp)
  */
 
 static int
-VCP_Open(struct conn_pool *cp, double tmo, const void **privp, int *err)
+VCP_Open(struct conn_pool *cp, vtim_dur tmo, const void **privp, int *err)
 {
 	int r;
-	double h;
+	vtim_mono h;
 
 	CHECK_OBJ_NOTNULL(cp, CONN_POOL_MAGIC);
 	AN(err);
@@ -487,7 +488,7 @@ VCP_Close(struct pfd **pfdp)
  */
 
 static struct pfd *
-VCP_Get(struct conn_pool *cp, double tmo, struct worker *wrk,
+VCP_Get(struct conn_pool *cp, vtim_dur tmo, struct worker *wrk,
     unsigned force_fresh, int *err)
 {
 	struct pfd *pfd;
@@ -579,13 +580,13 @@ struct vtp_cs {
 };
 
 static inline int
-tmo2msec(double tmo)
+tmo2msec(vtim_dur tmo)
 {
 	return ( (int)floor(tmo * 1000.0) );
 }
 
 static int v_matchproto_(cp_open_f)
-vtp_open(const struct conn_pool *cp, double tmo, const void **privp)
+vtp_open(const struct conn_pool *cp, vtim_dur tmo, const void **privp)
 {
 	int s;
 	int msec;
@@ -673,7 +674,7 @@ static const struct cp_methods vtp_methods = {
  */
 
 static int v_matchproto_(cp_open_f)
-vus_open(const struct conn_pool *cp, double tmo, const void **privp)
+vus_open(const struct conn_pool *cp, vtim_dur tmo, const void **privp)
 {
 	int s;
 	int msec;
@@ -801,7 +802,7 @@ VTP_Rel(struct tcp_pool **tpp)
  */
 
 int
-VTP_Open(struct tcp_pool *tp, double tmo, const void **privp, int *err)
+VTP_Open(struct tcp_pool *tp, vtim_dur tmo, const void **privp, int *err)
 {
 	return (VCP_Open(tp->cp, tmo, privp, err));
 }
diff --git a/bin/varnishd/cache/cache_tcp_pool.h b/bin/varnishd/cache/cache_tcp_pool.h
index 57564ba96..3c872336f 100644
--- a/bin/varnishd/cache/cache_tcp_pool.h
+++ b/bin/varnishd/cache/cache_tcp_pool.h
@@ -72,7 +72,7 @@ void VTP_Rel(struct tcp_pool **);
 	 * the pool is destroyed and all cached connections closed.
 	 */
 
-int VTP_Open(struct tcp_pool *, double tmo, const void **, int*);
+int VTP_Open(struct tcp_pool *, vtim_dur tmo, const void **, int*);
 	/*
 	 * Open a new connection and return the adress used.
 	 * errno will be returned in the last argument.
diff --git a/bin/varnishd/cache/cache_transport.h b/bin/varnishd/cache/cache_transport.h
index 5de0920a3..5da5e3501 100644
--- a/bin/varnishd/cache/cache_transport.h
+++ b/bin/varnishd/cache/cache_transport.h
@@ -79,7 +79,7 @@ void 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, double now);
+void SES_Delete(struct sess *, enum sess_close reason, vtim_real now);
 void SES_Close(struct sess *, enum sess_close 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 365b821fc..45aba733a 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -261,7 +261,7 @@ void ObjSetState(struct worker *, const struct objcore *,
     enum boc_state_e next);
 void ObjWaitState(const struct objcore *, enum boc_state_e want);
 void ObjTrimStore(struct worker *, struct objcore *);
-void ObjTouch(struct worker *, struct objcore *, double now);
+void ObjTouch(struct worker *, struct objcore *, vtim_real now);
 void ObjFreeObj(struct worker *, struct objcore *);
 void ObjSlim(struct worker *, struct objcore *);
 void *ObjSetAttr(struct worker *, struct objcore *, enum obj_attr,
@@ -347,7 +347,7 @@ const char * HTC_Status(enum htc_status_e);
 void HTC_RxInit(struct http_conn *htc, struct ws *ws);
 void HTC_RxPipeline(struct http_conn *htc, void *);
 enum htc_status_e HTC_RxStuff(struct http_conn *, htc_complete_f *,
-    double *t1, double *t2, double ti, double tn, int maxbytes);
+    vtim_real *t1, vtim_real *t2, vtim_real ti, vtim_real tn, int maxbytes);
 
 #define SESS_ATTR(UP, low, typ, len)					\
 	int SES_Set_##low(const struct sess *sp, const typ *src);	\
diff --git a/bin/varnishd/fuzzers/esi_parse_fuzzer.c b/bin/varnishd/fuzzers/esi_parse_fuzzer.c
index c09c888ba..972ffa0b1 100644
--- a/bin/varnishd/fuzzers/esi_parse_fuzzer.c
+++ b/bin/varnishd/fuzzers/esi_parse_fuzzer.c
@@ -56,8 +56,8 @@ VSLb(struct vsl_log *vsl, enum VSL_tag_e tag, const char *fmt, ...)
 }
 
 void
-VSLb_ts(struct vsl_log *l, const char *event, double first, double *pprev,
-    double now)
+VSLb_ts(struct vsl_log *l, const char *event, vtim_real first, vtim_real *pprev,
+    vtim_real now)
 {
 	(void)l;
 	(void)event;
diff --git a/bin/varnishd/waiter/waiter.h b/bin/varnishd/waiter/waiter.h
index 531f640d7..4a0d8a7d5 100644
--- a/bin/varnishd/waiter/waiter.h
+++ b/bin/varnishd/waiter/waiter.h
@@ -52,7 +52,7 @@ enum wait_event {
 	WAITER_CLOSE
 };
 
-typedef void waiter_handle_f(struct waited *, enum wait_event, double now);
+typedef void waiter_handle_f(struct waited *, enum wait_event, vtim_real now);
 
 struct waited {
 	unsigned		magic;
@@ -62,8 +62,8 @@ struct waited {
 	void			*priv1;
 	uintptr_t		priv2;
 	waiter_handle_f		*func;
-	volatile double		*tmo;
-	double			idle;
+	volatile vtim_real	*tmo;
+	vtim_real		idle;
 };
 
 /* cache_waiter.c */
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 4ae43643d..4b1703e6c 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -122,7 +122,7 @@ static unsigned vsm_status = 0;
 
 #define NOTIF_MAXLEN 256
 static char notification_message[NOTIF_MAXLEN] = "";
-static double notification_eol = 0.0;
+static vtim_mono notification_eol = 0.0;
 
 static void
 init_hitrate(void)
diff --git a/include/vnum.h b/include/vnum.h
index b24545015..266f156f5 100644
--- a/include/vnum.h
+++ b/include/vnum.h
@@ -31,5 +31,5 @@
 /* from libvarnish/vnum.c */
 double VNUM(const char *p);
 double VNUMpfx(const char *p, const char **e);
-double VNUM_duration(const char *p);
+vtim_dur VNUM_duration(const char *p);
 const char *VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel);
diff --git a/include/vtim.h b/include/vtim.h
index 1968bc568..b1898a39d 100644
--- a/include/vtim.h
+++ b/include/vtim.h
@@ -31,10 +31,10 @@
 /* from libvarnish/vtim.c */
 extern unsigned VTIM_postel;
 #define VTIM_FORMAT_SIZE 30
-void VTIM_format(double t, char *p);
-double VTIM_parse(const char *p);
+void VTIM_format(vtim_real t, char *p);
+vtim_real VTIM_parse(const char *p);
 vtim_mono VTIM_mono(void);
 vtim_real VTIM_real(void);
 void VTIM_sleep(vtim_dur t);
-struct timespec VTIM_timespec(vtim_dur t);
-struct timeval VTIM_timeval(vtim_dur t);
+struct timespec VTIM_timespec(vtim_real t);
+struct timeval VTIM_timeval(vtim_real t);
diff --git a/lib/libvmod_directors/shard_dir.c b/lib/libvmod_directors/shard_dir.c
index 01f044fff..a936e08d6 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -165,7 +165,7 @@ shard_next(struct shard_state *state, VCL_INT skip, VCL_BOOL healthy)
 	int c, chosen = -1;
 	uint32_t ringsz;
 	VCL_BACKEND be;
-	double changed;
+	vtim_real changed;
 	struct shard_be_info *sbe;
 
 	AN(state);
@@ -312,7 +312,7 @@ sharddir_any_healthy(struct sharddir *shardd, const struct busyobj *bo,
 	unsigned retval = 0;
 	VCL_BACKEND be;
 	unsigned u;
-	double c;
+	vtim_real c;
 
 	CHECK_OBJ_NOTNULL(shardd, SHARDDIR_MAGIC);
 	CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC);
diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c
index 84895c365..78f8d9c40 100644
--- a/lib/libvmod_directors/vdir.c
+++ b/lib/libvmod_directors/vdir.c
@@ -180,7 +180,7 @@ vdir_any_healthy(struct vdir *vd, const struct busyobj *bo, double *changed)
 	unsigned retval = 0;
 	VCL_BACKEND be;
 	unsigned u;
-	double c;
+	vtim_real c;
 
 	CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC);
 	CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC);


More information about the varnish-commit mailing list