From 22f6e99d5b0c54758646334c1153737a5585bd57 Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Wed, 23 May 2012 07:59:14 +0000 Subject: net: Refactor to protect access to the NetState variable Changes to NetState now go through an accessor function called net_set_state() Signed-off-by: Joe Hershberger --- include/net.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/net.h b/include/net.h index 3214830831..8dd407e6cf 100644 --- a/include/net.h +++ b/include/net.h @@ -391,12 +391,6 @@ extern uchar NetEtherNullAddr[6]; extern ushort NetOurVLAN; /* Our VLAN */ extern ushort NetOurNativeVLAN; /* Our Native VLAN */ -extern int NetState; /* Network loop state */ -#define NETLOOP_CONTINUE 1 -#define NETLOOP_RESTART 2 -#define NETLOOP_SUCCESS 3 -#define NETLOOP_FAIL 4 - extern int NetRestartWrap; /* Tried all network devices */ enum proto_t { @@ -471,6 +465,20 @@ extern void NetSetHandler(rxhand_f *); /* Set RX packet handler */ extern void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */ extern void NetSetTimeout(ulong, thand_f *);/* Set timeout handler */ +/* Network loop state */ +enum net_loop_state { + NETLOOP_CONTINUE, + NETLOOP_RESTART, + NETLOOP_SUCCESS, + NETLOOP_FAIL +}; +static inline void net_set_state(enum net_loop_state state) +{ + extern enum net_loop_state net_state; + + net_state = state; +} + /* Transmit "NetTxPacket" */ static inline void NetSendPacket(uchar *pkt, int len) { -- cgit v1.2.1