From patchwork Sat Oct 22 04:51:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 121140 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 935FC1007D3 for ; Sat, 22 Oct 2011 15:53:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 156A229764; Sat, 22 Oct 2011 06:53:01 +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 DojLL52+5Ade; Sat, 22 Oct 2011 06:53:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A2ADA29765; Sat, 22 Oct 2011 06:52:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E281329582 for ; Sat, 22 Oct 2011 06:52: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 YIlZXAS4WsMr for ; Sat, 22 Oct 2011 06:52: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 smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by theia.denx.de (Postfix) with ESMTPS id C3961294E7 for ; Sat, 22 Oct 2011 06:52:17 +0200 (CEST) Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p9M4qEEa003339; Fri, 21 Oct 2011 21:52:14 -0700 Received: from glucid-laptop-imager.hot.corp.google.com ([172.19.240.38]) by wpaz21.hot.corp.google.com with ESMTP id p9M4qDrJ016154; Fri, 21 Oct 2011 21:52:13 -0700 Received: by glucid-laptop-imager.hot.corp.google.com (Postfix, from userid 121222) id 64C3C34E696; Fri, 21 Oct 2011 21:52:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 21 Oct 2011 21:51:35 -0700 Message-Id: <1319259100-11376-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1319259100-11376-1-git-send-email-sjg@chromium.org> References: <1319259100-11376-1-git-send-email-sjg@chromium.org> X-System-Of-Record: true Subject: [U-Boot] [PATCH 3/8] tftpput: Rename TFTP to TFTPGET 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 This is a better name for this protocol. Also remove the typedef to keep checkpatch happy, and move zeroing of NetBootFileXferSize a little earlier since TFTPPUT will need to change this. Signed-off-by: Simon Glass --- common/cmd_net.c | 8 ++++---- include/net.h | 8 +++++--- net/net.c | 18 ++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/cmd_net.c b/common/cmd_net.c index 872f4a6..f610385 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -28,7 +28,7 @@ #include #include -static int netboot_common (proto_t, cmd_tbl_t *, int , char * const []); +static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []); int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { @@ -43,7 +43,7 @@ U_BOOT_CMD( int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - return netboot_common (TFTP, cmdtp, argc, argv); + return netboot_common(TFTPGET, cmdtp, argc, argv); } U_BOOT_CMD( @@ -167,8 +167,8 @@ static void netboot_update_env (void) #endif } -static int -netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[]) +static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, + char * const argv[]) { char *s; char *end; diff --git a/include/net.h b/include/net.h index d5d37b6..3dfe073 100644 --- a/include/net.h +++ b/include/net.h @@ -347,8 +347,10 @@ extern int NetState; /* Network loop state */ extern int NetRestartWrap; /* Tried all network devices */ -typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV } proto_t; +enum { + BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, + TFTPSRV +}; /* from net/net.c */ extern char BootFile[128]; /* Boot File name */ @@ -374,7 +376,7 @@ extern int NetTimeOffset; /* offset time from UTC */ #endif /* Initialize the network adapter */ -extern int NetLoop(proto_t); +extern int NetLoop(enum proto_t); /* Shutdown adapters and cleanup */ extern void NetStop(void); diff --git a/net/net.c b/net/net.c index 5e67886..ce07ed6 100644 --- a/net/net.c +++ b/net/net.c @@ -224,7 +224,7 @@ static ulong timeDelta; /* THE transmit packet */ volatile uchar *NetTxPacket; -static int net_check_prereq(proto_t protocol); +static int net_check_prereq(enum proto_t protocol); static int NetTryCount; @@ -310,8 +310,7 @@ void ArpTimeoutCheck(void) } } -static void -NetInitLoop(proto_t protocol) +static void NetInitLoop(enum proto_t protocol) { static int env_changed_id; bd_t *bd = gd->bd; @@ -340,8 +339,7 @@ NetInitLoop(proto_t protocol) * Main network processing loop. */ -int -NetLoop(proto_t protocol) +int NetLoop(enum proto_t protocol) { bd_t *bd = gd->bd; @@ -405,10 +403,11 @@ restart: case 0: NetDevExists = 1; + NetBootFileXferSize = 0; switch (protocol) { - case TFTP: + case TFTPGET: /* always use ARP to get server ethernet address */ - TftpStart(); + TftpStart(protocol); break; #ifdef CONFIG_CMD_TFTPSRV case TFTPSRV: @@ -470,7 +469,6 @@ restart: break; } - NetBootFileXferSize = 0; break; } @@ -1728,7 +1726,7 @@ NetReceive(volatile uchar *inpkt, int len) /**********************************************************************/ -static int net_check_prereq(proto_t protocol) +static int net_check_prereq(enum proto_t protocol) { switch (protocol) { /* Fall through */ @@ -1759,7 +1757,7 @@ static int net_check_prereq(proto_t protocol) #if defined(CONFIG_CMD_NFS) case NFS: #endif - case TFTP: + case TFTPGET: if (NetServerIP == 0) { puts("*** ERROR: `serverip' not set\n"); return 1;