From patchwork Tue May 17 10:03:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 95896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A1E53B6EEC for ; Tue, 17 May 2011 20:04:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A40E280FC; Tue, 17 May 2011 12:04:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3orwpzqEOGsv; Tue, 17 May 2011 12:04:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1C116280E8; Tue, 17 May 2011 12:04:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3890B280E1 for ; Tue, 17 May 2011 12:04:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NuSFyKToaEIN for ; Tue, 17 May 2011 12:04:17 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from relayer.comelit.it (mail.comelit.it [217.56.59.218]) by theia.denx.de (Postfix) with ESMTP id B6C8F280C5 for ; Tue, 17 May 2011 12:04:17 +0200 (CEST) Received: from com-exc-01.comelit.it ([172.24.0.31]) by relayer.comelit.it with Microsoft SMTPSVC(6.0.3790.1830); Tue, 17 May 2011 12:02:15 +0200 Received: from wallace.comelit.it ([172.20.0.35]) by com-exc-01.comelit.it with Microsoft SMTPSVC(6.0.3790.4675); Tue, 17 May 2011 12:04:16 +0200 From: Luca Ceresoli To: u-boot@lists.denx.de Date: Tue, 17 May 2011 12:03:37 +0200 Message-Id: <1305626621-15008-2-git-send-email-luca.ceresoli@comelit.it> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1303143594-5345-1-git-send-email-luca.ceresoli@comelit.it> References: <1303143594-5345-1-git-send-email-luca.ceresoli@comelit.it> X-OriginalArrivalTime: 17 May 2011 10:04:16.0605 (UTC) FILETIME=[C801A0D0:01CC1479] X-TM-AS-Product-Ver: SMEX-8.6.0.1168-6.500.1024-18140.005 X-TM-AS-Result: No--10.568100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Luca Ceresoli Subject: [U-Boot] [PATCH v3 1/5] TFTP: replace "server" with "remote" in local variable names X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Wolfgang Denk Acked-by: Detlev Zundel --- Changes in v2: - fixed checkpatch issues. Changes in v3: - rebased on top of the net/tftp.c cleanup; - renamed also local variable ServerNet to RemoteNet in TftpStart(); - clarified commit message. net/tftp.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/net/tftp.c b/net/tftp.c index 0f74e6b..b9d0f3b 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -58,9 +58,9 @@ enum { TFTP_ERR_FILE_ALREADY_EXISTS = 6, }; -static IPaddr_t TftpServerIP; +static IPaddr_t TftpRemoteIP; /* The UDP port at their end */ -static int TftpServerPort; +static int TftpRemotePort; /* The UDP port at our end */ static int TftpOurPort; static int TftpTimeoutCount; @@ -289,7 +289,7 @@ TftpSend(void) break; } - NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, + NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort, TftpOurPort, len); } @@ -309,7 +309,7 @@ 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) @@ -333,7 +333,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 @@ -405,7 +405,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; @@ -440,7 +440,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 @@ -569,7 +569,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, @@ -589,7 +589,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; } @@ -599,14 +599,14 @@ 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 RemoteNet = TftpRemoteIP & NetOurSubnetMask; - if (OurNet != ServerNet) + if (OurNet != RemoteNet) printf("; sending through gateway %pI4", &NetOurGatewayIP); } @@ -630,7 +630,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 */ @@ -639,7 +639,7 @@ TftpStart(void) #ifdef CONFIG_TFTP_PORT ep = getenv("tftpdstp"); if (ep != NULL) - TftpServerPort = simple_strtol(ep, NULL, 10); + TftpRemotePort = simple_strtol(ep, NULL, 10); ep = getenv("tftpsrcp"); if (ep != NULL) TftpOurPort = simple_strtol(ep, NULL, 10);