diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-05 12:06:05 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-05 12:06:05 +0200 |
commit | d5f1b1bbe0a881f66b6bb6951fa54e553002c24d (patch) | |
tree | a3da20d19fa86c77e63c08f01d052b196cb1b192 /networking/ifupdown.c | |
parent | 8507e1f10927bc6498cf38eb8324a53bde8e0a61 (diff) | |
download | busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.tar.gz busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.tar.bz2 busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.zip |
*: add FAST_FUNC to function ptrs where it makes sense
function old new delta
evalcommand 1195 1209 +14
testcmd - 10 +10
printfcmd - 10 +10
echocmd - 10 +10
func_exec 270 276 +6
echo_dg 104 109 +5
store_nlmsg 85 89 +4
pseudo_exec_argv 195 198 +3
dotcmd 287 290 +3
machtime_stream 29 31 +2
discard_stream 24 26 +2
argstr 1299 1301 +2
killcmd 108 109 +1
evalfor 226 227 +1
daytime_stream 43 44 +1
run_list 2544 2543 -1
lookupvar 62 61 -1
ipaddr_modify 1310 1309 -1
...
parse_stream 2254 2245 -9
evalpipe 356 347 -9
collect_if 210 197 -13
read_opt 869 851 -18
handle_dollar 681 658 -23
print_addrinfo 1342 1303 -39
iterate_on_dir 156 59 -97
print_route 1709 1609 -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767) Total: -693 bytes
text data bss dec hex filename
841748 467 7872 850087 cf8a7 busybox_old
841061 467 7872 849400 cf5f8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r-- | networking/ifupdown.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 604a216d4..6d608105e 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -42,8 +42,8 @@ typedef int execfn(char *command); | |||
42 | 42 | ||
43 | struct method_t { | 43 | struct method_t { |
44 | const char *name; | 44 | const char *name; |
45 | int (*up)(struct interface_defn_t *ifd, execfn *e); | 45 | int (*up)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC; |
46 | int (*down)(struct interface_defn_t *ifd, execfn *e); | 46 | int (*down)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct address_family_t { | 49 | struct address_family_t { |
@@ -325,7 +325,7 @@ static int execute(const char *command, struct interface_defn_t *ifd, execfn *ex | |||
325 | #endif | 325 | #endif |
326 | 326 | ||
327 | #if ENABLE_FEATURE_IFUPDOWN_IPV6 | 327 | #if ENABLE_FEATURE_IFUPDOWN_IPV6 |
328 | static int loopback_up6(struct interface_defn_t *ifd, execfn *exec) | 328 | static int FAST_FUNC loopback_up6(struct interface_defn_t *ifd, execfn *exec) |
329 | { | 329 | { |
330 | #if ENABLE_FEATURE_IFUPDOWN_IP | 330 | #if ENABLE_FEATURE_IFUPDOWN_IP |
331 | int result; | 331 | int result; |
@@ -337,7 +337,7 @@ static int loopback_up6(struct interface_defn_t *ifd, execfn *exec) | |||
337 | #endif | 337 | #endif |
338 | } | 338 | } |
339 | 339 | ||
340 | static int loopback_down6(struct interface_defn_t *ifd, execfn *exec) | 340 | static int FAST_FUNC loopback_down6(struct interface_defn_t *ifd, execfn *exec) |
341 | { | 341 | { |
342 | #if ENABLE_FEATURE_IFUPDOWN_IP | 342 | #if ENABLE_FEATURE_IFUPDOWN_IP |
343 | return execute("ip link set %iface% down", ifd, exec); | 343 | return execute("ip link set %iface% down", ifd, exec); |
@@ -346,7 +346,7 @@ static int loopback_down6(struct interface_defn_t *ifd, execfn *exec) | |||
346 | #endif | 346 | #endif |
347 | } | 347 | } |
348 | 348 | ||
349 | static int static_up6(struct interface_defn_t *ifd, execfn *exec) | 349 | static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec) |
350 | { | 350 | { |
351 | int result; | 351 | int result; |
352 | #if ENABLE_FEATURE_IFUPDOWN_IP | 352 | #if ENABLE_FEATURE_IFUPDOWN_IP |
@@ -362,7 +362,7 @@ static int static_up6(struct interface_defn_t *ifd, execfn *exec) | |||
362 | return ((result == 3) ? 3 : 0); | 362 | return ((result == 3) ? 3 : 0); |
363 | } | 363 | } |
364 | 364 | ||
365 | static int static_down6(struct interface_defn_t *ifd, execfn *exec) | 365 | static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec) |
366 | { | 366 | { |
367 | #if ENABLE_FEATURE_IFUPDOWN_IP | 367 | #if ENABLE_FEATURE_IFUPDOWN_IP |
368 | return execute("ip link set %iface% down", ifd, exec); | 368 | return execute("ip link set %iface% down", ifd, exec); |
@@ -372,7 +372,7 @@ static int static_down6(struct interface_defn_t *ifd, execfn *exec) | |||
372 | } | 372 | } |
373 | 373 | ||
374 | #if ENABLE_FEATURE_IFUPDOWN_IP | 374 | #if ENABLE_FEATURE_IFUPDOWN_IP |
375 | static int v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) | 375 | static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) |
376 | { | 376 | { |
377 | int result; | 377 | int result; |
378 | result = execute("ip tunnel add %iface% mode sit remote " | 378 | result = execute("ip tunnel add %iface% mode sit remote " |
@@ -383,7 +383,7 @@ static int v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) | |||
383 | return ((result == 4) ? 4 : 0); | 383 | return ((result == 4) ? 4 : 0); |
384 | } | 384 | } |
385 | 385 | ||
386 | static int v4tunnel_down(struct interface_defn_t * ifd, execfn * exec) | 386 | static int FAST_FUNC v4tunnel_down(struct interface_defn_t * ifd, execfn * exec) |
387 | { | 387 | { |
388 | return execute("ip tunnel del %iface%", ifd, exec); | 388 | return execute("ip tunnel del %iface%", ifd, exec); |
389 | } | 389 | } |
@@ -405,7 +405,7 @@ static const struct address_family_t addr_inet6 = { | |||
405 | #endif /* FEATURE_IFUPDOWN_IPV6 */ | 405 | #endif /* FEATURE_IFUPDOWN_IPV6 */ |
406 | 406 | ||
407 | #if ENABLE_FEATURE_IFUPDOWN_IPV4 | 407 | #if ENABLE_FEATURE_IFUPDOWN_IPV4 |
408 | static int loopback_up(struct interface_defn_t *ifd, execfn *exec) | 408 | static int FAST_FUNC loopback_up(struct interface_defn_t *ifd, execfn *exec) |
409 | { | 409 | { |
410 | #if ENABLE_FEATURE_IFUPDOWN_IP | 410 | #if ENABLE_FEATURE_IFUPDOWN_IP |
411 | int result; | 411 | int result; |
@@ -417,7 +417,7 @@ static int loopback_up(struct interface_defn_t *ifd, execfn *exec) | |||
417 | #endif | 417 | #endif |
418 | } | 418 | } |
419 | 419 | ||
420 | static int loopback_down(struct interface_defn_t *ifd, execfn *exec) | 420 | static int FAST_FUNC loopback_down(struct interface_defn_t *ifd, execfn *exec) |
421 | { | 421 | { |
422 | #if ENABLE_FEATURE_IFUPDOWN_IP | 422 | #if ENABLE_FEATURE_IFUPDOWN_IP |
423 | int result; | 423 | int result; |
@@ -429,7 +429,7 @@ static int loopback_down(struct interface_defn_t *ifd, execfn *exec) | |||
429 | #endif | 429 | #endif |
430 | } | 430 | } |
431 | 431 | ||
432 | static int static_up(struct interface_defn_t *ifd, execfn *exec) | 432 | static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec) |
433 | { | 433 | { |
434 | int result; | 434 | int result; |
435 | #if ENABLE_FEATURE_IFUPDOWN_IP | 435 | #if ENABLE_FEATURE_IFUPDOWN_IP |
@@ -451,7 +451,7 @@ static int static_up(struct interface_defn_t *ifd, execfn *exec) | |||
451 | #endif | 451 | #endif |
452 | } | 452 | } |
453 | 453 | ||
454 | static int static_down(struct interface_defn_t *ifd, execfn *exec) | 454 | static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec) |
455 | { | 455 | { |
456 | int result; | 456 | int result; |
457 | #if ENABLE_FEATURE_IFUPDOWN_IP | 457 | #if ENABLE_FEATURE_IFUPDOWN_IP |
@@ -468,8 +468,7 @@ static int static_down(struct interface_defn_t *ifd, execfn *exec) | |||
468 | } | 468 | } |
469 | 469 | ||
470 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 470 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
471 | struct dhcp_client_t | 471 | struct dhcp_client_t { |
472 | { | ||
473 | const char *name; | 472 | const char *name; |
474 | const char *startcmd; | 473 | const char *startcmd; |
475 | const char *stopcmd; | 474 | const char *stopcmd; |
@@ -497,7 +496,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { | |||
497 | #endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */ | 496 | #endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */ |
498 | 497 | ||
499 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 498 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
500 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | 499 | static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec) |
501 | { | 500 | { |
502 | unsigned i; | 501 | unsigned i; |
503 | #if ENABLE_FEATURE_IFUPDOWN_IP | 502 | #if ENABLE_FEATURE_IFUPDOWN_IP |
@@ -517,7 +516,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
517 | return 0; | 516 | return 0; |
518 | } | 517 | } |
519 | #elif ENABLE_APP_UDHCPC | 518 | #elif ENABLE_APP_UDHCPC |
520 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | 519 | static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec) |
521 | { | 520 | { |
522 | #if ENABLE_FEATURE_IFUPDOWN_IP | 521 | #if ENABLE_FEATURE_IFUPDOWN_IP |
523 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | 522 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ |
@@ -533,7 +532,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
533 | ifd, exec); | 532 | ifd, exec); |
534 | } | 533 | } |
535 | #else | 534 | #else |
536 | static int dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM, | 535 | static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM, |
537 | execfn *exec UNUSED_PARAM) | 536 | execfn *exec UNUSED_PARAM) |
538 | { | 537 | { |
539 | return 0; /* no dhcp support */ | 538 | return 0; /* no dhcp support */ |
@@ -541,7 +540,7 @@ static int dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM, | |||
541 | #endif | 540 | #endif |
542 | 541 | ||
543 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 542 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
544 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | 543 | static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec) |
545 | { | 544 | { |
546 | int result = 0; | 545 | int result = 0; |
547 | unsigned i; | 546 | unsigned i; |
@@ -564,7 +563,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | |||
564 | return ((result == 3) ? 3 : 0); | 563 | return ((result == 3) ? 3 : 0); |
565 | } | 564 | } |
566 | #elif ENABLE_APP_UDHCPC | 565 | #elif ENABLE_APP_UDHCPC |
567 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | 566 | static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec) |
568 | { | 567 | { |
569 | int result; | 568 | int result; |
570 | result = execute("kill " | 569 | result = execute("kill " |
@@ -579,42 +578,42 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | |||
579 | return ((result == 3) ? 3 : 0); | 578 | return ((result == 3) ? 3 : 0); |
580 | } | 579 | } |
581 | #else | 580 | #else |
582 | static int dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM, | 581 | static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM, |
583 | execfn *exec UNUSED_PARAM) | 582 | execfn *exec UNUSED_PARAM) |
584 | { | 583 | { |
585 | return 0; /* no dhcp support */ | 584 | return 0; /* no dhcp support */ |
586 | } | 585 | } |
587 | #endif | 586 | #endif |
588 | 587 | ||
589 | static int manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM) | 588 | static int FAST_FUNC manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM) |
590 | { | 589 | { |
591 | return 1; | 590 | return 1; |
592 | } | 591 | } |
593 | 592 | ||
594 | static int bootp_up(struct interface_defn_t *ifd, execfn *exec) | 593 | static int FAST_FUNC bootp_up(struct interface_defn_t *ifd, execfn *exec) |
595 | { | 594 | { |
596 | return execute("bootpc[[ --bootfile %bootfile%]] --dev %iface%" | 595 | return execute("bootpc[[ --bootfile %bootfile%]] --dev %iface%" |
597 | "[[ --server %server%]][[ --hwaddr %hwaddr%]]" | 596 | "[[ --server %server%]][[ --hwaddr %hwaddr%]]" |
598 | " --returniffail --serverbcast", ifd, exec); | 597 | " --returniffail --serverbcast", ifd, exec); |
599 | } | 598 | } |
600 | 599 | ||
601 | static int ppp_up(struct interface_defn_t *ifd, execfn *exec) | 600 | static int FAST_FUNC ppp_up(struct interface_defn_t *ifd, execfn *exec) |
602 | { | 601 | { |
603 | return execute("pon[[ %provider%]]", ifd, exec); | 602 | return execute("pon[[ %provider%]]", ifd, exec); |
604 | } | 603 | } |
605 | 604 | ||
606 | static int ppp_down(struct interface_defn_t *ifd, execfn *exec) | 605 | static int FAST_FUNC ppp_down(struct interface_defn_t *ifd, execfn *exec) |
607 | { | 606 | { |
608 | return execute("poff[[ %provider%]]", ifd, exec); | 607 | return execute("poff[[ %provider%]]", ifd, exec); |
609 | } | 608 | } |
610 | 609 | ||
611 | static int wvdial_up(struct interface_defn_t *ifd, execfn *exec) | 610 | static int FAST_FUNC wvdial_up(struct interface_defn_t *ifd, execfn *exec) |
612 | { | 611 | { |
613 | return execute("start-stop-daemon --start -x wvdial " | 612 | return execute("start-stop-daemon --start -x wvdial " |
614 | "-p /var/run/wvdial.%iface% -b -m --[[ %provider%]]", ifd, exec); | 613 | "-p /var/run/wvdial.%iface% -b -m --[[ %provider%]]", ifd, exec); |
615 | } | 614 | } |
616 | 615 | ||
617 | static int wvdial_down(struct interface_defn_t *ifd, execfn *exec) | 616 | static int FAST_FUNC wvdial_down(struct interface_defn_t *ifd, execfn *exec) |
618 | { | 617 | { |
619 | return execute("start-stop-daemon --stop -x wvdial " | 618 | return execute("start-stop-daemon --stop -x wvdial " |
620 | "-p /var/run/wvdial.%iface% -s 2", ifd, exec); | 619 | "-p /var/run/wvdial.%iface% -s 2", ifd, exec); |