net: cosmetic: tftp.* checkpatch compliance
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
6c3234a343
commit
13dfe94379
|
@ -396,6 +396,10 @@ extern IPaddr_t NetNtpServerIP; /* the ip address to NTP */
|
||||||
extern int NetTimeOffset; /* offset time from UTC */
|
extern int NetTimeOffset; /* offset time from UTC */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_MCAST_TFTP)
|
||||||
|
extern IPaddr_t Mcast_addr;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the network adapter */
|
/* Initialize the network adapter */
|
||||||
extern int NetLoop(enum proto_t);
|
extern int NetLoop(enum proto_t);
|
||||||
|
|
||||||
|
|
30
net/tftp.c
30
net/tftp.c
|
@ -11,6 +11,9 @@
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include "tftp.h"
|
#include "tftp.h"
|
||||||
#include "bootp.h"
|
#include "bootp.h"
|
||||||
|
#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
|
||||||
|
#include <flash.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Well known TFTP port # */
|
/* Well known TFTP port # */
|
||||||
#define WELL_KNOWN_PORT 69
|
#define WELL_KNOWN_PORT 69
|
||||||
|
@ -112,10 +115,6 @@ static char default_filename[DEFAULT_NAME_LEN];
|
||||||
|
|
||||||
static char tftp_filename[MAX_LEN];
|
static char tftp_filename[MAX_LEN];
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
|
|
||||||
extern flash_info_t flash_info[];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 512 is poor choice for ethernet, MTU is typically 1500.
|
/* 512 is poor choice for ethernet, MTU is typically 1500.
|
||||||
* Minus eth.hdrs thats 1468. Can get 2x better throughput with
|
* Minus eth.hdrs thats 1468. Can get 2x better throughput with
|
||||||
* almost-MTU block sizes. At least try... fall back to 512 if need be.
|
* almost-MTU block sizes. At least try... fall back to 512 if need be.
|
||||||
|
@ -137,7 +136,6 @@ static unsigned *Bitmap;
|
||||||
static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
|
static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
|
||||||
static uchar ProhibitMcast, MasterClient;
|
static uchar ProhibitMcast, MasterClient;
|
||||||
static uchar Multicast;
|
static uchar Multicast;
|
||||||
extern IPaddr_t Mcast_addr;
|
|
||||||
static int Mcast_port;
|
static int Mcast_port;
|
||||||
static ulong TftpEndingBlock; /* can get 'last' block before done..*/
|
static ulong TftpEndingBlock; /* can get 'last' block before done..*/
|
||||||
|
|
||||||
|
@ -157,7 +155,7 @@ mcast_cleanup(void)
|
||||||
|
|
||||||
#endif /* CONFIG_MCAST_TFTP */
|
#endif /* CONFIG_MCAST_TFTP */
|
||||||
|
|
||||||
static __inline__ void
|
static inline void
|
||||||
store_block(unsigned block, uchar *src, unsigned len)
|
store_block(unsigned block, uchar *src, unsigned len)
|
||||||
{
|
{
|
||||||
ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
|
ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
|
||||||
|
@ -182,8 +180,7 @@ store_block(unsigned block, uchar *src, unsigned len)
|
||||||
NetState = NETLOOP_FAIL;
|
NetState = NETLOOP_FAIL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
#endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
|
#endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
|
||||||
{
|
{
|
||||||
(void)memcpy((void *)(load_addr + offset), src, len);
|
(void)memcpy((void *)(load_addr + offset), src, len);
|
||||||
|
@ -357,12 +354,14 @@ TftpSend(void)
|
||||||
0, TftpBlkSizeOption, 0);
|
0, TftpBlkSizeOption, 0);
|
||||||
#ifdef CONFIG_MCAST_TFTP
|
#ifdef CONFIG_MCAST_TFTP
|
||||||
/* Check all preconditions before even trying the option */
|
/* Check all preconditions before even trying the option */
|
||||||
if (!ProhibitMcast
|
if (!ProhibitMcast) {
|
||||||
&& (Bitmap = malloc(Mapsize))
|
Bitmap = malloc(Mapsize);
|
||||||
&& eth_get_dev()->mcast) {
|
if (Bitmap && eth_get_dev()->mcast) {
|
||||||
free(Bitmap);
|
free(Bitmap);
|
||||||
Bitmap = NULL;
|
Bitmap = NULL;
|
||||||
pkt += sprintf((char *)pkt, "multicast%c%c", 0, 0);
|
pkt += sprintf((char *)pkt, "multicast%c%c",
|
||||||
|
0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MCAST_TFTP */
|
#endif /* CONFIG_MCAST_TFTP */
|
||||||
len = pkt - xp;
|
len = pkt - xp;
|
||||||
|
@ -630,8 +629,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
|
||||||
mcast_cleanup();
|
mcast_cleanup();
|
||||||
NetState = NETLOOP_SUCCESS;
|
NetState = NETLOOP_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
if (len < TftpBlkSize)
|
if (len < TftpBlkSize)
|
||||||
tftp_complete();
|
tftp_complete();
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
void TftpStart(enum proto_t protocol); /* Begin TFTP get/put */
|
void TftpStart(enum proto_t protocol); /* Begin TFTP get/put */
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_TFTPSRV
|
#ifdef CONFIG_CMD_TFTPSRV
|
||||||
extern void TftpStartServer(void); /* Wait for incoming TFTP put */
|
extern void TftpStartServer(void); /* Wait for incoming TFTP put */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue