diff options
author | Michael Chan <mchan@broadcom.com> | 2007-12-25 00:28:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:00:05 -0500 |
commit | 7ffc49a6ee92b7138c2ee28073a8e10e58335d62 (patch) | |
tree | 6421d389980f3a71b1b53ed6e1548eb08dbf1226 /include/linux/if_ether.h | |
parent | 21371f768bf7127ee45bfaadd17899df6a439e8f (diff) |
[ETH]: Combine format_addr() with print_mac().
print_mac() used many most net drivers and format_addr() used by
net-sysfs.c are very similar and they can be intergrated.
format_addr() is also identically redefined in the qla4xxx iscsi
driver.
Export a new function sysfs_format_mac() to be used by net-sysfs,
qla4xxx and others in the future. Both print_mac() and
sysfs_format_mac() call _format_mac_addr() to do the formatting.
Changed print_mac() to use unsigned char * to be consistent with
net_device struct's dev_addr. Added buffer length overrun checking
as suggested by Joe Perches.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_ether.h')
-rw-r--r-- | include/linux/if_ether.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index cc002cbbdc26..7a1e011b8a2c 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -124,12 +124,14 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | |||
124 | extern struct ctl_table ether_table[]; | 124 | extern struct ctl_table ether_table[]; |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); | ||
128 | |||
127 | /* | 129 | /* |
128 | * Display a 6 byte device address (MAC) in a readable format. | 130 | * Display a 6 byte device address (MAC) in a readable format. |
129 | */ | 131 | */ |
130 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | 132 | extern char *print_mac(char *buf, const unsigned char *addr); |
131 | extern char *print_mac(char *buf, const u8 *addr); | 133 | #define MAC_BUF_SIZE 18 |
132 | #define DECLARE_MAC_BUF(var) char var[18] __maybe_unused | 134 | #define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused |
133 | 135 | ||
134 | #endif | 136 | #endif |
135 | 137 | ||