[master] 4c6b271 Retire the old VSC field definitions entirely.
Poul-Henning Kamp
phk at FreeBSD.org
Sat May 27 13:50:06 CEST 2017
commit 4c6b2717c61644db4bd6804372b591598cdd720f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat May 27 11:47:46 2017 +0000
Retire the old VSC field definitions entirely.
diff --git a/include/Makefile.am b/include/Makefile.am
index 64fa642..d256448 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -37,11 +37,7 @@ nobase_pkginclude_HEADERS = \
tbl/vhp_huffman.h \
tbl/vhp_static.h \
tbl/vrt_stv_var.h \
- tbl/vsc_all.h \
- tbl/vsc_f_main.h \
- tbl/vsc_fields.h \
tbl/vsc_levels.h \
- tbl/vsc_types.h \
tbl/vsl_tags.h \
tbl/vsl_tags_http.h \
tbl/waiters.h \
diff --git a/include/tbl/vsc_all.h b/include/tbl/vsc_all.h
deleted file mode 100644
index c77c2b8..0000000
--- a/include/tbl/vsc_all.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * Copyright (c) 2010-2015 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at 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.
- *
- */
-
-/*lint -save -e525 -e539 */
-
-VSC_DO(MAIN, main, VSC_type_main, "MAIN COUNTERS (MAIN.*)")
- #define VSC_FF VSC_F
- #include "tbl/vsc_f_main.h"
- #undef VSC_FF
-VSC_DONE(MAIN, main, VSC_type_main)
-
-VSC_DO(MGT, mgt, VSC_type_mgt, "MANAGEMENT PROCESS COUNTERS (MGT.*)")
- #define VSC_DO_MGT
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_MGT
-VSC_DONE(MGT, mgt, VSC_type_mgt)
-
-VSC_DO(MEMPOOL, mempool, VSC_type_mempool, "MEMORY POOL COUNTERS (MEMPOOL.*)")
- #define VSC_DO_MEMPOOL
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_MEMPOOL
-VSC_DONE(MEMPOOL, mempool, VSC_type_mempool)
-
-VSC_DO(SMA, sma, VSC_type_sma, "MALLOC STORAGE COUNTERS (SMA.*)")
- #define VSC_DO_SMA
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_SMA
-VSC_DONE(SMA, sma, VSC_type_sma)
-
-VSC_DO(SMF, smf, VSC_type_smf, "FILE STORAGE COUNTERS (SMF.*)")
- #define VSC_DO_SMF
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_SMF
-VSC_DONE(SMF, smf, VSC_type_smf)
-
-VSC_DO(VBE, vbe, VSC_type_vbe, "BACKEND COUNTERS (VBE.*)")
- #define VSC_DO_VBE
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_VBE
-VSC_DONE(VBE, vbe, VSC_type_vbe)
-
-VSC_DO(LCK, lck, VSC_type_lck, "LOCK COUNTERS (LCK.*)")
- #define VSC_DO_LCK
- #define VSC_FF VSC_F
- #include "tbl/vsc_fields.h"
- #undef VSC_FF
- #undef VSC_DO_LCK
-VSC_DONE(LCK, lck, VSC_type_lck)
-
-#undef VSC_DO
-#undef VSC_F
-#undef VSC_DONE
-
-/*lint -restore */
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
deleted file mode 100644
index 2a109c8..0000000
--- a/include/tbl/vsc_f_main.h
+++ /dev/null
@@ -1,735 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2015 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at 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.
- *
- * Definition of the main shared memory statistics below.
- *
- * See include/tbl/vsc_fields.h for the table definition.
- */
-
-/*lint -save -e525 -e539 */
-
-VSC_FF(summs, uint64_t, 0, 'c', 'd', debug, "", "")
-
-/*--------------------------------------------------------------------
- * Globals, not related to traffic
- */
-
-VSC_FF(uptime, uint64_t, 0, 'c', 'd', info,
- "Child process uptime",
- "How long the child process has been running."
-)
-
-/*---------------------------------------------------------------------
- * Sessions
- */
-
-VSC_FF(sess_conn, uint64_t, 1, 'c', 'i', info,
- "Sessions accepted",
- "Count of sessions successfully accepted"
-)
-
-VSC_FF(sess_drop, uint64_t, 1, 'c', 'i', info,
- "Sessions dropped",
- "Count of sessions silently dropped due to lack of worker thread."
-)
-
-VSC_FF(sess_fail, uint64_t, 1, 'c', 'i', info,
- "Session accept failures",
- "Count of failures to accept TCP connection."
- " Either the client changed its mind, or the kernel ran out of"
- " some resource like file descriptors."
-)
-
-/*---------------------------------------------------------------------*/
-
-VSC_FF(client_req_400, uint64_t, 1, 'c', 'i', info,
- "Client requests received, subject to 400 errors",
- "400 means we couldn't make sense of the request, it was"
- " malformed in some drastic way."
-)
-
-VSC_FF(client_req_417, uint64_t, 1, 'c', 'i', info,
- "Client requests received, subject to 417 errors",
- "417 means that something went wrong with an Expect: header."
-)
-
-VSC_FF(client_req, uint64_t, 1, 'c', 'i', info,
- "Good client requests received",
- "The count of parseable client requests seen."
-)
-
-/*---------------------------------------------------------------------*/
-
-VSC_FF(cache_hit, uint64_t, 1, 'c', 'i', info,
- "Cache hits",
- "Count of cache hits. "
- " A cache hit indicates that an object has been delivered to a"
- " client without fetching it from a backend server."
-)
-
-VSC_FF(cache_hitpass, uint64_t, 1, 'c', 'i', info,
- "Cache hits for pass.",
- "Count of hits for pass."
- " A cache hit for pass indicates that Varnish is going to"
- " pass the request to the backend and this decision has been"
- " cached in it self. This counts how many times the cached"
- " decision is being used."
-)
-
-VSC_FF(cache_hitmiss, uint64_t, 1, 'c', 'i', info,
- "Cache hits for miss.",
- "Count of hits for miss."
- " A cache hit for miss indicates that Varnish is going to"
- " proceed as for a cache miss without request coalescing, and"
- " this decision has been cached. This counts how many times the"
- " cached decision is being used."
-)
-
-VSC_FF(cache_miss, uint64_t, 1, 'c', 'i', info,
- "Cache misses",
- "Count of misses."
- " A cache miss indicates the object was fetched from the"
- " backend before delivering it to the client."
-)
-
-/*---------------------------------------------------------------------*/
-
-VSC_FF(backend_conn, uint64_t, 0, 'c', 'i', info,
- "Backend conn. success",
- "How many backend connections have successfully been"
- " established."
-)
-
-VSC_FF(backend_unhealthy, uint64_t, 0, 'c', 'i', info,
- "Backend conn. not attempted",
- ""
-)
-
-VSC_FF(backend_busy, uint64_t, 0, 'c', 'i', info,
- "Backend conn. too many",
- ""
-)
-
-VSC_FF(backend_fail, uint64_t, 0, 'c', 'i', info,
- "Backend conn. failures",
- ""
-)
-
-VSC_FF(backend_reuse, uint64_t, 0, 'c', 'i', info,
- "Backend conn. reuses",
- "Count of backend connection reuses."
- " This counter is increased whenever we reuse a recycled connection."
-)
-
-VSC_FF(backend_recycle, uint64_t, 0, 'c', 'i', info,
- "Backend conn. recycles",
- "Count of backend connection recycles."
- " This counter is increased whenever we have a keep-alive"
- " connection that is put back into the pool of connections."
- " It has not yet been used, but it might be, unless the backend"
- " closes it."
-)
-
-VSC_FF(backend_retry, uint64_t, 0, 'c', 'i', info,
- "Backend conn. retry",
- ""
-)
-
-/*---------------------------------------------------------------------
- * Backend fetch statistics
- */
-
-VSC_FF(fetch_head, uint64_t, 1, 'c', 'i', info,
- "Fetch no body (HEAD)",
- "beresp with no body because the request is HEAD."
-)
-
-VSC_FF(fetch_length, uint64_t, 1, 'c', 'i', info,
- "Fetch with Length",
- "beresp.body with Content-Length."
-)
-
-VSC_FF(fetch_chunked, uint64_t, 1, 'c', 'i', info,
- "Fetch chunked",
- "beresp.body with Chunked."
-)
-
-VSC_FF(fetch_eof, uint64_t, 1, 'c', 'i', info,
- "Fetch EOF",
- "beresp.body with EOF."
-)
-
-VSC_FF(fetch_bad, uint64_t, 1, 'c', 'i', info,
- "Fetch bad T-E",
- "beresp.body length/fetch could not be determined."
-)
-
-VSC_FF(fetch_none, uint64_t, 1, 'c', 'i', info,
- "Fetch no body",
- "beresp.body empty"
-)
-
-VSC_FF(fetch_1xx, uint64_t, 1, 'c', 'i', info,
- "Fetch no body (1xx)",
- "beresp with no body because of 1XX response."
-)
-
-VSC_FF(fetch_204, uint64_t, 1, 'c', 'i', info,
- "Fetch no body (204)",
- "beresp with no body because of 204 response."
-)
-
-VSC_FF(fetch_304, uint64_t, 1, 'c', 'i', info,
- "Fetch no body (304)",
- "beresp with no body because of 304 response."
-)
-
-VSC_FF(fetch_failed, uint64_t, 1, 'c', 'i', info,
- "Fetch failed (all causes)",
- "beresp fetch failed."
-)
-
-VSC_FF(fetch_no_thread, uint64_t, 1, 'c', 'i', info,
- "Fetch failed (no thread)",
- "beresp fetch failed, no thread available."
-)
-
-/*---------------------------------------------------------------------
- * Pools, threads, and sessions
- * see: cache_pool.c
- *
- */
-
-VSC_FF(pools, uint64_t, 0, 'g', 'i', info,
- "Number of thread pools",
- "Number of thread pools. See also parameter thread_pools."
- " NB: Presently pools cannot be removed once created."
-)
-
-VSC_FF(threads, uint64_t, 0, 'g', 'i', info,
- "Total number of threads",
- "Number of threads in all pools."
- " See also parameters thread_pools, thread_pool_min and"
- " thread_pool_max."
-)
-
-VSC_FF(threads_limited, uint64_t, 0, 'c', 'i', info,
- "Threads hit max",
- "Number of times more threads were needed, but limit was reached"
- " in a thread pool. See also parameter thread_pool_max."
-)
-
-VSC_FF(threads_created, uint64_t, 0, 'c', 'i', info,
- "Threads created",
- "Total number of threads created in all pools."
-)
-
-VSC_FF(threads_destroyed, uint64_t, 0, 'c', 'i', info,
- "Threads destroyed",
- "Total number of threads destroyed in all pools."
-)
-
-VSC_FF(threads_failed, uint64_t, 0, 'c', 'i', info,
- "Thread creation failed",
- "Number of times creating a thread failed."
- " See VSL::Debug for diagnostics."
- " See also parameter thread_fail_delay."
-)
-
-VSC_FF(thread_queue_len, uint64_t, 0, 'g', 'i', info,
- "Length of session queue",
- "Length of session queue waiting for threads."
- " NB: Only updates once per second."
- " See also parameter thread_queue_limit."
-)
-
-VSC_FF(busy_sleep, uint64_t, 1, 'c', 'i', info,
- "Number of requests sent to sleep on busy objhdr",
- "Number of requests sent to sleep without a worker thread because"
- " they found a busy object."
-)
-
-VSC_FF(busy_wakeup, uint64_t, 1, 'c', 'i', info,
- "Number of requests woken after sleep on busy objhdr",
- "Number of requests taken off the busy object sleep list and"
- " rescheduled."
-)
-
-VSC_FF(busy_killed, uint64_t, 1, 'c', 'i', info,
- "Number of requests killed after sleep on busy objhdr",
- "Number of requests killed from the busy object sleep list"
- " due to lack of resources."
-)
-
-VSC_FF(sess_queued, uint64_t, 0, 'c', 'i', info,
- "Sessions queued for thread",
- "Number of times session was queued waiting for a thread."
- " See also parameter thread_queue_limit."
-)
-
-VSC_FF(sess_dropped, uint64_t, 0, 'c', 'i', info,
- "Sessions dropped for thread",
- "Number of times session was dropped because the queue were too"
- " long already. See also parameter thread_queue_limit."
-)
-
-/*---------------------------------------------------------------------*/
-
-VSC_FF(n_object, uint64_t, 1, 'g', 'i', info,
- "object structs made",
- "Approximate number of HTTP objects (headers + body, if present)"
- " in the cache."
-)
-
-VSC_FF(n_vampireobject, uint64_t, 1, 'g', 'i', diag,
- "unresurrected objects",
- "Number of unresurrected objects"
-)
-
-VSC_FF(n_objectcore, uint64_t, 1, 'g', 'i', info,
- "objectcore structs made",
- "Approximate number of object metadata elements in the cache."
- " Each object needs an objectcore, extra objectcores are for"
- " hit-for-miss, hit-for-pass and busy objects."
-)
-
-VSC_FF(n_objecthead, uint64_t, 1, 'g', 'i', info,
- "objecthead structs made",
- "Approximate number of different hash entries in the cache."
-)
-
-VSC_FF(n_backend, uint64_t, 0, 'g', 'i', info,
- "Number of backends",
- "Number of backends known to us."
-)
-
-VSC_FF(n_expired, uint64_t, 0, 'g', 'i', info,
- "Number of expired objects",
- "Number of objects that expired from cache"
- " because of old age."
-)
-
-VSC_FF(n_lru_nuked, uint64_t, 0, 'g', 'i', info,
- "Number of LRU nuked objects",
- "How many objects have been forcefully evicted"
- " from storage to make room for a new object."
-)
-
-VSC_FF(n_lru_moved, uint64_t, 0, 'g', 'i', diag,
- "Number of LRU moved objects",
- "Number of move operations done on the LRU list."
-)
-
-VSC_FF(losthdr, uint64_t, 0, 'c', 'i', info,
- "HTTP header overflows",
- ""
-)
-
-VSC_FF(s_sess, uint64_t, 1, 'c', 'i', info,
- "Total sessions seen",
- ""
-)
-
-VSC_FF(s_req, uint64_t, 1, 'c', 'i', info,
- "Total requests seen",
- ""
-)
-
-VSC_FF(s_pipe, uint64_t, 1, 'c', 'i', info,
- "Total pipe sessions seen",
- ""
-)
-
-VSC_FF(s_pass, uint64_t, 1, 'c', 'i', info,
- "Total pass-ed requests seen",
- ""
-)
-
-VSC_FF(s_fetch, uint64_t, 1, 'c', 'i', info,
- "Total backend fetches initiated",
- ""
-)
-
-VSC_FF(s_synth, uint64_t, 1, 'c', 'i', info,
- "Total synthethic responses made",
- ""
-)
-
-VSC_FF(s_req_hdrbytes, uint64_t, 1, 'c', 'B', info,
- "Request header bytes",
- "Total request header bytes received"
-)
-
-VSC_FF(s_req_bodybytes, uint64_t, 1, 'c', 'B', info,
- "Request body bytes",
- "Total request body bytes received"
-)
-
-VSC_FF(s_resp_hdrbytes, uint64_t, 1, 'c', 'B', info,
- "Response header bytes",
- "Total response header bytes transmitted"
-)
-
-VSC_FF(s_resp_bodybytes, uint64_t, 1, 'c', 'B', info,
- "Response body bytes",
- "Total response body bytes transmitted"
-)
-
-VSC_FF(s_pipe_hdrbytes, uint64_t, 0, 'c', 'B', info,
- "Pipe request header bytes",
- "Total request bytes received for piped sessions"
-)
-
-VSC_FF(s_pipe_in, uint64_t, 0, 'c', 'B', info,
- "Piped bytes from client",
- "Total number of bytes forwarded from clients in"
- " pipe sessions"
-)
-
-VSC_FF(s_pipe_out, uint64_t, 0, 'c', 'B', info,
- "Piped bytes to client",
- "Total number of bytes forwarded to clients in"
- " pipe sessions"
-)
-
-VSC_FF(sess_closed, uint64_t, 1, 'c', 'i', info,
- "Session Closed",
- ""
-)
-
-VSC_FF(sess_closed_err, uint64_t, 0, 'c', 'i', info,
- "Session Closed with error",
- "Total number of sessions closed with errors."
- " See sc_* diag counters for detailed breakdown"
-)
-
-VSC_FF(sess_readahead, uint64_t, 1, 'c', 'i', info,
- "Session Read Ahead",
- ""
-)
-
-VSC_FF(sess_herd, uint64_t, 1, 'c', 'i', diag,
- "Session herd",
- "Number of times the timeout_linger triggered"
-)
-
-#define SESS_CLOSE_ERR0 "OK "
-#define SESS_CLOSE_ERR1 "Err "
-#define SESS_CLOSE_ERROR0 ""
-#define SESS_CLOSE_ERROR1 "Error "
-#define SESS_CLOSE(r, f, e, s) \
-VSC_FF(sc_ ## f, uint64_t, 0, 'c', 'i', diag, \
- "Session " SESS_CLOSE_ERR ## e #r, \
- "Number of session closes with " \
- SESS_CLOSE_ERROR ## e #r " (" s ")" \
-)
-#include "tbl/sess_close.h"
-#undef SESS_CLOSE_ERROR1
-#undef SESS_CLOSE_ERROR0
-#undef SESS_CLOSE_ERR1
-#undef SESS_CLOSE_ERR0
-#undef SESS_CLOSE
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(shm_records, uint64_t, 0, 'c', 'i', diag,
- "SHM records",
- ""
-)
-
-VSC_FF(shm_writes, uint64_t, 0, 'c', 'i', diag,
- "SHM writes",
- ""
-)
-
-VSC_FF(shm_flushes, uint64_t, 0, 'c', 'i', diag,
- "SHM flushes due to overflow",
- ""
-)
-
-VSC_FF(shm_cont, uint64_t, 0, 'c', 'i', diag,
- "SHM MTX contention",
- ""
-)
-
-VSC_FF(shm_cycles, uint64_t, 0, 'c', 'i', diag,
- "SHM cycles through buffer",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(backend_req, uint64_t, 0, 'c', 'i', info,
- "Backend requests made",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(n_vcl, uint64_t, 0, 'c', 'i', info,
- "Number of loaded VCLs in total",
- ""
-)
-
-VSC_FF(n_vcl_avail, uint64_t, 0, 'c', 'i', diag,
- "Number of VCLs available",
- ""
-)
-
-VSC_FF(n_vcl_discard, uint64_t, 0, 'c', 'i', diag,
- "Number of discarded VCLs",
- ""
-)
-
-VSC_FF(vcl_fail, uint64_t, 1, 'c', 'i', info,
- "VCL failures",
- "Count of failures which prevented VCL from completing."
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(bans, uint64_t, 0, 'g', 'i', info,
- "Count of bans",
- "Number of all bans in system, including bans superseded"
- " by newer bans and bans already checked by the ban-lurker."
-)
-
-VSC_FF(bans_completed, uint64_t, 0, 'g', 'i', diag,
- "Number of bans marked 'completed'",
- "Number of bans which are no longer active, either because they"
- " got checked by the ban-lurker or superseded by newer identical bans."
-)
-
-VSC_FF(bans_obj, uint64_t, 0, 'g', 'i', diag,
- "Number of bans using obj.*",
- "Number of bans which use obj.* variables. These bans can possibly"
- " be washed by the ban-lurker."
-)
-
-VSC_FF(bans_req, uint64_t, 0, 'g', 'i', diag,
- "Number of bans using req.*",
- "Number of bans which use req.* variables. These bans can not"
- " be washed by the ban-lurker."
-)
-
-VSC_FF(bans_added, uint64_t, 0, 'c', 'i', diag,
- "Bans added",
- "Counter of bans added to ban list."
-)
-
-VSC_FF(bans_deleted, uint64_t, 0, 'c', 'i', diag,
- "Bans deleted",
- "Counter of bans deleted from ban list."
-)
-
-VSC_FF(bans_tested, uint64_t, 0, 'c', 'i', diag,
- "Bans tested against objects (lookup)",
- "Count of how many bans and objects have been tested against"
- " each other during hash lookup."
-)
-
-VSC_FF(bans_obj_killed, uint64_t, 0, 'c', 'i', diag,
- "Objects killed by bans (lookup)",
- "Number of objects killed by bans during object lookup."
-)
-
-VSC_FF(bans_lurker_tested, uint64_t, 0, 'c', 'i', diag,
- "Bans tested against objects (lurker)",
- "Count of how many bans and objects have been tested against"
- " each other by the ban-lurker."
-)
-
-VSC_FF(bans_tests_tested, uint64_t, 0, 'c', 'i', diag,
- "Ban tests tested against objects (lookup)",
- "Count of how many tests and objects have been tested against"
- " each other during lookup."
- " 'ban req.url == foo && req.http.host == bar'"
- " counts as one in 'bans_tested' and as two in 'bans_tests_tested'"
-)
-
-VSC_FF(bans_lurker_tests_tested, uint64_t, 0, 'c', 'i', diag,
- "Ban tests tested against objects (lurker)",
- "Count of how many tests and objects have been tested against"
- " each other by the ban-lurker."
- " 'ban req.url == foo && req.http.host == bar'"
- " counts as one in 'bans_tested' and as two in 'bans_tests_tested'"
-)
-
-VSC_FF(bans_lurker_obj_killed, uint64_t, 0, 'c', 'i', diag,
- "Objects killed by bans (lurker)",
- "Number of objects killed by the ban-lurker."
-)
-
-VSC_FF(bans_lurker_obj_killed_cutoff, uint64_t, 0, 'c', 'i', diag,
- "Objects killed by bans for cutoff (lurker)",
- "Number of objects killed by the ban-lurker to keep the number of"
- " bans below ban_cutoff."
-)
-
-VSC_FF(bans_dups, uint64_t, 0, 'c', 'i', diag,
- "Bans superseded by other bans",
- "Count of bans replaced by later identical bans."
-)
-
-VSC_FF(bans_lurker_contention, uint64_t, 0, 'c', 'i', diag,
- "Lurker gave way for lookup",
- "Number of times the ban-lurker had to wait for lookups."
-)
-
-VSC_FF(bans_persisted_bytes, uint64_t, 0, 'g', 'B', diag,
- "Bytes used by the persisted ban lists",
- "Number of bytes used by the persisted ban lists."
-)
-
-VSC_FF(bans_persisted_fragmentation, uint64_t, 0, 'g', 'B', diag,
- "Extra bytes in persisted ban lists due to fragmentation",
- "Number of extra bytes accumulated through dropped and"
- " completed bans in the persistent ban lists."
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(n_purges, uint64_t, 0, 'g', 'i', info,
- "Number of purge operations executed",
- ""
-)
-
-VSC_FF(n_obj_purged, uint64_t, 0, 'g', 'i', info,
- "Number of purged objects",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(exp_mailed, uint64_t, 0, 'c', 'i', diag,
- "Number of objects mailed to expiry thread",
- "Number of objects mailed to expiry thread for handling."
-)
-
-VSC_FF(exp_received, uint64_t, 0, 'c', 'i', diag,
- "Number of objects received by expiry thread",
- "Number of objects received by expiry thread for handling."
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(hcb_nolock, uint64_t, 1, 'c', 'i', debug,
- "HCB Lookups without lock",
- ""
-)
-
-VSC_FF(hcb_lock, uint64_t, 0, 'c', 'i', debug,
- "HCB Lookups with lock",
- ""
-)
-
-VSC_FF(hcb_insert, uint64_t, 0, 'c', 'i', debug,
- "HCB Inserts",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(esi_errors, uint64_t, 0, 'c', 'i', diag,
- "ESI parse errors (unlock)",
- ""
-)
-
-VSC_FF(esi_warnings, uint64_t, 0, 'c', 'i', diag,
- "ESI parse warnings (unlock)",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(vmods, uint64_t, 0, 'g', 'i', info,
- "Loaded VMODs",
- ""
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(n_gzip, uint64_t, 0, 'c', 'i', info,
- "Gzip operations",
- ""
-)
-
-VSC_FF(n_gunzip, uint64_t, 0, 'c', 'i', info,
- "Gunzip operations",
- ""
-)
-
-VSC_FF(n_test_gunzip, uint64_t, 0, 'c', 'i', info,
- "Test gunzip operations",
- "Those operations occur when Varnish receives a compressed"
- " object from a backend. They are done to verify the gzip"
- " stream while it's inserted in storage."
-)
-
-/*--------------------------------------------------------------------*/
-
-VSC_FF(vsm_free, uint64_t, 0, 'g', 'B', diag,
- "Free VSM space",
- "Number of bytes free in the shared memory used to communicate"
- " with tools like varnishstat, varnishlog etc."
-)
-
-VSC_FF(vsm_used, uint64_t, 0, 'g', 'B', diag,
- "Used VSM space",
- "Number of bytes used in the shared memory used to communicate"
- " with tools like varnishstat, varnishlog etc."
-)
-
-VSC_FF(vsm_cooling, uint64_t, 0, 'g', 'B', debug,
- "Cooling VSM space",
- "Number of bytes which will soon (max 1 minute) be freed"
- " in the shared memory used to communicate"
- " with tools like varnishstat, varnishlog etc."
-)
-
-VSC_FF(vsm_overflow, uint64_t, 0, 'g', 'B', diag,
- "Overflow VSM space",
- "Number of bytes which does not fit"
- " in the shared memory used to communicate"
- " with tools like varnishstat, varnishlog etc."
- " If this counter is not zero, consider"
- " increasing the runtime variable vsm_space."
-)
-
-VSC_FF(vsm_overflowed, uint64_t, 0, 'c', 'B', diag,
- "Overflowed VSM space",
- "Total number of bytes which did not fit"
- " in the shared memory used to communicate"
- " with tools like varnishstat, varnishlog etc."
- " If this counter is not zero, consider"
- " increasing the runtime variable vsm_space."
-)
-
-#undef VSC_FF
-
-/*lint -restore */
diff --git a/include/tbl/vsc_fields.h b/include/tbl/vsc_fields.h
deleted file mode 100644
index 30c16bd..0000000
--- a/include/tbl/vsc_fields.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2015 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at 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.
- *
- * Definition of all shared memory statistics below (except main - see
- * include/tbl/vsc_f_main.h).
- *
- * Fields (n, t, l, s, f, v, d, e):
- * n - Name: Field name, in C-source and stats programs
- * t - C-type: uint64_t, unless marked in 's'
- * l - Local: Local counter in worker thread.
- * s - Semantics: Semantics of the value in this field
- * 'b' - Bitmap
- * 'c' - Counter, never decreases.
- * 'g' - Gauge, goes up and down
- * f - Format: Display format for the field
- * 'b' - Bitmap
- * 'i' - Integer
- * 'd' - Duration
- * v - Verbosity: Counter verbosity level (see vsc_levels.h)
- * d - Description: Short description of field (for screen use)
- * e - Explanation: Long explanation of field (for doc use)
- *
- * Please describe Gauge variables as "Number of..." to indicate that
- * this is a snapshot, and Counter variables as "Count of" to indicate
- * accumulative count.
- *
- * -----------------------
- * NB: Cleanup in progress
- * -----------------------
- *
- * Insufficient attention has caused this to become a swamp of conflicting
- * conventions, shorthands and general mumbo-jumbo. I'm trying to clean
- * it up as I go over the code in other business.
- *
- * Please see the sessmem section for how it should look.
- *
- */
-
-/*lint -save -e525 -e539 */
-
-/**********************************************************************/
-
-#ifdef VSC_DO_MGT
-
-VSC_FF(uptime, uint64_t, 0, 'c', 'd', info,
- "Management process uptime",
- "Uptime in seconds of the management process"
-)
-
-VSC_FF(child_start, uint64_t, 0, 'c', 'i', diag,
- "Child process started",
- "Number of times the child process has been started"
-)
-
-VSC_FF(child_exit, uint64_t, 0, 'c', 'i', diag,
- "Child process normal exit",
- "Number of times the child process has been cleanly stopped"
-)
-
-VSC_FF(child_stop, uint64_t, 0, 'c', 'i', diag,
- "Child process unexpected exit",
- "Number of times the child process has exited with an unexpected"
- " return code"
-)
-
-VSC_FF(child_died, uint64_t, 0, 'c', 'i', diag,
- "Child process died (signal)",
- "Number of times the child process has died due to signals"
-)
-
-VSC_FF(child_dump, uint64_t, 0, 'c', 'i', diag,
- "Child process core dumped",
- "Number of times the child process has produced core dumps"
-)
-
-VSC_FF(child_panic, uint64_t, 0, 'c', 'i', diag,
- "Child process panic",
- "Number of times the management process has caught a child panic"
-)
-
-#endif
-
-/**********************************************************************/
-
-#ifdef VSC_DO_LCK
-
-VSC_FF(creat, uint64_t, 0, 'c', 'i', debug,
- "Created locks",
- ""
-)
-
-VSC_FF(destroy, uint64_t, 0, 'c', 'i', debug,
- "Destroyed locks",
- ""
-)
-
-VSC_FF(locks, uint64_t, 0, 'c', 'i', debug,
- "Lock Operations",
- ""
-)
-
-#endif
-
-/**********************************************************************
- * All Stevedores support these counters
- */
-
-#if defined(VSC_DO_SMA) || defined (VSC_DO_SMF)
-VSC_FF(c_req, uint64_t, 0, 'c', 'i', info,
- "Allocator requests",
- "Number of times the storage has been asked to provide a storage segment."
-)
-
-VSC_FF(c_fail, uint64_t, 0, 'c', 'i', info,
- "Allocator failures",
- "Number of times the storage has failed to provide a storage segment."
-)
-
-VSC_FF(c_bytes, uint64_t, 0, 'c', 'B', info,
- "Bytes allocated",
- "Number of total bytes allocated by this storage."
-)
-
-VSC_FF(c_freed, uint64_t, 0, 'c', 'B', info,
- "Bytes freed",
- "Number of total bytes returned to this storage."
-)
-
-VSC_FF(g_alloc, uint64_t, 0, 'g', 'i', info,
- "Allocations outstanding",
- "Number of storage allocations outstanding."
-)
-
-VSC_FF(g_bytes, uint64_t, 0, 'g', 'B', info,
- "Bytes outstanding",
- "Number of bytes allocated from the storage."
-)
-
-VSC_FF(g_space, uint64_t, 0, 'g', 'B', info,
- "Bytes available",
- "Number of bytes left in the storage."
-)
-#endif
-
-/**********************************************************************/
-
-#ifdef VSC_DO_SMA
-/* No SMA specific counters */
-#endif
-
-/**********************************************************************/
-
-#ifdef VSC_DO_SMF
-VSC_FF(g_smf, uint64_t, 0, 'g', 'i', info,
- "N struct smf",
- ""
-)
-
-VSC_FF(g_smf_frag, uint64_t, 0, 'g', 'i', info,
- "N small free smf",
- ""
-)
-
-VSC_FF(g_smf_large, uint64_t, 0, 'g', 'i', info,
- "N large free smf",
- ""
-)
-
-#endif
-
-/**********************************************************************/
-
-#ifdef VSC_DO_VBE
-
-VSC_FF(happy, uint64_t, 0, 'b', 'b', info,
- "Happy health probes",
- ""
-)
-
-VSC_FF(bereq_hdrbytes, uint64_t, 0, 'c', 'B', info,
- "Request header bytes",
- "Total backend request header bytes sent"
-)
-
-VSC_FF(bereq_bodybytes, uint64_t, 0, 'c', 'B', info,
- "Request body bytes",
- "Total backend request body bytes sent"
-)
-
-VSC_FF(beresp_hdrbytes, uint64_t, 0, 'c', 'B', info,
- "Response header bytes",
- "Total backend response header bytes received"
-)
-
-VSC_FF(beresp_bodybytes, uint64_t, 0, 'c', 'B', info,
- "Response body bytes",
- "Total backend response body bytes received"
-)
-
-VSC_FF(pipe_hdrbytes, uint64_t, 0, 'c', 'B', info,
- "Pipe request header bytes",
- "Total request bytes sent for piped sessions"
-)
-
-VSC_FF(pipe_out, uint64_t, 0, 'c', 'B', info,
- "Piped bytes to backend",
- "Total number of bytes forwarded to backend in"
- " pipe sessions"
-)
-
-VSC_FF(pipe_in, uint64_t, 0, 'c', 'B', info,
- "Piped bytes from backend",
- "Total number of bytes forwarded from backend in"
- " pipe sessions"
-)
-
-VSC_FF(conn, uint64_t, 0, 'g', 'i', info,
- "Concurrent connections to backend",
- ""
-)
-
-VSC_FF(req, uint64_t, 0, 'c', 'i', info,
- "Backend requests sent",
- ""
-)
-
-#endif
-
-/**********************************************************************/
-#ifdef VSC_DO_MEMPOOL
-
-VSC_FF(live, uint64_t, 0, 'g', 'i', debug,
- "In use",
- ""
-)
-
-VSC_FF(pool, uint64_t, 0, 'g', 'i', debug,
- "In Pool",
- ""
-)
-
-VSC_FF(sz_wanted, uint64_t, 0, 'g', 'B', debug,
- "Size requested",
- ""
-)
-
-VSC_FF(sz_actual, uint64_t, 0, 'g', 'B', debug,
- "Size allocated",
- ""
-)
-
-VSC_FF(allocs, uint64_t, 0, 'c', 'i', debug,
- "Allocations",
- ""
-)
-
-VSC_FF(frees, uint64_t, 0, 'c', 'i', debug,
- "Frees",
- ""
-)
-
-VSC_FF(recycle, uint64_t, 0, 'c', 'i', debug,
- "Recycled from pool",
- ""
-)
-
-VSC_FF(timeout, uint64_t, 0, 'c', 'i', debug,
- "Timed out from pool",
- ""
-)
-
-VSC_FF(toosmall, uint64_t, 0, 'c', 'i', debug,
- "Too small to recycle",
- ""
-)
-
-VSC_FF(surplus, uint64_t, 0, 'c', 'i', debug,
- "Too many for pool",
- ""
-)
-
-VSC_FF(randry, uint64_t, 0, 'c', 'i', debug,
- "Pool ran dry",
- ""
-)
-
-#endif
-
-#undef VSC_FF
-
-/*lint -restore */
diff --git a/include/tbl/vsc_types.h b/include/tbl/vsc_types.h
deleted file mode 100644
index 20adc1c..0000000
--- a/include/tbl/vsc_types.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2014 Varnish Software AS
- * All rights reserved.
- *
- * Author: Martin Blix Grydeland <martin at varnish-software.com>
- *
- * 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.
- *
- * Fields (n, l, e, d):
- * n - Name: Field name, in C-source
- * t - Type: Type name, in shm chunk
- * l - Label: Display name, in stats programs
- * e - Explanation: Short description of this counter type
- * d - Description: Long description of this counter type
- *
- * The order in which the types are defined in this file determines the
- * order in which counters are reported in the API, and then also the
- * display order in varnishstat.
- */
-
-/*lint -save -e525 -e539 */
-
-VSC_TYPE_F(main, "MAIN", "", "Child",
- "Child process main counters"
-)
-
-VSC_TYPE_F(mgt, "MGT", "MGT", "Master",
- "Management process counters"
-)
-
-VSC_TYPE_F(mempool, "MEMPOOL", "MEMPOOL", "Memory pool",
- "Memory pool counters"
-)
-
-VSC_TYPE_F(sma, "SMA", "SMA", "Storage malloc",
- "Malloc storage counters"
-)
-
-VSC_TYPE_F(smf, "SMF", "SMF", "Storage file",
- "File storage counters"
-)
-
-VSC_TYPE_F(vbe, "VBE", "VBE", "Backend",
- "Backend counters"
-)
-
-VSC_TYPE_F(lck, "LCK", "LCK", "Lock",
- "Mutex lock counters"
-)
-
-#undef VSC_TYPE_F
-
-/*lint -restore */
diff --git a/lib/libvarnishapi/vjsn.c b/lib/libvarnishapi/vjsn.c
index 444a471..01f10c2 100644
--- a/lib/libvarnishapi/vjsn.c
+++ b/lib/libvarnishapi/vjsn.c
@@ -428,6 +428,20 @@ vjsn_parse(const char *src, const char **err)
return (js);
}
+struct vjsn_val *
+vjsn_child(const struct vjsn_val *vv, const char *key)
+{
+ struct vjsn_val *vc;
+
+ CHECK_OBJ_NOTNULL(vv, VJSN_VAL_MAGIC);
+ AN(key);
+ VTAILQ_FOREACH(vc, &vv->children, list) {
+ if (vc->name != NULL && !strcmp(vc->name, key))
+ return (vc);
+ }
+ return (NULL);
+}
+
static void
vjsn_dump_i(const struct vjsn_val *jsv, FILE *fo, int indent)
{
diff --git a/lib/libvarnishapi/vjsn.h b/lib/libvarnishapi/vjsn.h
index 91f0e4f..ee17a3d 100644
--- a/lib/libvarnishapi/vjsn.h
+++ b/lib/libvarnishapi/vjsn.h
@@ -56,3 +56,4 @@ struct vjsn {
struct vjsn *vjsn_parse(const char *, const char **);
void vjsn_dump(const struct vjsn *js, FILE *fo);
+struct vjsn_val *vjsn_child(const struct vjsn_val *, const char *);
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index f600c00..c42f501 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -51,24 +51,13 @@
#include "vsm_api.h"
-/* Define the vsc type structs */
-#define VSC_DO(u,l,t,h) struct VSC_C_##l {
-#define VSC_F(n,t,l,s,f,v,d,e) t n;
-#define VSC_DONE(u,l,t) };
-#include "tbl/vsc_all.h"
-
-enum {
-#define VSC_TYPE_F(n,t,l,e,d) \
- VSC_type_order_##n,
-#include "tbl/vsc_types.h"
-};
-
struct vsc_vf {
unsigned magic;
#define VSC_VF_MAGIC 0x516519f8
VTAILQ_ENTRY(vsc_vf) list;
struct VSM_fantom fantom;
struct VSC_section section;
+ struct vjsn *vjsn;
int order;
};
VTAILQ_HEAD(vsc_vf_head, vsc_vf);
@@ -117,14 +106,6 @@ static const struct VSC_level_desc * const levels[] = {
static const size_t nlevels =
sizeof(levels)/sizeof(*levels);
-#define VSC_TYPE_F(n,t,l,e,d) const char *VSC_type_##n = t;
-#include "tbl/vsc_types.h"
-
-#define VSC_DO(U,l,t,h) const struct VSC_desc VSC_desc_##l[] = {
-#define VSC_F(n,t,l,s,f,v,d,e) {#n,#t,s,f,&level_##v,d,e},
-#define VSC_DONE(U,l,t) };
-#include "tbl/vsc_all.h"
-
/*--------------------------------------------------------------------*/
static struct vsc *
@@ -266,7 +247,7 @@ VSC_Get(const struct VSM_data *vd, struct VSM_fantom *fantom, const char *type,
/*--------------------------------------------------------------------*/
-static void
+static struct vsc_vf *
vsc_add_vf(struct vsc *vsc, const struct VSM_fantom *fantom, int order)
{
struct vsc_vf *vf, *vf2;
@@ -286,9 +267,11 @@ vsc_add_vf(struct vsc *vsc, const struct VSM_fantom *fantom, int order)
VTAILQ_INSERT_BEFORE(vf2, vf, list);
else
VTAILQ_INSERT_TAIL(&vsc->vf_list, vf, list);
+ return (vf);
}
/*lint -esym(528, vsc_add_pt) */
+/*lint -sem(vsc_add_pt, custodial(3)) */
static void
vsc_add_pt(struct vsc *vsc, const volatile void *ptr,
const struct VSC_desc *desc, const struct vsc_vf *vf)
@@ -305,46 +288,19 @@ vsc_add_pt(struct vsc *vsc, const volatile void *ptr,
VTAILQ_INSERT_TAIL(&vsc->pt_list, pt, list);
}
-#define VSC_DO(U,l,t,h) \
- static void \
- iter_##l(struct vsc *vsc, const struct VSC_desc *descs, \
- struct vsc_vf *vf) \
- { \
- struct VSC_C_##l *st; \
- \
- CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \
- st = (void*)((char*)vf->fantom.b + 8);
-
-#define VSC_F(nn,tt,ll,ss,ff,vv,dd,ee) \
- vsc_add_pt(vsc, &st->nn, descs++, vf);
-
-#define VSC_DONE(U,l,t) \
- }
-
-#include "tbl/vsc_all.h"
-
/*--------------------------------------------------------------------
*/
static void
-vsc_build_old_vf_list(struct vsc *vsc)
-{
-#define VSC_TYPE_F(n,t,l,e,d) \
- if (!strcmp(vsc->iter_fantom.type, t)) \
- vsc_add_vf(vsc, &vsc->iter_fantom, \
- VSC_type_order_##n);
-#include "tbl/vsc_types.h"
-}
-
-#include <stdio.h>
-
-static void
vsc_build_vf_list(struct VSM_data *vd)
{
uint64_t u;
struct vsc *vsc = vsc_setup(vd);
const char *p;
const char *e;
+ struct vjsn *vj;
+ struct vjsn_val *vv;
+ struct vsc_vf *vf;
vsc_delete_pt_list(&vsc->pt_list);
vsc_delete_vf_list(&vsc->vf_list);
@@ -352,15 +308,23 @@ vsc_build_vf_list(struct VSM_data *vd)
VSM_FOREACH(&vsc->iter_fantom, vd) {
if (strcmp(vsc->iter_fantom.class, VSC_CLASS))
continue;
- vsc_build_old_vf_list(vsc);
u = vbe64dec(vsc->iter_fantom.b);
assert(u > 0);
p = (char*)vsc->iter_fantom.b + 8 + u;
- (void)vjsn_parse(p, &e);
+ vj = vjsn_parse(p, &e);
if (e != NULL) {
fprintf(stderr, "%s\n", p);
fprintf(stderr, "JSON ERROR %s\n", e);
+ exit(2);
}
+ AN(vj);
+ vv = vjsn_child(vj->value, "order");
+ AN(vv);
+ assert(vv->type == VJSN_NUMBER);
+ vf = vsc_add_vf(vsc, &vsc->iter_fantom, atoi(vv->value));
+ AN(vf);
+ vf->vjsn = vj;
+ // vjsn_dump(vf->vjsn, stderr);
AZ(e);
}
}
@@ -370,17 +334,36 @@ vsc_build_pt_list(struct VSM_data *vd)
{
struct vsc *vsc = vsc_setup(vd);
struct vsc_vf *vf;
+ struct vjsn_val *vve, *vv, *vt;
+ struct VSC_desc *vdsc = NULL;
vsc_delete_pt_list(&vsc->pt_list);
VTAILQ_FOREACH(vf, &vsc->vf_list, list) {
-#define VSC_DO(U,l,t,h) \
- CHECK_OBJ_NOTNULL(vf, VSC_VF_MAGIC); \
- if (!strcmp(vf->section.type, t)) \
- iter_##l(vsc, VSC_desc_##l, vf);
-#define VSC_F(n,t,l,s,f,v,d,e)
-#define VSC_DONE(a,b,c)
-#include "tbl/vsc_all.h"
+ vve = vjsn_child(vf->vjsn->value, "elem");
+ AN(vve);
+ VTAILQ_FOREACH(vv, &vve->children, list) {
+ vdsc = calloc(sizeof *vd, 1);
+ AN(vdsc);
+
+#define DOF(n, k) \
+ vt = vjsn_child(vv, k); \
+ AN(vt); \
+ assert(vt->type == VJSN_STRING); \
+ vdsc->n = vt->value;
+
+ DOF(name, "name");
+ DOF(ctype, "ctype");
+ DOF(sdesc, "oneliner");
+ DOF(ldesc, "docs");
+#undef DOF
+ vdsc->level = &level_info;
+ vt = vjsn_child(vv, "index");
+ AN(vt);
+ vsc_add_pt(vsc,
+ (char*)vf->fantom.b + atoi(vt->value),
+ vdsc, vf);
+ }
}
}
diff --git a/lib/libvcc/vsctool.py b/lib/libvcc/vsctool.py
index 4273c22..ee5432b 100644
--- a/lib/libvcc/vsctool.py
+++ b/lib/libvcc/vsctool.py
@@ -88,7 +88,8 @@ class vscset(object):
dd = collections.OrderedDict()
dd["version"] = "1"
dd["name"] = self.name
- dd["1line"] = self.head.param["oneliner"].strip()
+ dd["oneliner"] = self.head.param["oneliner"].strip()
+ dd["order"] = int(self.head.param["order"])
dd["docs"] = "\n".join(self.head.getdoc())
dd["elements"] = len(self.mbrs)
el = collections.OrderedDict()
@@ -96,11 +97,11 @@ class vscset(object):
for i in self.mbrs:
ed = collections.OrderedDict()
el[i.arg] = ed
+ for j in PARAMS:
+ if j in i.param:
+ ed[j] = i.param[j]
ed["index"] = i.param["index"]
ed["name"] = i.arg
- ed["type"] = i.param["type"]
- ed["level"] = i.param["level"]
- ed["1line"] = i.param["oneliner"].strip()
ed["docs"] = "\n".join(i.getdoc())
s=json.dumps(dd, separators=(",",":")) + "\0"
fo.write("\nstatic const size_t vsc_%s_jsonlen = %dL;\n" %
More information about the varnish-commit
mailing list