| Code Coverage: vinyl-cache/lib/libvsc/VSC_lck.c |
| |
| 82217aa4fc7094b3610340078afaf78cd95a8ec9 |
| |
| 0 |
|
/* |
| 1 |
|
* NB: This file is machine generated, DO NOT EDIT! |
| 2 |
|
* |
| 3 |
|
* Edit lck.vsc and run lib/libvsc/vsctool.py instead. |
| 4 |
|
*/ |
| 5 |
|
|
| 6 |
|
#include "config.h" |
| 7 |
|
#include <stdio.h> |
| 8 |
|
#include <stdarg.h> |
| 9 |
|
#include "vdef.h" |
| 10 |
|
#include "vas.h" |
| 11 |
|
#include "vrt.h" |
| 12 |
|
#include "VSC_lck.h" |
| 13 |
|
|
| 14 |
|
static const char vsc_lck_name[] = "LCK"; |
| 15 |
|
|
| 16 |
|
#define PARANOIA(a,n) \ |
| 17 |
|
v_static_assert( \ |
| 18 |
|
offsetof(struct VSC_lck, a) == n, \ |
| 19 |
|
"VSC element '" #a "' at wrong offset") |
| 20 |
|
|
| 21 |
|
PARANOIA(creat, 0); |
| 22 |
|
PARANOIA(destroy, 8); |
| 23 |
|
PARANOIA(locks, 16); |
| 24 |
|
PARANOIA(dbg_busy, 24); |
| 25 |
|
PARANOIA(dbg_try_fail, 32); |
| 26 |
|
#undef PARANOIA |
| 27 |
|
|
| 28 |
|
static const unsigned char vsc_lck_json[1492] = { |
| 29 |
|
123,34,118,101,114,115,105,111,110,34,58,34,49,34,44,34,110,97,109,101, |
| 30 |
|
34,58,34,108,99,107,34,44,34,111,110,101,108,105,110,101,114,34,58,34, |
| 31 |
|
76,111,99,107,32,67,111,117,110,116,101,114,115,34,44,34,111,114,100, |
| 32 |
|
101,114,34,58,55,48,44,34,100,111,99,115,34,58,34,92,116,67,111,117, |
| 33 |
|
110,116,101,114,115,32,119,104,105,99,104,32,116,114,97,99,107,32,116, |
| 34 |
|
104,101,32,97,99,116,105,118,105,116,121,32,105,110,32,116,104,101,32, |
| 35 |
|
100,105,102,102,101,114,101,110,116,32,99,108,97,115,115,101,115,92, |
| 36 |
|
110,92,116,111,102,32,109,117,116,101,120,45,108,111,99,107,115,46,92, |
| 37 |
|
110,92,110,92,116,84,104,101,32,99,111,117,110,116,115,32,109,97,121, |
| 38 |
|
32,98,101,32,115,108,105,103,104,116,108,121,32,119,114,111,110,103, |
| 39 |
|
32,105,102,32,116,104,101,114,101,32,97,114,101,32,109,111,114,101,32, |
| 40 |
|
116,104,97,110,32,111,110,101,92,110,92,116,108,111,99,107,32,105,110, |
| 41 |
|
115,116,97,110,116,105,97,116,101,100,32,105,110,32,101,97,99,104,32, |
| 42 |
|
99,108,97,115,115,32,40,105,101,58,32,46,99,114,101,97,116,32,62,32, |
| 43 |
|
49,41,34,44,34,101,108,101,109,101,110,116,115,34,58,53,44,34,101,108, |
| 44 |
|
101,109,34,58,123,34,99,114,101,97,116,34,58,123,34,116,121,112,101, |
| 45 |
|
34,58,34,99,111,117,110,116,101,114,34,44,34,99,116,121,112,101,34,58, |
| 46 |
|
34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34,58,34, |
| 47 |
|
100,101,98,117,103,34,44,34,111,110,101,108,105,110,101,114,34,58,34, |
| 48 |
|
67,114,101,97,116,101,100,32,108,111,99,107,115,34,44,34,102,111,114, |
| 49 |
|
109,97,116,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100, |
| 50 |
|
101,120,34,58,48,44,34,110,97,109,101,34,58,34,99,114,101,97,116,34, |
| 51 |
|
44,34,100,111,99,115,34,58,34,34,125,44,34,100,101,115,116,114,111,121, |
| 52 |
|
34,58,123,34,116,121,112,101,34,58,34,99,111,117,110,116,101,114,34, |
| 53 |
|
44,34,99,116,121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44, |
| 54 |
|
34,108,101,118,101,108,34,58,34,100,101,98,117,103,34,44,34,111,110, |
| 55 |
|
101,108,105,110,101,114,34,58,34,68,101,115,116,114,111,121,101,100, |
| 56 |
|
32,108,111,99,107,115,34,44,34,102,111,114,109,97,116,34,58,34,105,110, |
| 57 |
|
116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,56,44,34,110, |
| 58 |
|
97,109,101,34,58,34,100,101,115,116,114,111,121,34,44,34,100,111,99, |
| 59 |
|
115,34,58,34,34,125,44,34,108,111,99,107,115,34,58,123,34,116,121,112, |
| 60 |
|
101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116,121,112,101, |
| 61 |
|
34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34, |
| 62 |
|
58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110,101,114,34, |
| 63 |
|
58,34,76,111,99,107,32,79,112,101,114,97,116,105,111,110,115,34,44,34, |
| 64 |
|
102,111,114,109,97,116,34,58,34,105,110,116,101,103,101,114,34,44,34, |
| 65 |
|
105,110,100,101,120,34,58,49,54,44,34,110,97,109,101,34,58,34,108,111, |
| 66 |
|
99,107,115,34,44,34,100,111,99,115,34,58,34,34,125,44,34,100,98,103, |
| 67 |
|
95,98,117,115,121,34,58,123,34,116,121,112,101,34,58,34,99,111,117,110, |
| 68 |
|
116,101,114,34,44,34,99,116,121,112,101,34,58,34,117,105,110,116,54, |
| 69 |
|
52,95,116,34,44,34,108,101,118,101,108,34,58,34,100,101,98,117,103,34, |
| 70 |
|
44,34,111,110,101,108,105,110,101,114,34,58,34,67,111,110,116,101,110, |
| 71 |
|
100,101,100,32,108,111,99,107,32,111,112,101,114,97,116,105,111,110, |
| 72 |
|
115,34,44,34,102,111,114,109,97,116,34,58,34,105,110,116,101,103,101, |
| 73 |
|
114,34,44,34,105,110,100,101,120,34,58,50,52,44,34,110,97,109,101,34, |
| 74 |
|
58,34,100,98,103,95,98,117,115,121,34,44,34,100,111,99,115,34,58,34, |
| 75 |
|
92,116,73,102,32,116,104,101,32,96,96,108,99,107,96,96,32,100,101,98, |
| 76 |
|
117,103,32,98,105,116,32,105,115,32,115,101,116,58,32,76,111,99,107, |
| 77 |
|
32,111,112,101,114,97,116,105,111,110,115,32,119,104,105,99,104,92,110, |
| 78 |
|
92,116,114,101,116,117,114,110,101,100,32,69,66,85,83,89,32,111,110, |
| 79 |
|
32,116,104,101,32,102,105,114,115,116,32,108,111,99,107,105,110,103, |
| 80 |
|
32,97,116,116,101,109,112,116,46,92,110,92,110,92,116,73,102,32,116, |
| 81 |
|
104,101,32,96,96,108,99,107,96,96,32,100,101,98,117,103,32,98,105,116, |
| 82 |
|
32,105,115,32,117,110,115,101,116,44,32,116,104,105,115,32,99,111,117, |
| 83 |
|
110,116,101,114,32,119,105,108,108,32,110,101,118,101,114,32,98,101, |
| 84 |
|
92,110,92,116,105,110,99,114,101,109,101,110,116,101,100,32,101,118, |
| 85 |
|
101,110,32,105,102,32,108,111,99,107,32,111,112,101,114,97,116,105,111, |
| 86 |
|
110,115,32,97,114,101,32,99,111,110,116,101,110,100,101,100,46,34,125, |
| 87 |
|
44,34,100,98,103,95,116,114,121,95,102,97,105,108,34,58,123,34,116,121, |
| 88 |
|
112,101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116,121,112, |
| 89 |
|
101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101,108, |
| 90 |
|
34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110,101,114, |
| 91 |
|
34,58,34,67,111,110,116,101,110,100,101,100,32,116,114,121,108,111,99, |
| 92 |
|
107,32,111,112,101,114,97,116,105,111,110,115,34,44,34,102,111,114,109, |
| 93 |
|
97,116,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101, |
| 94 |
|
120,34,58,51,50,44,34,110,97,109,101,34,58,34,100,98,103,95,116,114, |
| 95 |
|
121,95,102,97,105,108,34,44,34,100,111,99,115,34,58,34,92,116,73,102, |
| 96 |
|
32,116,104,101,32,96,96,108,99,107,96,96,32,100,101,98,117,103,32,98, |
| 97 |
|
105,116,32,105,115,32,115,101,116,58,32,84,114,121,108,111,99,107,32, |
| 98 |
|
111,112,101,114,97,116,105,111,110,115,32,119,104,105,99,104,92,110, |
| 99 |
|
92,116,114,101,116,117,114,110,101,100,32,69,66,85,83,89,46,92,110,92, |
| 100 |
|
110,92,116,73,102,32,116,104,101,32,96,96,108,99,107,96,96,32,100,101, |
| 101 |
|
98,117,103,32,98,105,116,32,105,115,32,117,110,115,101,116,44,32,116, |
| 102 |
|
104,105,115,32,99,111,117,110,116,101,114,32,119,105,108,108,32,110, |
| 103 |
|
101,118,101,114,32,98,101,92,110,92,116,105,110,99,114,101,109,101,110, |
| 104 |
|
116,101,100,32,101,118,101,110,32,105,102,32,108,111,99,107,32,111,112, |
| 105 |
|
101,114,97,116,105,111,110,115,32,97,114,101,32,99,111,110,116,101,110, |
| 106 |
|
100,101,100,46,34,125,125,125,0 |
| 107 |
|
}; |
| 108 |
|
|
| 109 |
|
// { |
| 110 |
|
// "version": "1", |
| 111 |
|
// "name": "lck", |
| 112 |
|
// "oneliner": "Lock Counters", |
| 113 |
|
// "order": 70, |
| 114 |
|
// "docs": "\tCounters which track the activity in the different class[...] |
| 115 |
|
// "elements": 5, |
| 116 |
|
// "elem": { |
| 117 |
|
// "creat": { |
| 118 |
|
// "type": "counter", |
| 119 |
|
// "ctype": "uint64_t", |
| 120 |
|
// "level": "debug", |
| 121 |
|
// "oneliner": "Created locks", |
| 122 |
|
// "format": "integer", |
| 123 |
|
// "index": 0, |
| 124 |
|
// "name": "creat", |
| 125 |
|
// "docs": "" |
| 126 |
|
// }, |
| 127 |
|
// "destroy": { |
| 128 |
|
// "type": "counter", |
| 129 |
|
// "ctype": "uint64_t", |
| 130 |
|
// "level": "debug", |
| 131 |
|
// "oneliner": "Destroyed locks", |
| 132 |
|
// "format": "integer", |
| 133 |
|
// "index": 8, |
| 134 |
|
// "name": "destroy", |
| 135 |
|
// "docs": "" |
| 136 |
|
// }, |
| 137 |
|
// "locks": { |
| 138 |
|
// "type": "counter", |
| 139 |
|
// "ctype": "uint64_t", |
| 140 |
|
// "level": "debug", |
| 141 |
|
// "oneliner": "Lock Operations", |
| 142 |
|
// "format": "integer", |
| 143 |
|
// "index": 16, |
| 144 |
|
// "name": "locks", |
| 145 |
|
// "docs": "" |
| 146 |
|
// }, |
| 147 |
|
// "dbg_busy": { |
| 148 |
|
// "type": "counter", |
| 149 |
|
// "ctype": "uint64_t", |
| 150 |
|
// "level": "debug", |
| 151 |
|
// "oneliner": "Contended lock operations", |
| 152 |
|
// "format": "integer", |
| 153 |
|
// "index": 24, |
| 154 |
|
// "name": "dbg_busy", |
| 155 |
|
// "docs": "\tIf the ``lck`` debug bit is set: Lock operations whi[...] |
| 156 |
|
// }, |
| 157 |
|
// "dbg_try_fail": { |
| 158 |
|
// "type": "counter", |
| 159 |
|
// "ctype": "uint64_t", |
| 160 |
|
// "level": "debug", |
| 161 |
|
// "oneliner": "Contended trylock operations", |
| 162 |
|
// "format": "integer", |
| 163 |
|
// "index": 32, |
| 164 |
|
// "name": "dbg_try_fail", |
| 165 |
|
// "docs": "\tIf the ``lck`` debug bit is set: Trylock operations [...] |
| 166 |
|
// } |
| 167 |
|
// } |
| 168 |
|
// } |
| 169 |
|
|
| 170 |
|
|
| 171 |
|
struct VSC_lck* |
| 172 |
|
VSC_lck_New(struct vsmw_cluster *vc, |
| 173 |
|
struct vsc_seg **sg, const char *fmt, ...) |
| 174 |
24656 |
{ |
| 175 |
24656 |
va_list ap; |
| 176 |
24656 |
struct VSC_lck *retval; |
| 177 |
|
|
| 178 |
24656 |
va_start(ap, fmt); |
| 179 |
24656 |
retval = VRT_VSC_Allocv(vc, sg, vsc_lck_name, VSC_lck_size, |
| 180 |
24656 |
vsc_lck_json, sizeof vsc_lck_json, fmt, ap); |
| 181 |
24656 |
va_end(ap); |
| 182 |
24656 |
return(retval); |
| 183 |
24656 |
} |
| 184 |
|
|
| 185 |
|
void |
| 186 |
|
VSC_lck_Destroy(struct vsc_seg **sg) |
| 187 |
0 |
{ |
| 188 |
0 |
struct vsc_seg *p; |
| 189 |
|
|
| 190 |
0 |
AN(sg); |
| 191 |
0 |
p = *sg; |
| 192 |
|
*sg = NULL; |
| 193 |
0 |
VRT_VSC_Destroy(vsc_lck_name, p); |
| 194 |
0 |
} |