Commit 14cfe437 authored by Nils Goroll's avatar Nils Goroll Committed by Dridi Boukelmoune

vtim-ification

Inclused re-declaration fixes for some places which I got wrong in the
past.

Conflicts:
	bin/varnishd/cache/cache_objhead.h
parent bc039486
......@@ -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;
......
......@@ -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);
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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));
}
......
......@@ -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.
......
......@@ -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 *);
......@@ -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); \
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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);
......@@ -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);
......@@ -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);
......
......@@ -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);
......
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