From patchwork Mon Apr 18 16:19:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 91799 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 B0E87B6FDF for ; Tue, 19 Apr 2011 02:21:07 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1003528296; Mon, 18 Apr 2011 18:20:48 +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 jRc0ABBn0vHz; Mon, 18 Apr 2011 18:20:47 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AF6EB28276; Mon, 18 Apr 2011 18:20:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD19B2824D for ; Mon, 18 Apr 2011 18:20:19 +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 zb--qa5VBbi1 for ; Mon, 18 Apr 2011 18:20:18 +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 com-exc-01.comelit.it (mail.comelit.it [217.56.59.218]) by theia.denx.de (Postfix) with ESMTP id 3A45828249 for ; Mon, 18 Apr 2011 18:20:16 +0200 (CEST) Received: from wallace.comelit.it ([172.20.0.53]) by com-exc-01.comelit.it with Microsoft SMTPSVC(6.0.3790.4675); Mon, 18 Apr 2011 18:20:15 +0200 From: Luca Ceresoli To: u-boot@lists.denx.de Date: Mon, 18 Apr 2011 18:19:51 +0200 Message-Id: <1303143594-5345-4-git-send-email-luca.ceresoli@comelit.it> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1302796377-3321-1-git-send-email-luca.ceresoli@comelit.it> References: <1302796377-3321-1-git-send-email-luca.ceresoli@comelit.it> X-OriginalArrivalTime: 18 Apr 2011 16:20:16.0021 (UTC) FILETIME=[807C9450:01CBFDE4] X-TM-AS-Product-Ver: SMEX-8.6.0.1168-6.500.1024-18080.006 X-TM-AS-Result: No--13.818200-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Luca Ceresoli Subject: [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" 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. 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);