Package: efivar / 37-6

remove-arrows.patch Patch series | download
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
commit e39fb5b9e590c6616459c15b5d95fbc09fb077d6
Author: Peter Jones <pjones@redhat.com>
Date:   Thu Feb 21 15:26:23 2019 -0500

    Get rid of the arrows in our debug messages.
    
    They're not *that* useful, and the code is clever and problematic.
    
    Resolves github issue #124
    
    Signed-off-by: Peter Jones <pjones@redhat.com>

diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
index 06e69ee..30728de 100644
--- a/src/linux-acpi-root.c
+++ b/src/linux-acpi-root.c
@@ -51,13 +51,6 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
         char *colon;
 
         const char *devpart = current;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
index 87e9247..b290ed0 100644
--- a/src/linux-emmc.c
+++ b/src/linux-emmc.c
@@ -50,13 +50,6 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
         int rc;
         int32_t tosser0, tosser1, tosser2, tosser3, slot_id, partition;
         int pos0 = 0, pos1 = 0;
-        char *spaces;
-
-        pos0 = strlen(current);
-        spaces = alloca(pos0+1);
-        memset(spaces, ' ', pos0+1);
-        spaces[pos0] = '\0';
-        pos0 = 0;
 
         debug("entry");
 
@@ -65,8 +58,6 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
                     &tosser0, &tosser1, &tosser2, &slot_id,
                     &pos0, &tosser3, &partition, &pos1);
         debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 4);
-        arrow(LOG_DEBUG, spaces, 9, pos1, rc, 6);
         /*
          * If it isn't of that form, it's not one of our emmc devices.
          */
diff --git a/src/linux-md.c b/src/linux-md.c
index 0a5c1cd..cb584c9 100644
--- a/src/linux-md.c
+++ b/src/linux-md.c
@@ -44,13 +44,6 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
         int rc;
         int32_t md, tosser0, part;
         int pos0 = 0, pos1 = 0;
-        char *spaces;
-
-        pos0 = strlen(current);
-        spaces = alloca(pos0+1);
-        memset(spaces, ' ', pos0+1);
-        spaces[pos0] = '\0';
-        pos0 = 0;
 
         debug("entry");
 
@@ -58,7 +51,6 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
         rc = sscanf(current, "md%d/%nmd%dp%d%n",
                     &md, &pos0, &tosser0, &part, &pos1);
         debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
         /*
          * If it isn't of that form, it's not one of our partitioned md devices.
          */
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
index d68d11a..1d8fc65 100644
--- a/src/linux-nvme.c
+++ b/src/linux-nvme.c
@@ -54,13 +54,6 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
         int32_t tosser0, tosser1, tosser2, ctrl_id, ns_id, partition;
         uint8_t *filebuf = NULL;
         int pos0 = 0, pos1 = 0;
-        char *spaces;
-
-        pos0 = strlen(current);
-        spaces = alloca(pos0+1);
-        memset(spaces, ' ', pos0+1);
-        spaces[pos0] = '\0';
-        pos0 = 0;
 
         debug("entry");
 
@@ -69,8 +62,6 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
                     &tosser0, &ctrl_id, &ns_id, &pos0,
                     &tosser1, &tosser2, &partition, &pos1);
         debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
-        arrow(LOG_DEBUG, spaces, 9, pos1, rc, 6);
         /*
          * If it isn't of that form, it's not one of our nvme devices.
          */
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
index 5d1df06..0605acf 100644
--- a/src/linux-pci-root.c
+++ b/src/linux-pci-root.c
@@ -48,13 +48,6 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
         uint16_t root_domain;
         uint8_t root_bus;
         const char *devpart = current;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
diff --git a/src/linux-pci.c b/src/linux-pci.c
index f63f591..64aaefb 100644
--- a/src/linux-pci.c
+++ b/src/linux-pci.c
@@ -48,13 +48,6 @@ parse_pci(struct device *dev, const char *current, const char *root)
         int rc;
         int pos;
         const char *devpart = current;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
@@ -75,7 +68,6 @@ parse_pci(struct device *dev, const char *current, const char *root)
                 rc = sscanf(devpart, "%hx:%hhx:%hhx.%hhx/%n",
                             &domain, &bus, &device, &function, &pos);
                 debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
-                arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
                 if (rc != 4)
                         break;
                 devpart += pos;
