net/tftp.c: cosmetic: fix lines over 80 characters

Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it>
Cc: Wolfgang Denk <wd@denx.de>
This commit is contained in:
Luca Ceresoli 2011-05-14 05:49:56 +00:00 committed by Wolfgang Denk
parent b0e51ebca2
commit 2f09413fd9

View file

@ -1,7 +1,7 @@
/* /*
* Copyright 1994, 1995, 2000 Neil Russell. * Copyright 1994, 1995, 2000 Neil Russell.
* (See License) * (See License)
* Copyright 2000, 2001 DENX Software Engineering, Wolfgang Denk, wd@denx.de * Copyright 2000, 2001 DENX Software Engineering, Wolfgang Denk, wd@denx.de
*/ */
#include <common.h> #include <common.h>
@ -10,15 +10,18 @@
#include "tftp.h" #include "tftp.h"
#include "bootp.h" #include "bootp.h"
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ /* Well known TFTP port # */
#define TIMEOUT 5000UL /* Millisecs to timeout for lost pkt */ #define WELL_KNOWN_PORT 69
/* Millisecs to timeout for lost pkt */
#define TIMEOUT 5000UL
#ifndef CONFIG_NET_RETRY_COUNT #ifndef CONFIG_NET_RETRY_COUNT
# define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ /* # of timeouts before giving up */
# define TIMEOUT_COUNT 10
#else #else
# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2) # define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2)
#endif #endif
/* (for checking the image size) */ /* Number of "loading" hashes per line (for checking the image size) */
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ #define HASHES_PER_LINE 65
/* /*
* TFTP operations. * TFTP operations.
@ -56,17 +59,25 @@ enum {
}; };
static IPaddr_t TftpServerIP; static IPaddr_t TftpServerIP;
static int TftpServerPort; /* The UDP port at their end */ /* The UDP port at their end */
static int TftpOurPort; /* The UDP port at our end */ static int TftpServerPort;
/* The UDP port at our end */
static int TftpOurPort;
static int TftpTimeoutCount; static int TftpTimeoutCount;
static ulong TftpBlock; /* packet sequence number */ /* packet sequence number */
static ulong TftpLastBlock; /* last packet sequence number received */ static ulong TftpBlock;
static ulong TftpBlockWrap; /* count of sequence number wraparounds */ /* last packet sequence number received */
static ulong TftpBlockWrapOffset; /* memory offset due to wrapping */ static ulong TftpLastBlock;
/* count of sequence number wraparounds */
static ulong TftpBlockWrap;
/* memory offset due to wrapping */
static ulong TftpBlockWrapOffset;
static int TftpState; static int TftpState;
#ifdef CONFIG_TFTP_TSIZE #ifdef CONFIG_TFTP_TSIZE
static int TftpTsize; /* The file size reported by the server */ /* The file size reported by the server */
static short TftpNumchars; /* The number of hashes we printed */ static int TftpTsize;
/* The number of hashes we printed */
static short TftpNumchars;
#endif #endif
#define STATE_RRQ 1 #define STATE_RRQ 1
@ -75,8 +86,10 @@ static short TftpNumchars; /* The number of hashes we printed */
#define STATE_BAD_MAGIC 4 #define STATE_BAD_MAGIC 4
#define STATE_OACK 5 #define STATE_OACK 5
#define TFTP_BLOCK_SIZE 512 /* default TFTP block size */ /* default TFTP block size */
#define TFTP_SEQUENCE_SIZE ((ulong)(1<<16)) /* sequence number is 16 bit */ #define TFTP_BLOCK_SIZE 512
/* sequence number is 16 bit */
#define TFTP_SEQUENCE_SIZE ((ulong)(1<<16))
#define DEFAULT_NAME_LEN (8 + 4 + 1) #define DEFAULT_NAME_LEN (8 + 4 + 1)
static char default_filename[DEFAULT_NAME_LEN]; static char default_filename[DEFAULT_NAME_LEN];
@ -273,7 +286,8 @@ TftpSend (void)
break; break;
} }
NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, TftpOurPort, len); NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort,
TftpOurPort, len);
} }
@ -333,7 +347,8 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
} }
#ifdef CONFIG_TFTP_TSIZE #ifdef CONFIG_TFTP_TSIZE
if (strcmp ((char*)pkt+i,"tsize") == 0) { if (strcmp ((char*)pkt+i,"tsize") == 0) {
TftpTsize = simple_strtoul((char*)pkt+i+6,NULL,10); TftpTsize = simple_strtoul((char*)pkt+i+6,
NULL, 10);
debug("size = %s, %d\n", debug("size = %s, %d\n",
(char*)pkt+i+6, TftpTsize); (char*)pkt+i+6, TftpTsize);
} }
@ -361,12 +376,15 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
*/ */
if (TftpBlock == 0) { if (TftpBlock == 0) {
TftpBlockWrap++; TftpBlockWrap++;
TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE; TftpBlockWrapOffset +=
printf ("\n\t %lu MB received\n\t ", TftpBlockWrapOffset>>20); TftpBlkSize * TFTP_SEQUENCE_SIZE;
printf ("\n\t %lu MB received\n\t ",
TftpBlockWrapOffset>>20);
} }
#ifdef CONFIG_TFTP_TSIZE #ifdef CONFIG_TFTP_TSIZE
else if (TftpTsize) { else if (TftpTsize) {
while (TftpNumchars < NetBootFileXferSize * 50 / TftpTsize) { while (TftpNumchars <
NetBootFileXferSize * 50 / TftpTsize) {
putc('#'); putc('#');
TftpNumchars++; TftpNumchars++;
} }
@ -466,7 +484,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
* run it. * run it.
*/ */
#ifdef CONFIG_TFTP_TSIZE #ifdef CONFIG_TFTP_TSIZE
/* Print out the hash marks for the last packet received */ /* Print hash marks for the last packet received */
while (TftpTsize && TftpNumchars < 49) { while (TftpTsize && TftpNumchars < 49) {
putc('#'); putc('#');
TftpNumchars++; TftpNumchars++;