[U-Boot] [PATCH v2 13/21] net: cosmetic: Un-typedef ICMP_t
Joe Hershberger
joe.hershberger at ni.com
Wed Mar 28 01:42:44 CEST 2012
Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Mike Frysinger <vapier at gentoo.org>
---
Changes for v2:
- Split apart from "Un-typedef variables in net"
- Renamed structs from *_t to *_hdr since they are nolonger types
include/net.h | 6 ++++--
net/net.c | 2 +-
net/ping.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/net.h b/include/net.h
index 937a99e..538eb86 100644
--- a/include/net.h
+++ b/include/net.h
@@ -297,7 +297,7 @@ struct ARP_hdr {
/* Codes for NOT_REACH */
#define ICMP_NOT_REACH_PORT 3 /* Port unreachable */
-typedef struct icmphdr {
+struct ICMP_hdr {
uchar type;
uchar code;
ushort checksum;
@@ -313,8 +313,10 @@ typedef struct icmphdr {
} frag;
uchar data[0];
} un;
-} ICMP_t;
+};
+#define ICMP_HDR_SIZE (sizeof(struct ICMP_hdr))
+#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE)
/*
* Maximum packet size; used to allocate packet storage.
diff --git a/net/net.c b/net/net.c
index 76df737..f8ec623 100644
--- a/net/net.c
+++ b/net/net.c
@@ -827,7 +827,7 @@ static inline struct IP_UDP_hdr *NetDefragment(struct IP_UDP_hdr *ip, int *lenp)
static void receive_icmp(struct IP_UDP_hdr *ip, int len,
IPaddr_t src_ip, struct Ethernet_hdr *et)
{
- ICMP_t *icmph = (ICMP_t *)&ip->udp_src;
+ struct ICMP_hdr *icmph = (struct ICMP_hdr *)&(ip->udp_src);
switch (icmph->type) {
case ICMP_REDIRECT:
diff --git a/net/ping.c b/net/ping.c
index e7fa64e..27fca6a 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -100,7 +100,7 @@ void ping_start(void)
void ping_receive(struct Ethernet_hdr *et, struct IP_UDP_hdr *ip, int len)
{
- ICMP_t *icmph = (ICMP_t *)&(ip->udp_src);
+ struct ICMP_hdr *icmph = (struct ICMP_hdr *)&(ip->udp_src);
IPaddr_t src_ip;
switch (icmph->type) {
--
1.6.0.2
More information about the U-Boot
mailing list