aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-22 05:58:05 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-27 05:04:12 -0400
commit468066f771032ad4bef4a906dfe0b0a55593d64d (patch)
tree8b06137d89b1a088e6c604d2abd9d997b722282d /tools
parent92c16f7e9c65f9a271c6bd5020279b3e37989672 (diff)
tools/firewire: nosy-dump: make some symbols static or const
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'tools')
-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)
491{ 491{
492 if (length == 0) { 492 if (length == 0) {
@@ -629,7 +629,8 @@ handle_packet(uint32_t *data, size_t length)
629 return 1; 629 return 1;
630} 630}
631 631
632unsigned int get_bits(struct link_packet *packet, int offset, int width) 632static unsigned int
633get_bits(struct link_packet *packet, int offset, int width)
633{ 634{
634 uint32_t *data = (uint32_t *) packet; 635 uint32_t *data = (uint32_t *) packet;
635 uint32_t index, shift, mask; 636 uint32_t index, shift, mask;
@@ -649,7 +650,8 @@ unsigned int get_bits(struct link_packet *packet, int offset, int width)
649#error unsupported byte order. 650#error unsupported byte order.
650#endif 651#endif
651 652
652void dump_data(unsigned char *data, int length) 653static void
654dump_data(unsigned char *data, int length)
653{ 655{
654 int i, print_length; 656 int i, print_length;
655 657
@@ -671,14 +673,14 @@ static void
671decode_link_packet(struct link_packet *packet, size_t length, 673decode_link_packet(struct link_packet *packet, size_t length,
672 int include_flags, int exclude_flags) 674 int include_flags, int exclude_flags)
673{ 675{
674 struct packet_info *pi; 676 const struct packet_info *pi;
675 int data_length = 0; 677 int data_length = 0;
676 int i; 678 int i;
677 679
678 pi = &packet_info[packet->common.tcode]; 680 pi = &packet_info[packet->common.tcode];
679 681
680 for (i = 0; i < pi->field_count; i++) { 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 int offset; 684 int offset;
683 685
684 if (f->flags & exclude_flags) 686 if (f->flags & exclude_flags)
@@ -848,15 +850,15 @@ print_stats(uint32_t *data, size_t length)
848 printf(SHOW_CURSOR "\n"); 850 printf(SHOW_CURSOR "\n");
849} 851}
850 852
851struct termios saved_attributes; 853static struct termios saved_attributes;
852 854
853void 855static void
854reset_input_mode(void) 856reset_input_mode(void)
855{ 857{
856 tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes); 858 tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes);
857} 859}
858 860
859void 861static void
860set_input_mode(void) 862set_input_mode(void)
861{ 863{
862 struct termios tattr; 864 struct termios tattr;