@@ -133,7 +133,7 @@ static const struct poptOption options[] = {
133133};
134134
135135/* Allow all ^C except the first to interrupt the program in the usual way. */
136- void
136+ static void
137137sigint_handler (int signal_num )
138138{
139139 if (run == 1 ) {
@@ -142,7 +142,7 @@ sigint_handler(int signal_num)
142142 }
143143}
144144
145- struct subaction *
145+ static struct subaction *
146146subaction_create (uint32_t * data , size_t length )
147147{
148148 struct subaction * sa ;
@@ -156,17 +156,17 @@ subaction_create(uint32_t *data, size_t length)
156156 return sa ;
157157}
158158
159- void
159+ static void
160160subaction_destroy (struct subaction * sa )
161161{
162162 free (sa );
163163}
164164
165- struct list pending_transaction_list = {
165+ static struct list pending_transaction_list = {
166166 & pending_transaction_list , & pending_transaction_list
167167};
168168
169- struct link_transaction *
169+ static struct link_transaction *
170170link_transaction_lookup (int request_node , int response_node , int tlabel )
171171{
172172 struct link_transaction * t ;
@@ -190,7 +190,7 @@ link_transaction_lookup(int request_node, int response_node, int tlabel)
190190 return t ;
191191}
192192
193- void
193+ static void
194194link_transaction_destroy (struct link_transaction * t )
195195{
196196 struct subaction * sa ;
@@ -213,11 +213,11 @@ struct protocol_decoder {
213213 int (* decode )(struct link_transaction * t );
214214};
215215
216- static struct protocol_decoder protocol_decoders [] = {
216+ static const struct protocol_decoder protocol_decoders [] = {
217217 { "FCP" , decode_fcp }
218218};
219219
220- void
220+ static void
221221handle_transaction (struct link_transaction * t )
222222{
223223 struct subaction * sa ;
@@ -254,7 +254,7 @@ handle_transaction(struct link_transaction *t)
254254 link_transaction_destroy (t );
255255}
256256
257- void
257+ static void
258258clear_pending_transaction_list (void )
259259{
260260 struct link_transaction * t ;
@@ -313,7 +313,7 @@ struct packet_info {
313313 const char * name ;
314314 int type ;
315315 int response_tcode ;
316- struct packet_field * fields ;
316+ const struct packet_field * fields ;
317317 int field_count ;
318318};
319319
@@ -344,28 +344,28 @@ struct packet_field {
344344 { "src", 32, 16 }, \
345345 { "rcode", 48, 4, PACKET_FIELD_TRANSACTION, rcode_names }
346346
347- struct packet_field read_quadlet_request_fields [] = {
347+ static const struct packet_field read_quadlet_request_fields [] = {
348348 COMMON_REQUEST_FIELDS ,
349349 { "crc" , 96 , 32 , PACKET_FIELD_DETAIL },
350350 { "ack" , 156 , 4 , 0 , ack_names },
351351};
352352
353- struct packet_field read_quadlet_response_fields [] = {
353+ static const struct packet_field read_quadlet_response_fields [] = {
354354 COMMON_RESPONSE_FIELDS ,
355355 { "data" , 96 , 32 , PACKET_FIELD_TRANSACTION },
356356 { "crc" , 128 , 32 , PACKET_FIELD_DETAIL },
357357 { "ack" , 188 , 4 , 0 , ack_names },
358358};
359359
360- struct packet_field read_block_request_fields [] = {
360+ static const struct packet_field read_block_request_fields [] = {
361361 COMMON_REQUEST_FIELDS ,
362362 { "data_length" , 96 , 16 , PACKET_FIELD_TRANSACTION },
363363 { "extended_tcode" , 112 , 16 },
364364 { "crc" , 128 , 32 , PACKET_FIELD_DETAIL },
365365 { "ack" , 188 , 4 , 0 , ack_names },
366366};
367367
368- struct packet_field block_response_fields [] = {
368+ static const struct packet_field block_response_fields [] = {
369369 COMMON_RESPONSE_FIELDS ,
370370 { "data_length" , 96 , 16 , PACKET_FIELD_DATA_LENGTH },
371371 { "extended_tcode" , 112 , 16 },
@@ -375,13 +375,13 @@ struct packet_field block_response_fields[] = {
375375 { "ack" , -4 , 4 , 0 , ack_names },
376376};
377377
378- struct packet_field write_quadlet_request_fields [] = {
378+ static const struct packet_field write_quadlet_request_fields [] = {
379379 COMMON_REQUEST_FIELDS ,
380380 { "data" , 96 , 32 , PACKET_FIELD_TRANSACTION },
381381 { "ack" , -4 , 4 , 0 , ack_names },
382382};
383383
384- struct packet_field block_request_fields [] = {
384+ static const struct packet_field block_request_fields [] = {
385385 COMMON_REQUEST_FIELDS ,
386386 { "data_length" , 96 , 16 , PACKET_FIELD_DATA_LENGTH | PACKET_FIELD_TRANSACTION },
387387 { "extended_tcode" , 112 , 16 , PACKET_FIELD_TRANSACTION },
@@ -391,13 +391,13 @@ struct packet_field block_request_fields[] = {
391391 { "ack" , -4 , 4 , 0 , ack_names },
392392};
393393
394- struct packet_field write_response_fields [] = {
394+ static const struct packet_field write_response_fields [] = {
395395 COMMON_RESPONSE_FIELDS ,
396396 { "reserved" , 64 , 32 , PACKET_FIELD_DETAIL },
397397 { "ack" , -4 , 4 , 0 , ack_names },
398398};
399399
400- struct packet_field iso_data_fields [] = {
400+ static const struct packet_field iso_data_fields [] = {
401401 { "data_length" , 0 , 16 , PACKET_FIELD_DATA_LENGTH },
402402 { "tag" , 16 , 2 },
403403 { "channel" , 18 , 6 },
@@ -409,7 +409,7 @@ struct packet_field iso_data_fields[] = {
409409 { "ack" , -4 , 4 , 0 , ack_names },
410410};
411411
412- static struct packet_info packet_info [] = {
412+ static const struct packet_info packet_info [] = {
413413 {
414414 .name = "write_quadlet_request" ,
415415 .type = PACKET_REQUEST ,
@@ -486,7 +486,7 @@ static struct packet_info packet_info[] = {
486486 },
487487};
488488
489- int
489+ static int
490490handle_packet (uint32_t * data , size_t length )
491491{
492492 if (length == 0 ) {
@@ -629,7 +629,8 @@ handle_packet(uint32_t *data, size_t length)
629629 return 1 ;
630630}
631631
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 )
633634{
634635 uint32_t * data = (uint32_t * ) packet ;
635636 uint32_t index , shift , mask ;
@@ -649,7 +650,8 @@ unsigned int get_bits(struct link_packet *packet, int offset, int width)
649650#error unsupported byte order.
650651#endif
651652
652- void dump_data (unsigned char * data , int length )
653+ static void
654+ dump_data (unsigned char * data , int length )
653655{
654656 int i , print_length ;
655657
@@ -671,14 +673,14 @@ static void
671673decode_link_packet (struct link_packet * packet , size_t length ,
672674 int include_flags , int exclude_flags )
673675{
674- struct packet_info * pi ;
676+ const struct packet_info * pi ;
675677 int data_length = 0 ;
676678 int i ;
677679
678680 pi = & packet_info [packet -> common .tcode ];
679681
680682 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 ];
682684 int offset ;
683685
684686 if (f -> flags & exclude_flags )
@@ -848,15 +850,15 @@ print_stats(uint32_t *data, size_t length)
848850 printf (SHOW_CURSOR "\n" );
849851}
850852
851- struct termios saved_attributes ;
853+ static struct termios saved_attributes ;
852854
853- void
855+ static void
854856reset_input_mode (void )
855857{
856858 tcsetattr (STDIN_FILENO , TCSANOW , & saved_attributes );
857859}
858860
859- void
861+ static void
860862set_input_mode (void )
861863{
862864 struct termios tattr ;
0 commit comments