[U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote"

Luca Ceresoli luca.ceresoli at comelit.it
Mon Apr 18 18:19:51 CEST 2011


With the upcoming TFTP server implementation, the remote node can be
either a client or a server, so avoid ambiguities.

Signed-off-by: Luca Ceresoli <luca.ceresoli at comelit.it>
Cc: Wolfgang Denk <wd at denx.de>
---
Changes in v2:
 - fixed checkpatch issues.

 net/tftp.c |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index 00abec3..da545c6 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -55,18 +55,18 @@ enum {
 	TFTP_ERR_FILE_ALREADY_EXISTS = 6,
 };
 
-static IPaddr_t TftpServerIP;
-static int	TftpServerPort;		/* The UDP port at their end		*/
-static int	TftpOurPort;		/* The UDP port at our end		*/
+static IPaddr_t TftpRemoteIP;
+static int	TftpRemotePort;	/* The UDP port at their end		*/
+static int	TftpOurPort;	/* The UDP port at our end		*/
 static int	TftpTimeoutCount;
-static ulong	TftpBlock;		/* packet sequence number		*/
-static ulong	TftpLastBlock;		/* last packet sequence number received */
-static ulong	TftpBlockWrap;		/* count of sequence number wraparounds */
-static ulong	TftpBlockWrapOffset;	/* memory offset due to wrapping	*/
+static ulong	TftpBlock;	/* packet sequence number		*/
+static ulong	TftpLastBlock;	/* last packet sequence number received */
+static ulong	TftpBlockWrap;	/* count of sequence number wraparounds */
+static ulong	TftpBlockWrapOffset; /* memory offset due to wrapping	*/
 static int	TftpState;
 #ifdef CONFIG_TFTP_TSIZE
-static int	TftpTsize;		/* The file size reported by the server */
-static short	TftpNumchars;		/* The number of hashes we printed      */
+static int	TftpTsize;	/* The file size reported by the server */
+static short	TftpNumchars;	/* The number of hashes we printed      */
 #endif
 
 #define STATE_RRQ	1
@@ -273,7 +273,8 @@ TftpSend (void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, TftpOurPort, len);
+	NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
+			 TftpOurPort, len);
 }
 
 
@@ -292,9 +293,8 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 #endif
 		return;
 	}
-	if (TftpState != STATE_RRQ && src != TftpServerPort) {
+	if (TftpState != STATE_RRQ && src != TftpRemotePort)
 		return;
-	}
 
 	if (len < 2) {
 		return;
@@ -318,7 +318,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			pkt,
 			pkt + strlen((char *)pkt) + 1);
 		TftpState = STATE_OACK;
-		TftpServerPort = src;
+		TftpRemotePort = src;
 		/*
 		 * Check for 'blksize' option.
 		 * Careful: "i" is signed, "len" is unsigned, thus
@@ -386,7 +386,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 		if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
 			/* first block received */
 			TftpState = STATE_DATA;
-			TftpServerPort = src;
+			TftpRemotePort = src;
 			TftpLastBlock = 0;
 			TftpBlockWrap = 0;
 			TftpBlockWrapOffset = 0;
@@ -421,7 +421,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 
 		/*
 		 *	Acknoledge the block just received, which will prompt
-		 *	the server for the next one.
+		 *	the remote for the next one.
 		 */
 #ifdef CONFIG_MCAST_TFTP
 		/* if I am the MasterClient, actively calculate what my next
@@ -548,7 +548,7 @@ TftpStart (void)
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
-	TftpServerIP = NetServerIP;
+	TftpRemoteIP = NetServerIP;
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
 			NetOurIP & 0xFF,
@@ -568,7 +568,7 @@ TftpStart (void)
 			strncpy(tftp_filename, BootFile, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			TftpServerIP = string_to_ip (BootFile);
+			TftpRemoteIP = string_to_ip(BootFile);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -578,12 +578,12 @@ TftpStart (void)
 	printf ("Using %s device\n", eth_get_name());
 #endif
 	printf("TFTP from server %pI4"
-		"; our IP address is %pI4", &TftpServerIP, &NetOurIP);
+		"; our IP address is %pI4", &TftpRemoteIP, &NetOurIP);
 
 	/* Check if we need to send across this subnet */
 	if (NetOurGatewayIP && NetOurSubnetMask) {
 	    IPaddr_t OurNet	= NetOurIP    & NetOurSubnetMask;
-	    IPaddr_t ServerNet	= TftpServerIP & NetOurSubnetMask;
+	    IPaddr_t ServerNet	= TftpRemoteIP & NetOurSubnetMask;
 
 	    if (OurNet != ServerNet)
 		printf("; sending through gateway %pI4", &NetOurGatewayIP);
@@ -608,7 +608,7 @@ TftpStart (void)
 	NetSetTimeout (TftpTimeoutMSecs, TftpTimeout);
 	NetSetHandler (TftpHandler);
 
-	TftpServerPort = WELL_KNOWN_PORT;
+	TftpRemotePort = WELL_KNOWN_PORT;
 	TftpTimeoutCount = 0;
 	TftpState = STATE_RRQ;
 	/* Use a pseudo-random port unless a specific port is set */
@@ -616,7 +616,7 @@ TftpStart (void)
 
 #ifdef CONFIG_TFTP_PORT
 	if ((ep = getenv("tftpdstp")) != NULL) {
-		TftpServerPort = simple_strtol(ep, NULL, 10);
+		TftpRemotePort = simple_strtol(ep, NULL, 10);
 	}
 	if ((ep = getenv("tftpsrcp")) != NULL) {
 		TftpOurPort= simple_strtol(ep, NULL, 10);
-- 
1.7.1



More information about the U-Boot mailing list