Lines 60-95
Link Here
|
60 |
/* Private copy of Wireless extensions (in this directoty) */ |
60 |
/* Private copy of Wireless extensions (in this directoty) */ |
61 |
#include "wireless.h" |
61 |
#include "wireless.h" |
62 |
|
62 |
|
63 |
/* Make gcc understant that when we say inline, we mean it. |
|
|
64 |
* I really hate when the compiler is trying to be more clever than me, |
65 |
* because in this case gcc is not able to figure out functions with a |
66 |
* single call site, so not only I have to tag those functions inline |
67 |
* by hand, but then it refuse to inline them properly. |
68 |
* Total saving for iwevent : 150B = 0.7%. |
69 |
* Fortunately, in gcc 3.4, they now automatically inline static functions |
70 |
* with a single call site. Hurrah ! |
71 |
* Jean II */ |
72 |
#undef IW_GCC_HAS_BROKEN_INLINE |
73 |
#if __GNUC__ == 3 |
74 |
#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4 |
75 |
#define IW_GCC_HAS_BROKEN_INLINE 1 |
76 |
#endif /* __GNUC_MINOR__ */ |
77 |
#endif /* __GNUC__ */ |
78 |
/* However, gcc 4.0 has introduce a new "feature", when compiling with |
79 |
* '-Os', it does not want to inline iw_ether_cmp() and friends. |
80 |
* So, we need to fix inline again ! |
81 |
* Jean II */ |
82 |
#if __GNUC__ == 4 |
83 |
#define IW_GCC_HAS_BROKEN_INLINE 1 |
84 |
#endif /* __GNUC__ */ |
85 |
/* Now, really fix the inline */ |
86 |
#ifdef IW_GCC_HAS_BROKEN_INLINE |
87 |
#ifdef inline |
88 |
#undef inline |
89 |
#endif /* inline */ |
90 |
#define inline inline __attribute__((always_inline)) |
91 |
#endif /* IW_GCC_HAS_BROKEN_INLINE */ |
92 |
|
93 |
#ifdef __cplusplus |
63 |
#ifdef __cplusplus |
94 |
extern "C" { |
64 |
extern "C" { |
95 |
#endif |
65 |
#endif |
Lines 491-496
Link Here
|
491 |
/************************* INLINE FUNTIONS *************************/ |
461 |
/************************* INLINE FUNTIONS *************************/ |
492 |
/* |
462 |
/* |
493 |
* Functions that are so simple that it's more efficient inlining them |
463 |
* Functions that are so simple that it's more efficient inlining them |
|
|
464 |
* Most inline are private because gcc is fussy about inline... |
494 |
*/ |
465 |
*/ |
495 |
|
466 |
|
496 |
/* |
467 |
/* |
Lines 502-508
Link Here
|
502 |
/* |
473 |
/* |
503 |
* Wrapper to push some Wireless Parameter in the driver |
474 |
* Wrapper to push some Wireless Parameter in the driver |
504 |
*/ |
475 |
*/ |
505 |
static inline int |
476 |
static inline __attribute__((always_inline)) int |
506 |
iw_set_ext(int skfd, /* Socket to the kernel */ |
477 |
iw_set_ext(int skfd, /* Socket to the kernel */ |
507 |
const char * ifname, /* Device name */ |
478 |
const char * ifname, /* Device name */ |
508 |
int request, /* WE ID */ |
479 |
int request, /* WE ID */ |
Lines 518-524
Link Here
|
518 |
/* |
489 |
/* |
519 |
* Wrapper to extract some Wireless Parameter out of the driver |
490 |
* Wrapper to extract some Wireless Parameter out of the driver |
520 |
*/ |
491 |
*/ |
521 |
static inline int |
492 |
static inline __attribute__((always_inline)) int |
522 |
iw_get_ext(int skfd, /* Socket to the kernel */ |
493 |
iw_get_ext(int skfd, /* Socket to the kernel */ |
523 |
const char * ifname, /* Device name */ |
494 |
const char * ifname, /* Device name */ |
524 |
int request, /* WE ID */ |
495 |
int request, /* WE ID */ |
Lines 534-540
Link Here
|
534 |
/* |
505 |
/* |
535 |
* Close the socket used for ioctl. |
506 |
* Close the socket used for ioctl. |
536 |
*/ |
507 |
*/ |
537 |
static inline void |
508 |
static inline __attribute__((always_inline)) void |
538 |
iw_sockets_close(int skfd) |
509 |
iw_sockets_close(int skfd) |
539 |
{ |
510 |
{ |
540 |
close(skfd); |
511 |
close(skfd); |
Lines 544-550
Link Here
|
544 |
/* |
515 |
/* |
545 |
* Display an Ethernet Socket Address in readable format. |
516 |
* Display an Ethernet Socket Address in readable format. |
546 |
*/ |
517 |
*/ |
547 |
static inline char * |
518 |
static inline __attribute__((always_inline)) char * |
548 |
iw_saether_ntop(const struct sockaddr *sap, char* bufp) |
519 |
iw_saether_ntop(const struct sockaddr *sap, char* bufp) |
549 |
{ |
520 |
{ |
550 |
iw_ether_ntop((const struct ether_addr *) sap->sa_data, bufp); |
521 |
iw_ether_ntop((const struct ether_addr *) sap->sa_data, bufp); |
Lines 554-560
Link Here
|
554 |
/* |
525 |
/* |
555 |
* Input an Ethernet Socket Address and convert to binary. |
526 |
* Input an Ethernet Socket Address and convert to binary. |
556 |
*/ |
527 |
*/ |
557 |
static inline int |
528 |
static inline __attribute__((always_inline)) int |
558 |
iw_saether_aton(const char *bufp, struct sockaddr *sap) |
529 |
iw_saether_aton(const char *bufp, struct sockaddr *sap) |
559 |
{ |
530 |
{ |
560 |
sap->sa_family = ARPHRD_ETHER; |
531 |
sap->sa_family = ARPHRD_ETHER; |
Lines 565-571
Link Here
|
565 |
/* |
536 |
/* |
566 |
* Create an Ethernet broadcast address |
537 |
* Create an Ethernet broadcast address |
567 |
*/ |
538 |
*/ |
568 |
static inline void |
539 |
static inline __attribute__((always_inline)) void |
569 |
iw_broad_ether(struct sockaddr *sap) |
540 |
iw_broad_ether(struct sockaddr *sap) |
570 |
{ |
541 |
{ |
571 |
sap->sa_family = ARPHRD_ETHER; |
542 |
sap->sa_family = ARPHRD_ETHER; |
Lines 576-582
Link Here
|
576 |
/* |
547 |
/* |
577 |
* Create an Ethernet NULL address |
548 |
* Create an Ethernet NULL address |
578 |
*/ |
549 |
*/ |
579 |
static inline void |
550 |
static inline __attribute__((always_inline)) void |
580 |
iw_null_ether(struct sockaddr *sap) |
551 |
iw_null_ether(struct sockaddr *sap) |
581 |
{ |
552 |
{ |
582 |
sap->sa_family = ARPHRD_ETHER; |
553 |
sap->sa_family = ARPHRD_ETHER; |
Lines 587-593
Link Here
|
587 |
/* |
558 |
/* |
588 |
* Compare two ethernet addresses |
559 |
* Compare two ethernet addresses |
589 |
*/ |
560 |
*/ |
590 |
static inline int |
561 |
static inline __attribute__((always_inline)) int |
591 |
iw_ether_cmp(const struct ether_addr* eth1, const struct ether_addr* eth2) |
562 |
iw_ether_cmp(const struct ether_addr* eth1, const struct ether_addr* eth2) |
592 |
{ |
563 |
{ |
593 |
return memcmp(eth1, eth2, sizeof(*eth1)); |
564 |
return memcmp(eth1, eth2, sizeof(*eth1)); |