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