summaryrefslogtreecommitdiffstats
path: root/coccinelle/synthetic-errno.cocci
blob: 6826ea45dad3b907d3b63b5bc67afecff7aef45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/* SPDX-License-Identifier: LGPL-2.1-or-later */
@@
expression e;
expression list args;
@@
(
/* Ignore one specific case in src/shared/bootspec.c where we want to stick
 * with the log_debug() + return pattern */
log_debug("Found no default boot entry :(");
|
- log_debug(args);
- return -e;
+ return log_debug_errno(SYNTHETIC_ERRNO(e), args);
)
@@
expression e;
expression list args;
@@
(
/* Ignore specific cases in src/import/{export,import,pull}.c where we want to return positive value on success. */
log_info("Exiting.");
return -r;
|
- log_info(args);
- return -e;
+ return log_info_errno(SYNTHETIC_ERRNO(e), args);
)
@@
expression e;
expression list args;
@@
- log_notice(args);
- return -e;
+ return log_notice_errno(SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression list args;
@@
- log_error(args);
- return -e;
+ return log_error_errno(SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression list args;
@@
- log_emergency(args);
- return -e;
+ return log_emergency_errno(SYNTHETIC_ERRNO(e), args);
@@
identifier log_LEVEL_errno =~ "^log_(debug|info|notice|warning|error|emergency)_errno$";
identifier ERRNO =~ "^E[A-Z]+$";
expression list args;
@@
- log_LEVEL_errno(ERRNO, args);
+ log_LEVEL_errno(SYNTHETIC_ERRNO(ERRNO), args);
@@
identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|device|token)_(debug|info|notice|warning|error|emergency)_errno$";
identifier ERRNO =~ "^E[A-Z]+$";
expression u;
expression list args;
@@
- log_UNIT_LEVEL_errno(u, ERRNO, args);
+ log_UNIT_LEVEL_errno(u, SYNTHETIC_ERRNO(ERRNO), args);
@@
expression e;
expression u;
expression list args;
@@
- log_unit_debug(u, args);
- return -e;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_unit_info(u, args);
- return -e;
+ return log_unit_info_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_unit_notice(u, args);
- return -e;
+ return log_unit_notice_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_unit_error(u, args);
- return -e;
+ return log_unit_error_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_unit_emergency(u, args);
- return -e;
+ return log_unit_emergency_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_link_debug(u, args);
- return -e;
+ return log_link_debug_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_link_info(u, args);
- return -e;
+ return log_link_info_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_link_notice(u, args);
- return -e;
+ return log_link_notice_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_link_error(u, args);
- return -e;
+ return log_link_error_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_link_emergency(u, args);
- return -e;
+ return log_link_emergency_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_netdev_debug(u, args);
- return -e;
+ return log_netdev_debug_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_netdev_info(u, args);
- return -e;
+ return log_netdev_info_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_netdev_notice(u, args);
- return -e;
+ return log_netdev_notice_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_netdev_error(u, args);
- return -e;
+ return log_netdev_error_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_netdev_emergency(u, args);
- return -e;
+ return log_netdev_emergency_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_device_debug(u, args);
- return -e;
+ return log_device_debug_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_device_info(u, args);
- return -e;
+ return log_device_info_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_device_notice(u, args);
- return -e;
+ return log_device_notice_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_device_error(u, args);
- return -e;
+ return log_device_error_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_device_emergency(u, args);
- return -e;
+ return log_device_emergency_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_token_debug(u, args);
- return -e;
+ return log_token_debug_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_token_info(u, args);
- return -e;
+ return log_token_info_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_token_notice(u, args);
- return -e;
+ return log_token_notice_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_token_error(u, args);
- return -e;
+ return log_token_error_errno(u, SYNTHETIC_ERRNO(e), args);
@@
expression e;
expression u;
expression list args;
@@
- log_token_emergency(u, args);
- return -e;
+ return log_token_emergency_errno(u, SYNTHETIC_ERRNO(e), args);