From ce3a2ec0256a6442cc9a3b47a6d218baf3412c39 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 22 Sep 2010 20:34:20 +0200 Subject: [PATCH] Remove some dead code --- grub-core/Makefile.core.def | 1 - grub-core/net/arp.c | 3 +- grub-core/net/ethernet.c | 1 - grub-core/net/interface.c | 37 ------------------- grub-core/net/ip.c | 2 -- grub-core/net/netbuff.c | 2 +- grub-core/net/tftp.c | 2 -- grub-core/net/udp.c | 3 -- include/grub/net.h | 3 +- include/grub/net/arp.h | 1 - include/grub/net/interface.h | 70 ------------------------------------ include/grub/net/protocol.h | 9 ----- include/grub/net/type_net.h | 33 ----------------- 13 files changed, 3 insertions(+), 164 deletions(-) delete mode 100644 grub-core/net/interface.c delete mode 100644 include/grub/net/interface.h delete mode 100644 include/grub/net/protocol.h delete mode 100644 include/grub/net/type_net.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index d48c5d505..49dbd3f60 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1438,7 +1438,6 @@ module = { common = net/udp.c; common = net/ethernet.c; common = net/arp.c; - common = net/interface.c; common = net/netbuff.c; }; diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c index 5e10938ae..541b89411 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -92,7 +91,7 @@ grub_net_arp_resolve(struct grub_net_network_level_interface *inf, return GRUB_ERR_NONE; } current_time = grub_get_time_ms(); - if (current_time - start_time > TIMEOUT_TIME_MS) + if (current_time - start_time > 3000) break; } while (! entry); grub_netbuff_clear(nb); diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c index d3a34aec6..a40e1f795 100644 --- a/grub-core/net/ethernet.c +++ b/grub-core/net/ethernet.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include diff --git a/grub-core/net/interface.c b/grub-core/net/interface.c deleted file mode 100644 index f17b3e66b..000000000 --- a/grub-core/net/interface.c +++ /dev/null @@ -1,37 +0,0 @@ -/*#include - -#define INTERFACE_REGISTER_FUNCTIONS(layerprevious,layernext) \ -struct grub_net_##layername_layer_protocol *grub_net_##layername_layer_protocols;\ -\ -void grub_net_##layerprevious_##layernext_interface_register (struct grub_net_##layername_layer_protocol *prot)\ -{\ - grub_list_push (GRUB_AS_LIST_P (&grub_net_##layername_layer_protocols),\ - GRUB_AS_LIST (prot));\ -}\ -\ -void grub_net_##layerprevious_##layernext_interface_unregister (struct grub_net_##layername_layer_protocol *prot);\ -{\ - grub_list_remove (GRUB_AS_LIST_P (&grub_net_##layername_layer_protocols),\ - GRUB_AS_LIST (prot));\ -}\ - -INTERFACE_REGISTER_FUNCTIONS("application","transport"); -INTERFACE_REGISTER_FUNCTIONS("transport","network"); -INTERFACE_REGISTER_FUNCTIONS("network","link"); -INTERFACE_REGISTER_FUNCTIONS("link");*/ - -#include -#include -struct grub_net_protocol_stack - *grub_net_protocol_stack_get (char *name) -{ - struct grub_net_protocol_stack *p; - - for (p = grub_net_protocol_stacks; p; p = p->next) - { - if (!grub_strcmp(p->name,name)) - return p; - } - - return NULL; -} diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c index 264195ad3..023564a5a 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -2,8 +2,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/grub-core/net/netbuff.c b/grub-core/net/netbuff.c index 4f6a1da84..cc366ae09 100644 --- a/grub-core/net/netbuff.c +++ b/grub-core/net/netbuff.c @@ -73,7 +73,7 @@ struct grub_net_buff *grub_netbuff_alloc ( grub_size_t len ) len = ALIGN_UP (len,NETBUFF_ALIGN); data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb)); - nb = (struct grub_net_buff *) ((int)data + len); + nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len); nb->head = nb->data = nb->tail = data; nb->end = (char *) nb; diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c index bb518b78f..b9e3f49c4 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -4,8 +4,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/grub-core/net/udp.c b/grub-core/net/udp.c index 27e23e826..a73431f83 100644 --- a/grub-core/net/udp.c +++ b/grub-core/net/udp.c @@ -1,10 +1,7 @@ #include #include #include -#include #include -#include -#include #include grub_err_t diff --git a/include/grub/net.h b/include/grub/net.h index de188f615..20bf3c0e6 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -23,9 +23,8 @@ #include #include #include +#include #include -#include -#include typedef struct grub_fs *grub_net_app_level_t; diff --git a/include/grub/net/arp.h b/include/grub/net/arp.h index e547669a2..1475086e4 100644 --- a/include/grub/net/arp.h +++ b/include/grub/net/arp.h @@ -2,7 +2,6 @@ #define GRUB_NET_ARP_HEADER 1 #include #include -#include /* IANA ARP constant to define hardware type as ethernet */ #define ARPHRD_ETHERNET 1 diff --git a/include/grub/net/interface.h b/include/grub/net/interface.h deleted file mode 100644 index cf24dd22e..000000000 --- a/include/grub/net/interface.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef GRUB_INTERFACE_HEADER -#define GRUB_INTERFACE_HEADER -//#include -#include -#include -#include - -struct grub_net_protocol_stack -{ - struct grub_net_protocol_stack *next; - char *name; - grub_net_protocol_id_t id; - void *interface; -}; - -struct grub_net_application_transport_interface -{ - struct grub_net_transport_network_interface *inner_layer; - void *data; - struct grub_net_application_layer_protocol *app_prot; - struct grub_net_transport_layer_protocol *trans_prot; -}; - -struct grub_net_transport_network_interface -{ - struct grub_net_network_link_interface *inner_layer; - void *data; - struct grub_net_transport_layer_protocol *trans_prot; - struct grub_net_network_layer_protocol *net_prot; -}; - -struct grub_net_network_link_interface -{ - void *data; - struct grub_net_network_layer_protocol *net_prot; - struct grub_net_link_layer_protocol *link_prot; -}; - - -struct grub_net_protocol_stack *grub_net_protocol_stacks; -static inline void -grub_net_stack_register (struct grub_net_protocol_stack *stack) -{ - - grub_list_push (GRUB_AS_LIST_P (&grub_net_protocol_stacks), - GRUB_AS_LIST (stack)); -} -/* -void grub_net_stack_unregister (struct grub_net_protocol_stack *stack) -{ - grub_list_remove (GRUB_AS_LIST_P (&grub_net_protocol_stacks), - GRUB_AS_LIST (stack)); -}*/ - -struct grub_net_protocol_stack *grub_net_protocol_stack_get (char *name); - -/* -static inline void -grub_net_interface_application_transport_register (struct grub_net_application_transport_interface); -static inline void -grub_net_interface_application_transport_unregister (struct grub_net_application_transport_interface); -static inline void -grub_net_interface_transport_network_register (struct grub_net_transport_network_interface); -static inline void -grub_net_interface_transport_network_unregister (struct grub_net_transport_network_interface); -static inline void -grub_net_interface_network_link_register (struct grub_net_network_link_interface); -static inline void -grub_net_interface_network_link_unregister (struct grub_net_network_link_interface);*/ -#endif diff --git a/include/grub/net/protocol.h b/include/grub/net/protocol.h deleted file mode 100644 index da54b073f..000000000 --- a/include/grub/net/protocol.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GRUB_PROTOCOL_HEADER -#define GRUB_PROTOCOL_HEADER -#include -#include -#include -#include -#include - -#endif diff --git a/include/grub/net/type_net.h b/include/grub/net/type_net.h deleted file mode 100644 index f159b1de0..000000000 --- a/include/grub/net/type_net.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef GRUB_TYPES_NET_HEADER -#define GRUB_TYPES_NET_HEADER 1 -#include - - -#define UDP_PCKT 0x11 -#define IP_PCKT 0x0800 -#define TIMEOUT_TIME_MS 3*1000 -typedef enum -{ - GRUB_NET_TFTP_ID, - GRUB_NET_UDP_ID, - GRUB_NET_IPV4_ID, - GRUB_NET_IPV6_ID, - GRUB_NET_ETHERNET_ID, - GRUB_NET_ARP_ID, - GRUB_NET_DHCP_ID -}grub_net_protocol_id_t; - - -typedef union grub_net_network_layer_netaddress -{ - grub_uint32_t ipv4; -} grub_net_network_layer_address_t; - -typedef union grub_net_network_layer_address -{ - struct { - grub_uint32_t base; - int masksize; - } ipv4; -} grub_net_network_layer_netaddress_t; -#endif