Commit 468066f771032ad4bef4a906dfe0b0a55593d64d
1 parent
92c16f7e9c
Exists in
master
and in
7 other branches
tools/firewire: nosy-dump: make some symbols static or const
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Showing 1 changed file with 29 additions and 27 deletions Side-by-side Diff
tools/firewire/nosy-dump.c
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | }; |
134 | 134 | |
135 | 135 | /* Allow all ^C except the first to interrupt the program in the usual way. */ |
136 | -void | |
136 | +static void | |
137 | 137 | sigint_handler(int signal_num) |
138 | 138 | { |
139 | 139 | if (run == 1) { |
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -struct subaction * | |
145 | +static struct subaction * | |
146 | 146 | subaction_create(uint32_t *data, size_t length) |
147 | 147 | { |
148 | 148 | struct subaction *sa; |
149 | 149 | |
150 | 150 | |
... | ... | @@ -156,17 +156,17 @@ |
156 | 156 | return sa; |
157 | 157 | } |
158 | 158 | |
159 | -void | |
159 | +static void | |
160 | 160 | subaction_destroy(struct subaction *sa) |
161 | 161 | { |
162 | 162 | free(sa); |
163 | 163 | } |
164 | 164 | |
165 | -struct list pending_transaction_list = { | |
165 | +static struct list pending_transaction_list = { | |
166 | 166 | &pending_transaction_list, &pending_transaction_list |
167 | 167 | }; |
168 | 168 | |
169 | -struct link_transaction * | |
169 | +static struct link_transaction * | |
170 | 170 | link_transaction_lookup(int request_node, int response_node, int tlabel) |
171 | 171 | { |
172 | 172 | struct link_transaction *t; |
... | ... | @@ -190,7 +190,7 @@ |
190 | 190 | return t; |
191 | 191 | } |
192 | 192 | |
193 | -void | |
193 | +static void | |
194 | 194 | link_transaction_destroy(struct link_transaction *t) |
195 | 195 | { |
196 | 196 | struct subaction *sa; |
197 | 197 | |
... | ... | @@ -213,11 +213,11 @@ |
213 | 213 | int (*decode)(struct link_transaction *t); |
214 | 214 | }; |
215 | 215 | |
216 | -static struct protocol_decoder protocol_decoders[] = { | |
216 | +static const struct protocol_decoder protocol_decoders[] = { | |
217 | 217 | { "FCP", decode_fcp } |
218 | 218 | }; |
219 | 219 | |
220 | -void | |
220 | +static void | |
221 | 221 | handle_transaction(struct link_transaction *t) |
222 | 222 | { |
223 | 223 | struct subaction *sa; |
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | link_transaction_destroy(t); |
255 | 255 | } |
256 | 256 | |
257 | -void | |
257 | +static void | |
258 | 258 | clear_pending_transaction_list(void) |
259 | 259 | { |
260 | 260 | struct link_transaction *t; |
... | ... | @@ -313,7 +313,7 @@ |
313 | 313 | const char *name; |
314 | 314 | int type; |
315 | 315 | int response_tcode; |
316 | - struct packet_field *fields; | |
316 | + const struct packet_field *fields; | |
317 | 317 | int field_count; |
318 | 318 | }; |
319 | 319 | |
320 | 320 | |
321 | 321 | |
... | ... | @@ -344,20 +344,20 @@ |
344 | 344 | { "src", 32, 16 }, \ |
345 | 345 | { "rcode", 48, 4, PACKET_FIELD_TRANSACTION, rcode_names } |
346 | 346 | |
347 | -struct packet_field read_quadlet_request_fields[] = { | |
347 | +static const struct packet_field read_quadlet_request_fields[] = { | |
348 | 348 | COMMON_REQUEST_FIELDS, |
349 | 349 | { "crc", 96, 32, PACKET_FIELD_DETAIL }, |
350 | 350 | { "ack", 156, 4, 0, ack_names }, |
351 | 351 | }; |
352 | 352 | |
353 | -struct packet_field read_quadlet_response_fields[] = { | |
353 | +static const struct packet_field read_quadlet_response_fields[] = { | |
354 | 354 | COMMON_RESPONSE_FIELDS, |
355 | 355 | { "data", 96, 32, PACKET_FIELD_TRANSACTION }, |
356 | 356 | { "crc", 128, 32, PACKET_FIELD_DETAIL }, |
357 | 357 | { "ack", 188, 4, 0, ack_names }, |
358 | 358 | }; |
359 | 359 | |
360 | -struct packet_field read_block_request_fields[] = { | |
360 | +static const struct packet_field read_block_request_fields[] = { | |
361 | 361 | COMMON_REQUEST_FIELDS, |
362 | 362 | { "data_length", 96, 16, PACKET_FIELD_TRANSACTION }, |
363 | 363 | { "extended_tcode", 112, 16 }, |
... | ... | @@ -365,7 +365,7 @@ |
365 | 365 | { "ack", 188, 4, 0, ack_names }, |
366 | 366 | }; |
367 | 367 | |
368 | -struct packet_field block_response_fields[] = { | |
368 | +static const struct packet_field block_response_fields[] = { | |
369 | 369 | COMMON_RESPONSE_FIELDS, |
370 | 370 | { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH }, |
371 | 371 | { "extended_tcode", 112, 16 }, |
372 | 372 | |
... | ... | @@ -375,13 +375,13 @@ |
375 | 375 | { "ack", -4, 4, 0, ack_names }, |
376 | 376 | }; |
377 | 377 | |
378 | -struct packet_field write_quadlet_request_fields[] = { | |
378 | +static const struct packet_field write_quadlet_request_fields[] = { | |
379 | 379 | COMMON_REQUEST_FIELDS, |
380 | 380 | { "data", 96, 32, PACKET_FIELD_TRANSACTION }, |
381 | 381 | { "ack", -4, 4, 0, ack_names }, |
382 | 382 | }; |
383 | 383 | |
384 | -struct packet_field block_request_fields[] = { | |
384 | +static const struct packet_field block_request_fields[] = { | |
385 | 385 | COMMON_REQUEST_FIELDS, |
386 | 386 | { "data_length", 96, 16, PACKET_FIELD_DATA_LENGTH | PACKET_FIELD_TRANSACTION }, |
387 | 387 | { "extended_tcode", 112, 16, PACKET_FIELD_TRANSACTION }, |
388 | 388 | |
... | ... | @@ -391,13 +391,13 @@ |
391 | 391 | { "ack", -4, 4, 0, ack_names }, |
392 | 392 | }; |
393 | 393 | |
394 | -struct packet_field write_response_fields[] = { | |
394 | +static const struct packet_field write_response_fields[] = { | |
395 | 395 | COMMON_RESPONSE_FIELDS, |
396 | 396 | { "reserved", 64, 32, PACKET_FIELD_DETAIL }, |
397 | 397 | { "ack", -4, 4, 0, ack_names }, |
398 | 398 | }; |
399 | 399 | |
400 | -struct packet_field iso_data_fields[] = { | |
400 | +static const struct packet_field iso_data_fields[] = { | |
401 | 401 | { "data_length", 0, 16, PACKET_FIELD_DATA_LENGTH }, |
402 | 402 | { "tag", 16, 2 }, |
403 | 403 | { "channel", 18, 6 }, |
... | ... | @@ -409,7 +409,7 @@ |
409 | 409 | { "ack", -4, 4, 0, ack_names }, |
410 | 410 | }; |
411 | 411 | |
412 | -static struct packet_info packet_info[] = { | |
412 | +static const struct packet_info packet_info[] = { | |
413 | 413 | { |
414 | 414 | .name = "write_quadlet_request", |
415 | 415 | .type = PACKET_REQUEST, |
... | ... | @@ -486,7 +486,7 @@ |
486 | 486 | }, |
487 | 487 | }; |
488 | 488 | |
489 | -int | |
489 | +static int | |
490 | 490 | handle_packet(uint32_t *data, size_t length) |
491 | 491 | { |
492 | 492 | if (length == 0) { |
... | ... | @@ -629,7 +629,8 @@ |
629 | 629 | return 1; |
630 | 630 | } |
631 | 631 | |
632 | -unsigned int get_bits(struct link_packet *packet, int offset, int width) | |
632 | +static unsigned int | |
633 | +get_bits(struct link_packet *packet, int offset, int width) | |
633 | 634 | { |
634 | 635 | uint32_t *data = (uint32_t *) packet; |
635 | 636 | uint32_t index, shift, mask; |
... | ... | @@ -649,7 +650,8 @@ |
649 | 650 | #error unsupported byte order. |
650 | 651 | #endif |
651 | 652 | |
652 | -void dump_data(unsigned char *data, int length) | |
653 | +static void | |
654 | +dump_data(unsigned char *data, int length) | |
653 | 655 | { |
654 | 656 | int i, print_length; |
655 | 657 | |
656 | 658 | |
... | ... | @@ -671,14 +673,14 @@ |
671 | 673 | decode_link_packet(struct link_packet *packet, size_t length, |
672 | 674 | int include_flags, int exclude_flags) |
673 | 675 | { |
674 | - struct packet_info *pi; | |
676 | + const struct packet_info *pi; | |
675 | 677 | int data_length = 0; |
676 | 678 | int i; |
677 | 679 | |
678 | 680 | pi = &packet_info[packet->common.tcode]; |
679 | 681 | |
680 | 682 | for (i = 0; i < pi->field_count; i++) { |
681 | - struct packet_field *f = &pi->fields[i]; | |
683 | + const struct packet_field *f = &pi->fields[i]; | |
682 | 684 | int offset; |
683 | 685 | |
684 | 686 | if (f->flags & exclude_flags) |
685 | 687 | |
686 | 688 | |
... | ... | @@ -848,15 +850,15 @@ |
848 | 850 | printf(SHOW_CURSOR "\n"); |
849 | 851 | } |
850 | 852 | |
851 | -struct termios saved_attributes; | |
853 | +static struct termios saved_attributes; | |
852 | 854 | |
853 | -void | |
855 | +static void | |
854 | 856 | reset_input_mode(void) |
855 | 857 | { |
856 | 858 | tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes); |
857 | 859 | } |
858 | 860 | |
859 | -void | |
861 | +static void | |
860 | 862 | set_input_mode(void) |
861 | 863 | { |
862 | 864 | struct termios tattr; |