Commit 12ddc91b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Pål Hermunn Johansen

Drop the incestous relationship between VSM and VSC, and stack

VSC neatly on top of VSM.
parent 23333e3c
...@@ -74,7 +74,7 @@ do_xml_cb(void *priv, const struct VSC_point * const pt) ...@@ -74,7 +74,7 @@ do_xml_cb(void *priv, const struct VSC_point * const pt)
} }
static void static void
do_xml(struct vsm *vd) do_xml(struct vsc *vsc)
{ {
char time_stamp[20]; char time_stamp[20];
time_t now; time_t now;
...@@ -83,7 +83,7 @@ do_xml(struct vsm *vd) ...@@ -83,7 +83,7 @@ do_xml(struct vsm *vd)
now = time(NULL); now = time(NULL);
(void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now));
printf("<varnishstat timestamp=\"%s\">\n", time_stamp); printf("<varnishstat timestamp=\"%s\">\n", time_stamp);
(void)VSC_Iter(vd, NULL, do_xml_cb, NULL); (void)VSC_Iter(vsc, NULL, do_xml_cb, NULL);
printf("</varnishstat>\n"); printf("</varnishstat>\n");
} }
...@@ -124,7 +124,7 @@ do_json_cb(void *priv, const struct VSC_point * const pt) ...@@ -124,7 +124,7 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
} }
static void static void
do_json(struct vsm *vd) do_json(struct vsc *vsc)
{ {
char time_stamp[20]; char time_stamp[20];
time_t now; time_t now;
...@@ -137,7 +137,7 @@ do_json(struct vsm *vd) ...@@ -137,7 +137,7 @@ do_json(struct vsm *vd)
(void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now));
printf(" \"timestamp\": \"%s\",\n", time_stamp); printf(" \"timestamp\": \"%s\",\n", time_stamp);
(void)VSC_Iter(vd, NULL, do_json_cb, &jp); (void)VSC_Iter(vsc, NULL, do_json_cb, &jp);
printf("\n}\n"); printf("\n}\n");
} }
...@@ -194,15 +194,15 @@ do_once_cb(void *priv, const struct VSC_point * const pt) ...@@ -194,15 +194,15 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
} }
static void static void
do_once(struct vsm *vd) do_once(struct vsc *vsc)
{ {
struct once_priv op; struct once_priv op;
memset(&op, 0, sizeof op); memset(&op, 0, sizeof op);
op.pad = 18; op.pad = 18;
(void)VSC_Iter(vd, NULL, do_once_cb_first, &op); (void)VSC_Iter(vsc, NULL, do_once_cb_first, &op);
(void)VSC_Iter(vd, NULL, do_once_cb, &op); (void)VSC_Iter(vsc, NULL, do_once_cb, &op);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -226,13 +226,13 @@ do_list_cb(void *priv, const struct VSC_point * const pt) ...@@ -226,13 +226,13 @@ do_list_cb(void *priv, const struct VSC_point * const pt)
} }
static void static void
list_fields(struct vsm *vd) list_fields(struct vsc *vsc)
{ {
printf("Varnishstat -f option fields:\n"); printf("Varnishstat -f option fields:\n");
printf("Field name Description\n"); printf("Field name Description\n");
printf("---------- -----------\n"); printf("---------- -----------\n");
(void)VSC_Iter(vd, NULL, do_list_cb, NULL); (void)VSC_Iter(vsc, NULL, do_list_cb, NULL);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -256,10 +256,13 @@ main(int argc, char * const *argv) ...@@ -256,10 +256,13 @@ main(int argc, char * const *argv)
int once = 0, xml = 0, json = 0, f_list = 0, curses = 0; int once = 0, xml = 0, json = 0, f_list = 0, curses = 0;
signed char opt; signed char opt;
int i; int i;
struct vsc *vsc;
VUT_Init(progname, argc, argv, &vopt_spec); VUT_Init(progname, argc, argv, &vopt_spec);
vd = VSM_New(); vd = VSM_New();
AN(vd); AN(vd);
vsc = VSC_New(vd);
AN(vsc);
while ((opt = getopt(argc, argv, vopt_spec.vopt_optstring)) != -1) { while ((opt = getopt(argc, argv, vopt_spec.vopt_optstring)) != -1) {
switch (opt) { switch (opt) {
...@@ -282,7 +285,7 @@ main(int argc, char * const *argv) ...@@ -282,7 +285,7 @@ main(int argc, char * const *argv)
json = 1; json = 1;
break; break;
default: default:
i = VSC_Arg(vd, opt, optarg); i = VSC_Arg(vsc, opt, optarg);
if (i < 0) if (i < 0)
VUT_Error(1, "%s", VSM_Error(vd)); VUT_Error(1, "%s", VSM_Error(vd));
if (!i) if (!i)
...@@ -300,15 +303,15 @@ main(int argc, char * const *argv) ...@@ -300,15 +303,15 @@ main(int argc, char * const *argv)
VUT_Error(1, "%s", VSM_Error(vd)); VUT_Error(1, "%s", VSM_Error(vd));
if (curses) if (curses)
do_curses(vd, 1.0); do_curses(vd, vsc, 1.0);
else if (xml) else if (xml)
do_xml(vd); do_xml(vsc);
else if (json) else if (json)
do_json(vd); do_json(vsc);
else if (once) else if (once)
do_once(vd); do_once(vsc);
else if (f_list) else if (f_list)
list_fields(vd); list_fields(vsc);
else else
assert(0); assert(0);
......
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
#include "vas.h" #include "vas.h"
#include "vcs.h" #include "vcs.h"
void do_curses(struct vsm *vd, double delay); void do_curses(struct vsm *, struct vsc *, double);
...@@ -313,7 +313,7 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt) ...@@ -313,7 +313,7 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
} }
static void static void
build_pt_list(struct vsm *vd, struct vsm_fantom *fantom) build_pt_list(struct vsc *vsc, struct vsm_fantom *fantom)
{ {
struct pt_priv pt_priv; struct pt_priv pt_priv;
int i; int i;
...@@ -334,7 +334,7 @@ build_pt_list(struct vsm *vd, struct vsm_fantom *fantom) ...@@ -334,7 +334,7 @@ build_pt_list(struct vsm *vd, struct vsm_fantom *fantom)
main_cache_hit = NULL; main_cache_hit = NULL;
main_cache_miss = NULL; main_cache_miss = NULL;
(void)VSC_Iter(vd, fantom, build_pt_list_cb, &pt_priv); (void)VSC_Iter(vsc, fantom, build_pt_list_cb, &pt_priv);
delete_pt_list(); delete_pt_list();
AN(VTAILQ_EMPTY(&ptlist)); AN(VTAILQ_EMPTY(&ptlist));
AZ(n_ptlist); AZ(n_ptlist);
...@@ -1044,7 +1044,7 @@ handle_keypress(int ch) ...@@ -1044,7 +1044,7 @@ handle_keypress(int ch)
} }
void void
do_curses(struct vsm *vd, double delay) do_curses(struct vsm *vd, struct vsc *vsc, double delay)
{ {
struct pollfd pollfd; struct pollfd pollfd;
long t; long t;
...@@ -1073,7 +1073,7 @@ do_curses(struct vsm *vd, double delay) ...@@ -1073,7 +1073,7 @@ do_curses(struct vsm *vd, double delay)
(VSM_Status(vd) & (VSM_MGT_CHANGED|VSM_WRK_CHANGED))) { (VSM_Status(vd) & (VSM_MGT_CHANGED|VSM_WRK_CHANGED))) {
init_hitrate(); init_hitrate();
delete_pt_list(); delete_pt_list();
build_pt_list(vd, &f_iter); build_pt_list(vsc, &f_iter);
initial = 0; initial = 0;
} }
......
...@@ -78,6 +78,7 @@ struct varnish { ...@@ -78,6 +78,7 @@ struct varnish {
struct vsm *vsm_vsl; struct vsm *vsm_vsl;
struct vsm *vsm_vsc; struct vsm *vsm_vsc;
struct vsc *vsc;
int has_a_arg; int has_a_arg;
unsigned vsl_tag_count[256]; unsigned vsl_tag_count[256];
...@@ -521,7 +522,10 @@ varnish_launch(struct varnish *v) ...@@ -521,7 +522,10 @@ varnish_launch(struct varnish *v)
free(r); free(r);
v->vsm_vsc = VSM_New(); v->vsm_vsc = VSM_New();
(void)VSM_Arg(v->vsm_vsc, 'n', v->workdir); AN(v->vsm_vsc);
v->vsc = VSC_New(v->vsm_vsc);
AN(v->vsc);
(void)VSC_Arg(v->vsc, 'n', v->workdir);
AZ(VSM_Attach(v->vsm_vsc, -1)); AZ(VSM_Attach(v->vsm_vsc, -1));
v->vsm_vsl = VSM_New(); v->vsm_vsl = VSM_New();
...@@ -846,7 +850,7 @@ varnish_vsc(const struct varnish *v, const char *arg) ...@@ -846,7 +850,7 @@ varnish_vsc(const struct varnish *v, const char *arg)
dp.arg = arg; dp.arg = arg;
(void)VSM_Status(v->vsm_vsc); (void)VSM_Status(v->vsm_vsc);
(void)VSC_Iter(v->vsm_vsc, NULL, do_stat_dump_cb, &dp); (void)VSC_Iter(v->vsc, NULL, do_stat_dump_cb, &dp);
} }
/********************************************************************** /**********************************************************************
...@@ -912,7 +916,7 @@ varnish_expect(const struct varnish *v, char * const *av) ...@@ -912,7 +916,7 @@ varnish_expect(const struct varnish *v, char * const *av)
for (i = 0; i < 50; i++, (void)usleep(100000)) { for (i = 0; i < 50; i++, (void)usleep(100000)) {
(void)VSM_Status(v->vsm_vsc); (void)VSM_Status(v->vsm_vsc);
good = VSC_Iter(v->vsm_vsc, NULL, do_expect_cb, &sp); good = VSC_Iter(v->vsc, NULL, do_expect_cb, &sp);
if (!good) { if (!good) {
good = -2; good = -2;
continue; continue;
......
...@@ -38,13 +38,17 @@ ...@@ -38,13 +38,17 @@
#include "vapi/vsc_int.h" #include "vapi/vsc_int.h"
struct vsm; struct vsm;
struct vsc;
struct vsm_fantom; struct vsm_fantom;
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
* VSC level access functions * VSC level access functions
*/ */
int VSC_Arg(struct vsm *vd, char arg, const char *opt); struct vsc *VSC_New(struct vsm *);
void VSC_Destroy(struct vsc **);
int VSC_Arg(struct vsc *, char arg, const char *opt);
/* /*
* Handle standard stat-presenter arguments * Handle standard stat-presenter arguments
* Return: * Return:
...@@ -80,8 +84,7 @@ void VSC_Destroy_Point(struct VSC_point **); ...@@ -80,8 +84,7 @@ void VSC_Destroy_Point(struct VSC_point **);
typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt); typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt);
int VSC_Iter(struct vsm *vd, struct vsm_fantom *fantom, VSC_iter_f *func, int VSC_Iter(struct vsc *, struct vsm_fantom *, VSC_iter_f *func, void *priv);
void *priv);
/* /*
* Iterate over all statistics counters, calling "func" for * Iterate over all statistics counters, calling "func" for
* each counter not suppressed by any "-f" arguments. * each counter not suppressed by any "-f" arguments.
......
...@@ -14,7 +14,6 @@ libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:6:0 ...@@ -14,7 +14,6 @@ libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:6:0
libvarnishapi_la_SOURCES = \ libvarnishapi_la_SOURCES = \
vjsn.c \ vjsn.c \
vjsn.h \ vjsn.h \
vsc_priv.h \
vsl_api.h \ vsl_api.h \
vxp.h \ vxp.h \
vxp_tokens.h \ vxp_tokens.h \
......
...@@ -193,4 +193,6 @@ LIBVARNISHAPI_1.7 { ...@@ -193,4 +193,6 @@ LIBVARNISHAPI_1.7 {
VSM_Status; VSM_Status;
VSM_Arg; VSM_Arg;
VSM_Dup; VSM_Dup;
VSC_New;
VSC_Destroy;
} LIBVARNISHAPI_1.0; } LIBVARNISHAPI_1.0;
...@@ -51,8 +51,6 @@ ...@@ -51,8 +51,6 @@
#include "vapi/vsc.h" #include "vapi/vsc.h"
#include "vapi/vsm.h" #include "vapi/vsm.h"
#include "vsc_priv.h"
struct vsc_sf { struct vsc_sf {
unsigned magic; unsigned magic;
#define VSC_SF_MAGIC 0x558478dd #define VSC_SF_MAGIC 0x558478dd
...@@ -65,6 +63,7 @@ struct vsc { ...@@ -65,6 +63,7 @@ struct vsc {
unsigned magic; unsigned magic;
#define VSC_MAGIC 0x3373554a #define VSC_MAGIC 0x3373554a
struct vsm *vsm;
struct vsc_sf_head sf_list_include; struct vsc_sf_head sf_list_include;
struct vsc_sf_head sf_list_exclude; struct vsc_sf_head sf_list_exclude;
}; };
...@@ -116,20 +115,18 @@ VSC_Destroy_Point(struct VSC_point **p) ...@@ -116,20 +115,18 @@ VSC_Destroy_Point(struct VSC_point **p)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static struct vsc * struct vsc *
vsc_setup(struct vsm *vd) VSC_New(struct vsm *vsm)
{ {
struct vsc *vsc; struct vsc *vsc;
vsc = VSM_GetVSC(vd); AN(vsm);
if (vsc == NULL) { ALLOC_OBJ(vsc, VSC_MAGIC);
ALLOC_OBJ(vsc, VSC_MAGIC); if (vsc == NULL)
AN(vsc); return (vsc);
VTAILQ_INIT(&vsc->sf_list_include); vsc->vsm = vsm;
VTAILQ_INIT(&vsc->sf_list_exclude); VTAILQ_INIT(&vsc->sf_list_include);
VSM_SetVSC(vd, vsc); VTAILQ_INIT(&vsc->sf_list_exclude);
}
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
return (vsc); return (vsc);
} }
...@@ -150,10 +147,11 @@ vsc_delete_sf_list(struct vsc_sf_head *head) ...@@ -150,10 +147,11 @@ vsc_delete_sf_list(struct vsc_sf_head *head)
} }
void void
VSC_Delete(struct vsc *vsc) VSC_Destroy(struct vsc **vscp)
{ {
struct vsc *vsc;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); TAKE_OBJ_NOTNULL(vsc, vscp, VSC_MAGIC);
vsc_delete_sf_list(&vsc->sf_list_include); vsc_delete_sf_list(&vsc->sf_list_include);
vsc_delete_sf_list(&vsc->sf_list_exclude); vsc_delete_sf_list(&vsc->sf_list_exclude);
FREE_OBJ(vsc); FREE_OBJ(vsc);
...@@ -162,13 +160,11 @@ VSC_Delete(struct vsc *vsc) ...@@ -162,13 +160,11 @@ VSC_Delete(struct vsc *vsc)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static int static int
vsc_f_arg(struct vsm *vd, const char *opt) vsc_f_arg(struct vsc *vsc, const char *opt)
{ {
struct vsc *vsc = vsc_setup(vd);
struct vsc_sf *sf; struct vsc_sf *sf;
unsigned exclude = 0; unsigned exclude = 0;
AN(vd);
AN(opt); AN(opt);
ALLOC_OBJ(sf, VSC_SF_MAGIC); ALLOC_OBJ(sf, VSC_SF_MAGIC);
...@@ -193,14 +189,16 @@ vsc_f_arg(struct vsm *vd, const char *opt) ...@@ -193,14 +189,16 @@ vsc_f_arg(struct vsm *vd, const char *opt)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
int int
VSC_Arg(struct vsm *vd, char arg, const char *opt) VSC_Arg(struct vsc *vsc, char arg, const char *opt)
{ {
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
switch (arg) { switch (arg) {
case 'f': return (vsc_f_arg(vd, opt)); case 'f': return (vsc_f_arg(vsc, opt));
case 'n': case 'n':
case 't': case 't':
return (VSM_Arg(vd, arg, opt)); return (VSM_Arg(vsc->vsm, arg, opt));
default: default:
return (0); return (0);
} }
...@@ -210,11 +208,11 @@ VSC_Arg(struct vsm *vd, char arg, const char *opt) ...@@ -210,11 +208,11 @@ VSC_Arg(struct vsm *vd, char arg, const char *opt)
*/ */
static int static int
vsc_filter(struct vsm *vd, const char *nm) vsc_filter(const struct vsc *vsc, const char *nm)
{ {
struct vsc *vsc = vsc_setup(vd);
struct vsc_sf *sf; struct vsc_sf *sf;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
VTAILQ_FOREACH(sf, &vsc->sf_list_exclude, list) VTAILQ_FOREACH(sf, &vsc->sf_list_exclude, list)
if (!fnmatch(sf->pattern, nm, 0)) if (!fnmatch(sf->pattern, nm, 0))
return (1); return (1);
...@@ -230,12 +228,13 @@ vsc_filter(struct vsm *vd, const char *nm) ...@@ -230,12 +228,13 @@ vsc_filter(struct vsm *vd, const char *nm)
*/ */
static int static int
vsc_iter_elem(struct vsm *vd, const struct vsm_fantom *fantom, vsc_iter_elem(const struct vsc *vsc, const struct vsm_fantom *fantom,
const struct vjsn_val *vv, struct vsb *vsb, VSC_iter_f *func, void *priv) const struct vjsn_val *vv, struct vsb *vsb, VSC_iter_f *func, void *priv)
{ {
struct VSC_point point; struct VSC_point point;
struct vjsn_val *vt; struct vjsn_val *vt;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
memset(&point, 0, sizeof point); memset(&point, 0, sizeof point);
vt = vjsn_child(vv, "name"); vt = vjsn_child(vv, "name");
...@@ -246,7 +245,7 @@ vsc_iter_elem(struct vsm *vd, const struct vsm_fantom *fantom, ...@@ -246,7 +245,7 @@ vsc_iter_elem(struct vsm *vd, const struct vsm_fantom *fantom,
VSB_printf(vsb, "%s.%s", fantom->ident, vt->value); VSB_printf(vsb, "%s.%s", fantom->ident, vt->value);
AZ(VSB_finish(vsb)); AZ(VSB_finish(vsb));
if (vsc_filter(vd, VSB_data(vsb))) if (vsc_filter(vsc, VSB_data(vsb)))
return (0); return (0);
point.name = VSB_data(vsb); point.name = VSB_data(vsb);
...@@ -315,7 +314,7 @@ vsc_iter_elem(struct vsm *vd, const struct vsm_fantom *fantom, ...@@ -315,7 +314,7 @@ vsc_iter_elem(struct vsm *vd, const struct vsm_fantom *fantom,
} }
static int static int
vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom, vsc_iter_fantom(const struct vsc *vsc, const struct vsm_fantom *fantom,
struct vsb *vsb, VSC_iter_f *func, void *priv) struct vsb *vsb, VSC_iter_f *func, void *priv)
{ {
int i = 0; int i = 0;
...@@ -324,6 +323,8 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom, ...@@ -324,6 +323,8 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom,
struct vjsn *vj; struct vjsn *vj;
struct vjsn_val *vv, *vve; struct vjsn_val *vv, *vve;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
p = (char*)fantom->b + 8 + vbe64dec(fantom->b); p = (char*)fantom->b + 8 + vbe64dec(fantom->b);
assert (p < (char*)fantom->e); assert (p < (char*)fantom->e);
vj = vjsn_parse(p, &e); vj = vjsn_parse(p, &e);
...@@ -332,7 +333,7 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom, ...@@ -332,7 +333,7 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom,
vve = vjsn_child(vj->value, "elem"); vve = vjsn_child(vj->value, "elem");
AN(vve); AN(vve);
VTAILQ_FOREACH(vv, &vve->children, list) { VTAILQ_FOREACH(vv, &vve->children, list) {
i = vsc_iter_elem(vd, fantom, vv, vsb, func, priv); i = vsc_iter_elem(vsc, fantom, vv, vsb, func, priv);
if (i) if (i)
break; break;
} }
...@@ -343,21 +344,21 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom, ...@@ -343,21 +344,21 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom,
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
*/ */
int int __match_proto__() // We don't want vsc to be const
VSC_Iter(struct vsm *vd, struct vsm_fantom *fantom, VSC_iter_f *func, VSC_Iter(struct vsc *vsc, struct vsm_fantom *f, VSC_iter_f *func, void *priv)
void *priv)
{ {
struct vsm_fantom ifantom; struct vsm_fantom ifantom;
uint64_t u; uint64_t u;
int i = 0; int i = 0;
struct vsb *vsb; struct vsb *vsb;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
vsb = VSB_new_auto(); vsb = VSB_new_auto();
AN(vsb); AN(vsb);
VSM_FOREACH(&ifantom, vd) { VSM_FOREACH(&ifantom, vsc->vsm) {
if (strcmp(ifantom.class, VSC_CLASS)) if (strcmp(ifantom.class, VSC_CLASS))
continue; continue;
AZ(VSM_Map(vd, &ifantom)); AZ(VSM_Map(vsc->vsm, &ifantom));
u = vbe64dec(ifantom.b); u = vbe64dec(ifantom.b);
if (u == 0) { if (u == 0) {
VRMB(); VRMB();
...@@ -365,11 +366,12 @@ VSC_Iter(struct vsm *vd, struct vsm_fantom *fantom, VSC_iter_f *func, ...@@ -365,11 +366,12 @@ VSC_Iter(struct vsm *vd, struct vsm_fantom *fantom, VSC_iter_f *func,
u = vbe64dec(ifantom.b); u = vbe64dec(ifantom.b);
} }
assert(u > 0); assert(u > 0);
if (fantom != NULL) i = vsc_iter_fantom(vsc, &ifantom, vsb, func, priv);
*fantom = ifantom; if (f != NULL) {
i = vsc_iter_fantom(vd, &ifantom, vsb, func, priv); *f = ifantom;
if (fantom == NULL) } else {
AZ(VSM_Unmap(vd, &ifantom)); AZ(VSM_Unmap(vsc->vsm, &ifantom));
}
if (i) if (i)
break; break;
} }
......
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 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.
*
*/
struct vsc;
struct vsm;
void VSM_SetVSC(struct vsm *, struct vsc *);
struct vsc *VSM_GetVSC(const struct vsm *);
void VSC_Delete(struct vsc *);
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include "vin.h" #include "vin.h"
#include "vsb.h" #include "vsb.h"
#include "vsm_priv.h" #include "vsm_priv.h"
#include "vsc_priv.h"
#include "vqueue.h" #include "vqueue.h"
#include "vtim.h" #include "vtim.h"
...@@ -115,7 +114,6 @@ struct vsm { ...@@ -115,7 +114,6 @@ struct vsm {
struct stat dst; struct stat dst;
char *dname; char *dname;
struct vsc *vsc;
struct vsm_set *mgt; struct vsm_set *mgt;
struct vsm_set *child; struct vsm_set *child;
...@@ -239,8 +237,6 @@ VSM_Destroy(struct vsm **vdp) ...@@ -239,8 +237,6 @@ VSM_Destroy(struct vsm **vdp)
TAKE_OBJ_NOTNULL(vd, vdp, VSM_MAGIC); TAKE_OBJ_NOTNULL(vd, vdp, VSM_MAGIC);
if (vd->vsc != NULL)
VSC_Delete(vd->vsc);
VSM_ResetError(vd); VSM_ResetError(vd);
free(vd->dname); free(vd->dname);
vsm_delset(&vd->mgt); vsm_delset(&vd->mgt);
...@@ -252,24 +248,6 @@ VSM_Destroy(struct vsm **vdp) ...@@ -252,24 +248,6 @@ VSM_Destroy(struct vsm **vdp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void
VSM_SetVSC(struct vsm *vd, struct vsc *vsc)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
vd->vsc = vsc;
}
struct vsc *
VSM_GetVSC(const struct vsm *vd)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
return (vd->vsc);
}
/*--------------------------------------------------------------------*/
const char * const char *
VSM_Error(const struct vsm *vd) VSM_Error(const struct vsm *vd)
{ {
......
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