aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/firewire/nosy-dump.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/tools/firewire/nosy-dump.c b/tools/firewire/nosy-dump.c
index 3d7e1a6dfe93..5d1e89233738 100644
--- a/tools/firewire/nosy-dump.c
+++ b/tools/firewire/nosy-dump.c
@@ -133,7 +133,7 @@ static const struct poptOption options[] = {
133}; 133};
134 134
135/* Allow all ^C except the first to interrupt the program in the usual way. */ 135/* Allow all ^C except the first to interrupt the program in the usual way. */
136void 136static void
137sigint_handler(int signal_num) 137sigint_handler(int signal_num)
138{ 138{
139 if (run == 1) { 139 if (run == 1) {
@@ -142,7 +142,7 @@ sigint_handler(int signal_num)
142 } 142 }
143} 143}
144 144
145struct subaction * 145static struct subaction *
146subaction_create(uint32_t *data, size_t length) 146subaction_create(uint32_t *data, size_t length)
147{ 147{
148 struct subaction *sa; 148 struct subaction *sa;
@@ -156,17 +156,17 @@ subaction_create(uint32_t *data, size_t length)
156 return sa; 156 return sa;
157} 157}
158 158
159void 159static void
160subaction_destroy(struct subaction *sa) 160subaction_destroy(struct subaction *sa)
161{ 161{
162 free(sa); 162 free(sa);
163} 163}
164 164
165struct list pending_transaction_list = { 165static struct list pending_transaction_list = {
166 &pending_transaction_list, &pending_transaction_list 166 &pending_transaction_list, &pending_transaction_list
167}; 167};
168 168
169struct link_transaction * 169static struct link_transaction *
170link_transaction_lookup(int request_node, int response_node, int tlabel) 170link_transaction_lookup(int request_node, int response_node, int tlabel)
171{ 171{
172 struct link_transaction *t; 172 struct link_transaction *t;
@@ -190,7 +190,7 @@ link_transaction_lookup(int request_node, int response_node, int tlabel)
190 return t; 190 return t;
191} 191}
192 192
193void 193static void
194link_transaction_destroy(struct link_transaction *t) 194link_transaction_destroy(struct link_transaction *t)
195{ 195{
196 struct subaction *sa; 196 struct subaction *sa;
@@ -213,11 +213,11 @@ struct protocol_decoder {
213 int (*decode)(struct link_transaction *t); 213 int (*decode)(struct link_transaction *t);
214}; 214};
215 215
216static struct protocol_decoder protocol_decoders[] = { 216static const struct protocol_decoder protocol_decoders[] = {
217 { "FCP", decode_fcp } 217 { "FCP", decode_fcp }
218}; 218};
219 219
220void 220static void
221handle_transaction(struct link_transaction *t) 221handle_transaction(struct link_transaction *t)
222{ 222{
223 struct subaction *sa; 223 struct subaction *sa;
@@ -254,7 +254,7 @@ handle_transaction(struct link_transaction *t)
254 link_transaction_destroy(t); 254 link_transaction_destroy(t);
255} 255}
256 256
257void 257static void
258clear_pending_transaction_list(void) 258clear_pending_transaction_list(void)
259{ 259{
260 struct link_transaction *t; 260 struct link_transaction *t;
@@ -313,7 +313,7 @@ struct packet_info {
313 const char *name; 313 const char *name;
314 int type; 314 int type;
315 int response_tcode; 315 int response_tcode;
316 struct packet_field *fields; 316 const struct packet_field *fields;
317 int field_count; 317 int field_count;
318}; 318};
319 319
@@ -344,20 +344,20 @@ struct packet_field {
344 { "src", 32, 16 }, \ 344 { "src", 32, 16 }, \
345 { "rcode", 48, 4, PACKET_FIELD_TRANSACTION, rcode_names } 345 { "rcode", 48, 4, PACKET_FIELD_TRANSACTION, rcode_names }
346 346
347struct packet_field read_quadlet_request_fields[] = { 347static const struct packet_field read_quadlet_request_fields[] = {
348 COMMON_REQUEST_FIELDS, 348 COMMON_REQUEST_FIELDS,
349 { "crc", 96, 32, PACKET_FIELD_DETAIL }, 349 { "crc", 96, 32, PACKET_FIELD_DETAIL },
350 { "ack", 156, 4, 0, ack_names }, 350 { "ack", 156, 4, 0, ack_names },
351}; 351};
352 352
353struct packet_field read_quadlet_response_fields[] = { 353static const struct packet_field read_quadlet_response_fields[] = {
354 COMMON_RESPONSE_FIELDS, 354 COMMON_RESPONSE_FIELDS,
355 { "data", 96, 32, PACKET_FIELD_TRANSACTION }, 355 { "data", 96, 32, PACKET_FIELD_TRANSACTION },
356 { "crc", 128, 32, PACKET_FIELD_DETAIL }, 356 { "crc", 128, 32, PACKET_FIELD_DETAIL },
357 { "ack", 188, 4, 0, ack_names }, 357 { "ack", 188, 4, 0, ack_names },
358}; 358};
359 359
360struct packet_field read_block_request_fields[] = { 360static const struct packet_field read_block_request_fields[] = {
361 COMMON_REQUEST_FIELDS, 361 COMMON_REQUEST_FIELDS,
362 { "data_length", 96, 16, PACKET_FIELD_TRANSACTION }, 362 { "data_length", 96, 16, PACKET_FIELD_TRANSACTION },
363 { "extended_tcode", 112, 16 }, 363 { "extended_tcode", 112, 16 },
@@ -365,7 +365,7 @@ struct packet_field read_block_request_fields[] = {
365 { "ack", 188, 4, 0, ack_names }, 365 { "ack", 188, 4, 0, ack_names },
366}; 366};
367 367
368struct packet_field block_response_fields[] = { 368static const struct packet_field block_response_fields[] = {
369 COMMON_RESPONSE_FIELDS, 369 COMMON_RESPONSE_FIELDS,
370 { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH }, 370 { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH },
371 { "extended_tcode", 112, 16 }, 371 { "extended_tcode", 112, 16 },
@@ -375,13 +375,13 @@ struct packet_field block_response_fields[] = {
375 { "ack", -4, 4, 0, ack_names }, 375 { "ack", -4, 4, 0, ack_names },
376}; 376};
377 377
378struct packet_field write_quadlet_request_fields[] = { 378static const struct packet_field write_quadlet_request_fields[] = {
379 COMMON_REQUEST_FIELDS, 379 COMMON_REQUEST_FIELDS,
380 { "data", 96, 32, PACKET_FIELD_TRANSACTION }, 380 { "data", 96, 32, PACKET_FIELD_TRANSACTION },
381 { "ack", -4, 4, 0, ack_names }, 381 { "ack", -4, 4, 0, ack_names },
382}; 382};
383 383
384struct packet_field block_request_fields[] = { 384static const struct packet_field block_request_fields[] = {
385 COMMON_REQUEST_FIELDS, 385 COMMON_REQUEST_FIELDS,
386 { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH | PACKET_FIELD_TRANSACTION }, 386 { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH | PACKET_FIELD_TRANSACTION },
387 { "extended_tcode", 112, 16, PACKET_FIELD_TRANSACTION }, 387 { "extended_tcode", 112, 16, PACKET_FIELD_TRANSACTION },
@@ -391,13 +391,13 @@ struct packet_field block_request_fields[] = {
391 { "ack", -4, 4, 0, ack_names }, 391 { "ack", -4, 4, 0, ack_names },
392}; 392};
393 393
394struct packet_field write_response_fields[] = { 394static const struct packet_field write_response_fields[] = {
395 COMMON_RESPONSE_FIELDS, 395 COMMON_RESPONSE_FIELDS,
396 { "reserved", 64, 32, PACKET_FIELD_DETAIL }, 396 { "reserved", 64, 32, PACKET_FIELD_DETAIL },
397 { "ack", -4, 4, 0, ack_names }, 397 { "ack", -4, 4, 0, ack_names },
398}; 398};
399 399
400struct packet_field iso_data_fields[] = { 400static const struct packet_field iso_data_fields[] = {
401 { "data_length", 0, 16, PACKET_FIELD_DATA_LENGTH }, 401 { "data_length", 0, 16, PACKET_FIELD_DATA_LENGTH },
402 { "tag", 16, 2 }, 402 { "tag", 16, 2 },
403 { "channel", 18, 6 }, 403 { "channel", 18, 6 },
@@ -409,7 +409,7 @@ struct packet_field iso_data_fields[] = {
409 { "ack", -4, 4, 0, ack_names }, 409 { "ack", -4, 4, 0, ack_names },
410}; 410};
411 411
412static struct packet_info packet_info[] = { 412static const struct packet_info packet_info[] = {
413 { 413 {
414 .name = "write_quadlet_request", 414 .name = "write_quadlet_request",
415 .type = PACKET_REQUEST, 415 .type = PACKET_REQUEST,
@@ -486,7 +486,7 @@ static struct packet_info packet_info[] = {
486 }, 486 },
487}; 487};
488 488
489int 489static int
490handle_packet(uint32_t *data, size_t length) 490handle_packet(uint32_t *data, size_t length)