Make a thorough pass through all variables and function names contained
within tftp and remove CamelCase and improve naming.
Signed-off-by: Joe Hershberger
---
Changes in v2: None
common/update.c | 16 +-
net/net.c | 6 +-
net/tftp.c | 483
net/tftp.h | 8 +-
4 files changed, 259 insertions(+), 254 deletions(-)
diff --git a/common/update.c b/common/update.c
index bc0c48f..1bf2f82 100644
--- a/common/update.c
+++ b/common/update.c
@@ -39,8 +39,8 @@
#define CONFIG_UPDATE_TFTP_CNT_MAX 0
#endif
-extern ulong TftpRRQTimeoutMSecs;
-extern int TftpRRQTimeoutCountMax;
+extern ulong tftp_timeout_ms;
+extern int tftp_timeout_count_max;
extern flash_info_t flash_info[];
extern ulong load_addr;
@@ -55,14 +55,14 @@ static int update_load(char *filename, ulong msec_max, int
cnt_max, ulong addr)
rv = 0;
/* save used globals and env variable */
- saved_timeout_msecs = TftpRRQTimeoutMSecs;
- saved_timeout_count = TftpRRQTimeoutCountMax;
+ saved_timeout_msecs = tftp_timeout_ms;
+ saved_timeout_count = tftp_timeout_count_max;
saved_netretry = strdup(getenv("netretry"));
saved_bootfile = strdup(net_boot_file_name);
/* set timeouts for auto-update */
- TftpRRQTimeoutMSecs = msec_max;
- TftpRRQTimeoutCountMax = cnt_max;
+ tftp_timeout_ms = msec_max;
+ tftp_timeout_count_max = cnt_max;
/* we don't want to retry the connection if errors occur */
setenv("netretry", "no");
@@ -78,8 +78,8 @@ static int update_load(char *filename, ulong msec_max, int
cnt_max, ulong addr)
flush_cache(addr, size);
/* restore changed globals and env variable */
- TftpRRQTimeoutMSecs = saved_timeout_msecs;
- TftpRRQTimeoutCountMax = saved_timeout_count;
+ tftp_timeout_ms = saved_timeout_msecs;
+ tftp_timeout_count_max = saved_timeout_count;
setenv("netretry", saved_netretry);
if (saved_netretry != NULL)
diff --git a/net/net.c b/net/net.c
index 5898260..b8acbb4 100644
--- a/net/net.c
+++ b/net/net.c
@@ -247,7 +247,7 @@ void net_auto_load(void)
net_set_state(NETLOOP_SUCCESS);
return;
}
- TftpStart(TFTPGET);
+ tftp_start(TFTPGET);
}
static void NetInitLoop(void)
@@ -372,11 +372,11 @@ restart:
case TFTPPUT:
#endif
/* always use ARP to get server ethernet address */
- TftpStart(protocol);
+ tftp_start(protocol);
break;
#ifdef CONFIG_CMD_TFTPSRV
case TFTPSRV:
- TftpStartServer();
+ tftp_start_server();
break;
#endif
#if defined(CONFIG_CMD_DHCP)
diff --git a/net/tftp.c b/net/tftp.c
index f25abaa..14acf04 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -39,21 +39,21 @@
#define TFTP_ERROR 5
#define TFTP_OACK 6
-static ulong TftpTimeoutMSecs = TIMEOUT;
-static int TftpTimeoutCountMax = TIMEOUT_COUNT;
+static ulong timeout_ms = TIMEOUT;
+static int timeout_count_max = TIMEOUT_COUNT;
static ulong time_start; /* Record time we started tftp */
/*
* These globals govern the timeout behavior when attempting a connection to a
- * TFTP server. TftpRRQTimeoutMSecs specifies the number of milliseconds to
+ * TFTP server. tftp_timeout_ms specifies the number of milliseconds to
* wait for the server to respond to initial connection. Second global,
- * TftpRRQTimeoutCountMax, gives the number of such connection retries.
- * TftpRRQTimeoutCountMax must be non-negative and TftpRRQTimeoutMSecs must be
+ * tftp_timeout_count_max, gives the number of such connection retries.
+ * tftp_timeout_count_max must be non-negative and tftp_timeout_ms must be
* positive. The globals are meant to be set (and restored) by code needing
* non-standard timeout behavior when initiating a TFTP transfer.
*/
-ulong TftpRRQTimeoutMSecs = TIMEOUT;
-int TftpRRQTimeoutCountMax = TIMEOUT_COUNT;
+ulong tftp_timeout_ms = TIMEOUT;
+int tftp_timeout_count_max = TIMEOUT_COUNT;
enum {
TFTP_ERR_UNDEFINED = 0,
@@ -67,30 +67,32 @@ enum {
static struct in_addr tftp_remote_ip;
/* The UDP port at their end */
-static int TftpRemotePort;
+static int tftp_remote_port;
/* The UDP port at our end */
-static int TftpOurPort;
-static int TftpTimeoutCount;
+static int tftp_our_port;
+static int timeout_count;
/* packet sequence number */
-static ulong TftpBlock;
+static ulong tftp_cur_block;
/* last packet sequence number received */
-static ulong TftpLastBlock;
+static ulong tftp_prev_block;
/* count of sequence number wraparounds */
-static ulong TftpBlockWrap;
+static ulong tftp_block_wrap;
/* memory offset due to wrapping */
-static ulong TftpBlockWrapOffset;
-static int TftpState;
+static ulong tftp_bloc