tools/firewire: nosy-dump: make some symbols static or const

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+29 -27
+29 -27
tools/firewire/nosy-dump.c
··· 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 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; ··· 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 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; ··· 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 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 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 ··· 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 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 }, ··· 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 }, ··· 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 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 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 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; ··· 650 649 #error unsupported byte order. 651 650 #endif 652 651 653 - void dump_data(unsigned char *data, int length) 652 + static void 653 + dump_data(unsigned char *data, int length) 654 654 { 655 655 int i, print_length; 656 656 ··· 673 671 decode_link_packet(struct link_packet *packet, size_t length, 674 672 int include_flags, int exclude_flags) 675 673 { 676 - struct packet_info *pi; 674 + const struct packet_info *pi; 677 675 int data_length = 0; 678 676 int i; 679 677 680 678 pi = &packet_info[packet->common.tcode]; 681 679 682 680 for (i = 0; i < pi->field_count; i++) { 683 - struct packet_field *f = &pi->fields[i]; 681 + const struct packet_field *f = &pi->fields[i]; 684 682 int offset; 685 683 686 684 if (f->flags & exclude_flags) ··· 850 848 printf(SHOW_CURSOR "\n"); 851 849 } 852 850 853 - struct termios saved_attributes; 851 + static struct termios saved_attributes; 854 852 855 - void 853 + static void 856 854 reset_input_mode(void) 857 855 { 858 856 tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes); 859 857 } 860 858 861 - void 859 + static void 862 860 set_input_mode(void) 863 861 { 864 862 struct termios tattr;