diff --git a/src/linux-sata.c b/src/linux-sata.c
index 8526502..3564117 100644
--- a/src/linux-sata.c
+++ b/src/linux-sata.c
@@ -148,13 +148,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
         uint64_t scsi_lun, tosser3;
         int pos = 0;
         int rc;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
         if (is_pata(dev)) {
@@ -169,7 +162,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
         debug("searching for ata1/");
         rc = sscanf(current, "ata%"PRIu32"/%n", &print_id, &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
         /*
          * If we don't find this one, it isn't an ata device, so return 0 not
          * error.  Later errors mean it is an ata device, but we can't parse
@@ -183,7 +175,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
         debug("searching for host0/");
         rc = sscanf(current, "host%"PRIu32"/%n", &scsi_bus, &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
         if (rc != 1)
                 return -1;
         current += pos;
@@ -193,7 +184,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
         rc = sscanf(current, "target%"PRIu32":%"PRIu32":%"PRIu64"/%n",
                     &scsi_device, &scsi_target, &scsi_lun, &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
         if (rc != 3)
                 return -1;
         current += pos;
@@ -203,7 +193,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
         rc = sscanf(current, "%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
                     &tosser0, &tosser1, &tosser2, &tosser3, &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 4);
         if (rc != 4)
                 return -1;
         current += pos;
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
index a5e81cf..04892f0 100644
--- a/src/linux-scsi.c
+++ b/src/linux-scsi.c
@@ -45,13 +45,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
         int rc;
         int sz = 0;
         int pos0 = 0, pos1 = 0;
-        char *spaces;
-
-        sz = strlen(current);
-        spaces = alloca(sz+1);
-        memset(spaces, ' ', sz+1);
-        spaces[sz] = '\0';
-        sz = 0;
 
         debug("entry");
         /*
@@ -108,7 +101,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
         debug("searching for host4/");
         rc = sscanf(current, "host%d/%n", scsi_host, &pos0);
         debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 1);
         if (rc != 1)
                 return -1;
         sz += pos0;
@@ -126,8 +118,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
         rc = sscanf(current+sz, "port-%d:%d%n:%d%n", &tosser0,
                     &tosser1, &pos0, &tosser2, &pos1);
         debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current+sz, rc, pos0, pos1);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
-        arrow(LOG_DEBUG, spaces, 9, pos1, rc, 3);
         if (rc == 2 || rc == 3) {
                 sz += pos0;
                 pos0 = 0;
@@ -153,7 +143,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
                 debug("searching for expander-4:0/");
                 rc = sscanf(current+sz, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
                 debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
-                arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
                 if (rc == 2) {
                         if (!remote_target_id) {
                                 efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
@@ -169,7 +158,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
                         debug("searching for port-2:0:2/");
                         rc = sscanf(current+sz, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
                         debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
-                        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
                         if (rc != 3) {
                                 efi_error("Couldn't parse port expander port string");
                                 return -1;
@@ -192,8 +180,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
 
                 pos1 = 0;
                 rc = sscanf(current + sz + pos0, ":%d%n", &tosser2, &pos1);
-                arrow(LOG_DEBUG, spaces, 9, pos0, rc + 2, 2);
-                arrow(LOG_DEBUG, spaces, 9, pos0 + pos1, rc + 2, 3);
                 if (rc != 0 && rc != 1)
                         return -1;
                 if (remote_port_id && rc == 1)
@@ -217,7 +203,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
         rc = sscanf(current + sz, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
                     &tosser3, &pos0);
         debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
         if (rc != 3)
                 return -1;
         sz += pos0;
@@ -230,7 +215,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
         rc = sscanf(current + sz, "%d:%d:%d:%"PRIu64"/%n",
                     scsi_bus, scsi_device, scsi_target, scsi_lun, &pos0);
         debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
-        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 4);
         if (rc != 4)
                 return -1;
         sz += pos0;
@@ -247,13 +231,6 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
         ssize_t sz;
         int pos;
         int rc;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
@@ -265,7 +242,6 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
                     &dev->scsi_info.scsi_lun,
                     &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", dev->device, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
         if (rc != 4)
                 return 0;
 
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
index 394f496..373cd59 100644
--- a/src/linux-soc-root.c
+++ b/src/linux-soc-root.c
@@ -43,13 +43,6 @@ parse_soc_root(struct device *dev UNUSED, const char *current, const char *root
         int rc;
         int pos;
         const char *devpart = current;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
index c54a813..2e9889d 100644
--- a/src/linux-virtblk.c
+++ b/src/linux-virtblk.c
@@ -50,20 +50,12 @@ parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
         uint32_t tosser;
         int pos;
         int rc;
-        char *spaces;
-
-        pos = strlen(current);
-        spaces = alloca(pos+1);
-        memset(spaces, ' ', pos+1);
-        spaces[pos] = '\0';
-        pos = 0;
 
         debug("entry");
 
         debug("searching for virtio0/");
         rc = sscanf(current, "virtio%x/%n", &tosser, &pos);
         debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
-        arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
         /*
          * If we couldn't find virtioX/ then it isn't a virtio device.
          */
diff --git a/src/util.h b/src/util.h
index ba8fee3..6d3c10e 100644
--- a/src/util.h
+++ b/src/util.h
@@ -388,7 +388,6 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
 #undef log
 #endif
 #define log(level, fmt, args...) log_(__FILE__, __LINE__, __func__, level, fmt, ## args)
-#define arrow(l,b,o,p,n,m) ({if(n==m){char c_=b[p+1]; b[o]='^'; b[p+o]='^';b[p+o+1]='\0';log(l,"%s",b);b[o]=' ';b[p+o]=' ';b[p+o+1]=c_;}})
 #define debug(fmt, args...) log(LOG_DEBUG, fmt, ## args)
 
 #endif /* EFIVAR_UTIL_H */