/src/varnish-cache/bin/varnishd/common/common_param.h
Line | Count | Source (jump to first uncovered line) |
1 | | /*- |
2 | | * Copyright (c) 2006 Verdens Gang AS |
3 | | * Copyright (c) 2006-2011 Varnish Software AS |
4 | | * All rights reserved. |
5 | | * |
6 | | * Author: Poul-Henning Kamp <phk@phk.freebsd.dk> |
7 | | * |
8 | | * SPDX-License-Identifier: BSD-2-Clause |
9 | | * |
10 | | * Redistribution and use in source and binary forms, with or without |
11 | | * modification, are permitted provided that the following conditions |
12 | | * are met: |
13 | | * 1. Redistributions of source code must retain the above copyright |
14 | | * notice, this list of conditions and the following disclaimer. |
15 | | * 2. Redistributions in binary form must reproduce the above copyright |
16 | | * notice, this list of conditions and the following disclaimer in the |
17 | | * documentation and/or other materials provided with the distribution. |
18 | | * |
19 | | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
20 | | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE |
23 | | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | | * SUCH DAMAGE. |
30 | | * |
31 | | * This file contains the heritage passed when mgt forks cache |
32 | | */ |
33 | | |
34 | | #ifdef COMMON_COMMON_PARAM_H |
35 | | #error "Multiple includes of common/common_param.h" |
36 | | #endif |
37 | | #define COMMON_COMMON_PARAM_H |
38 | | |
39 | | #include "vre.h" |
40 | | |
41 | | #define VSM_CLASS_PARAM "Params" |
42 | | |
43 | | enum debug_bits { |
44 | | #define DEBUG_BIT(U, l, d) DBG_##U, |
45 | | #include "tbl/debug_bits.h" |
46 | | DBG_Reserved |
47 | | }; |
48 | | |
49 | | static inline int |
50 | | COM_DO_DEBUG(const volatile uint8_t *p, enum debug_bits x) |
51 | 6.88k | { |
52 | 6.88k | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); |
53 | 6.88k | } cache_ws_emu.c:COM_DO_DEBUG Line | Count | Source | 51 | 6.88k | { | 52 | 6.88k | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); | 53 | 6.88k | } |
Unexecuted instantiation: cache_ws_common.c:COM_DO_DEBUG Unexecuted instantiation: cache_esi_parse.c:COM_DO_DEBUG Unexecuted instantiation: esi_parse_fuzzer.c:COM_DO_DEBUG |
54 | | |
55 | | enum experimental_bits { |
56 | | #define EXPERIMENTAL_BIT(U, l, d) EXPERIMENT_##U, |
57 | | #include "tbl/experimental_bits.h" |
58 | | EXPERIMENT_Reserved |
59 | | }; |
60 | | |
61 | | static inline int |
62 | | COM_EXPERIMENT(const volatile uint8_t *p, enum experimental_bits x) |
63 | 0 | { |
64 | 0 | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); |
65 | 0 | } Unexecuted instantiation: cache_ws_emu.c:COM_EXPERIMENT Unexecuted instantiation: cache_ws_common.c:COM_EXPERIMENT Unexecuted instantiation: cache_esi_parse.c:COM_EXPERIMENT Unexecuted instantiation: esi_parse_fuzzer.c:COM_EXPERIMENT |
66 | | |
67 | | enum feature_bits { |
68 | | #define FEATURE_BIT(U, l, d) FEATURE_##U, |
69 | | #include "tbl/feature_bits.h" |
70 | | FEATURE_Reserved |
71 | | }; |
72 | | |
73 | | static inline int |
74 | | COM_FEATURE(const volatile uint8_t *p, enum feature_bits x) |
75 | 83.7k | { |
76 | 83.7k | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); |
77 | 83.7k | } Unexecuted instantiation: cache_ws_emu.c:COM_FEATURE Unexecuted instantiation: cache_ws_common.c:COM_FEATURE cache_esi_parse.c:COM_FEATURE Line | Count | Source | 75 | 83.7k | { | 76 | 83.7k | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); | 77 | 83.7k | } |
Unexecuted instantiation: esi_parse_fuzzer.c:COM_FEATURE |
78 | | |
79 | | enum vcc_feature_bits { |
80 | | #define VCC_FEATURE_BIT(U, l, d) VCC_FEATURE_##U, |
81 | | #include "tbl/vcc_feature_bits.h" |
82 | | VCC_FEATURE_Reserved |
83 | | }; |
84 | | |
85 | | static inline int |
86 | | COM_VCC_FEATURE(const volatile uint8_t *p, enum vcc_feature_bits x) |
87 | 0 | { |
88 | 0 | return ((p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))) != 0); |
89 | 0 | } Unexecuted instantiation: cache_ws_emu.c:COM_VCC_FEATURE Unexecuted instantiation: cache_ws_common.c:COM_VCC_FEATURE Unexecuted instantiation: cache_esi_parse.c:COM_VCC_FEATURE Unexecuted instantiation: esi_parse_fuzzer.c:COM_VCC_FEATURE |
90 | | |
91 | | struct poolparam { |
92 | | unsigned min_pool; |
93 | | unsigned max_pool; |
94 | | vtim_dur max_age; |
95 | | }; |
96 | | |
97 | | #define PARAM_BITMAP(name, len) typedef uint8_t name[(len + 7)>>3] |
98 | | |
99 | | PARAM_BITMAP(vsl_mask_t, 256); |
100 | | PARAM_BITMAP(debug_t, DBG_Reserved); |
101 | | PARAM_BITMAP(experimental_t, EXPERIMENT_Reserved); |
102 | | PARAM_BITMAP(feature_t, FEATURE_Reserved); |
103 | | PARAM_BITMAP(vcc_feature_t, VCC_FEATURE_Reserved); |
104 | | #undef PARAM_BITMAP |
105 | | |
106 | | struct params { |
107 | | |
108 | | #define ptyp_boolean unsigned |
109 | | #define ptyp_bytes ssize_t |
110 | | #define ptyp_bytes_u unsigned |
111 | | #define ptyp_debug debug_t |
112 | | #define ptyp_double double |
113 | | #define ptyp_duration vtim_dur |
114 | | #define ptyp_experimental experimental_t |
115 | | #define ptyp_feature feature_t |
116 | | #define ptyp_poolparam struct poolparam |
117 | | #define ptyp_thread_pool_max unsigned |
118 | | #define ptyp_thread_pool_min unsigned |
119 | | #define ptyp_timeout vtim_dur |
120 | | #define ptyp_uint unsigned |
121 | | #define ptyp_uint_orzero unsigned |
122 | | #define ptyp_vcc_feature vcc_feature_t |
123 | | #define ptyp_vsl_buffer unsigned |
124 | | #define ptyp_vsl_mask vsl_mask_t |
125 | | #define ptyp_vsl_reclen unsigned |
126 | | #define PARAM(typ, fld, nm, ...) \ |
127 | | ptyp_##typ fld; |
128 | | #include <tbl/params.h> |
129 | | #undef ptyp_boolean |
130 | | #undef ptyp_bytes |
131 | | #undef ptyp_bytes_u |
132 | | #undef ptyp_debug |
133 | | #undef ptyp_double |
134 | | #undef ptyp_duration |
135 | | #undef ptyp_experimental |
136 | | #undef ptyp_feature |
137 | | #undef ptyp_poolparam |
138 | | #undef ptyp_thread_pool_max |
139 | | #undef ptyp_thread_pool_min |
140 | | #undef ptyp_timeout |
141 | | #undef ptyp_uint |
142 | | #undef ptyp_vsl_buffer |
143 | | #undef ptyp_vsl_mask |
144 | | #undef ptyp_vsl_reclen |
145 | | |
146 | | struct vre_limits vre_limits; |
147 | | }; |