diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 4 | ||||
-rw-r--r-- | net/nfs.c | 16 | ||||
-rw-r--r-- | net/ping.c | 8 | ||||
-rw-r--r-- | net/tftp.c | 13 |
4 files changed, 18 insertions, 23 deletions
@@ -432,7 +432,7 @@ restart: * Check the ethernet for a new packet. The ethernet * receive routine will process it. */ - eth_rx(); + eth_rx(); /* * Abort if ctrl-c was pressed. @@ -685,7 +685,7 @@ NetReceive(uchar * inpkt, int len) * We have to deal with two types of ARP packets: * - REQUEST packets will be answered by sending our * IP address - if we know it. - * - REPLY packates are expected only after we asked + * - REPLY packets are expected only after we asked * for the TFTP server's or the gateway's ethernet * address; so if we receive such a packet, we set * the server ethernet address @@ -28,6 +28,7 @@ #include <net.h> #include <malloc.h> #include <libgen.h> +#include <fs.h> #include "nfs.h" #include "bootp.h" @@ -64,15 +65,21 @@ static char *nfs_filename; static char *nfs_path; static char nfs_path_buff[2048]; +extern int net_store_fd; + static __inline__ int store_block (uchar * src, unsigned offset, unsigned len) { ulong newsize = offset + len; + int ret; - memcpy ((void *)(load_addr + offset), src, len); + ret = write(net_store_fd, src, len); + if (ret < 0) + return ret; if (NetBootFileXferSize < (offset+len)) NetBootFileXferSize = newsize; + return 0; } @@ -523,7 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len) puts ("\n\t "); } if (!(nfs_offset % ((NFS_READ_SIZE/2)*10))) { - putc ('#'); + putchar ('#'); } rlen = ntohl(rpc_pkt.u.reply.data[18]); @@ -707,12 +714,9 @@ NfsStart (void) if (NetBootFileSize) printf (" Size is 0x%x Bytes = %s", - NetBootFileSize<<9); + NetBootFileSize<<9, size_human_readable (NetBootFileSize<<9)); - printf ("\nLoad address: 0x%lx\n" - "Loading: *\b", load_addr); - NetSetTimeout (NFS_TIMEOUT * SECOND, NfsTimeout); NetSetHandler (NfsHandler); diff --git a/net/ping.c b/net/ping.c index c4f83d55a6..4d61532b1e 100644 --- a/net/ping.c +++ b/net/ping.c @@ -5,11 +5,11 @@ static ushort PingSeqNo; -int PingSend(void) +static int PingSend(void) { static uchar mac[6]; - volatile IP_t *ip; - volatile ushort *s; + IP_t *ip; + ushort *s; uchar *pkt; /* XXX always send arp request */ @@ -26,7 +26,7 @@ int PingSend(void) pkt = NetArpWaitTxPacket; pkt += NetSetEther(pkt, mac, PROT_IP); - ip = (volatile IP_t *)pkt; + ip = (IP_t *)pkt; /* * Construct an IP and ICMP header. (need to set no fragment bit - XXX) diff --git a/net/tftp.c b/net/tftp.c index c0b29df3bb..bff32c153e 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -103,17 +103,8 @@ TftpSend (void) s = (ushort *)pkt; *s++ = htons(TFTP_RRQ); pkt = (uchar *)s; - strcpy ((char *)pkt, tftp_filename); - pkt += strlen(tftp_filename) + 1; - strcpy ((char *)pkt, "octet"); - pkt += 5 /*strlen("octet")*/ + 1; - strcpy ((char *)pkt, "timeout"); - pkt += 7 /*strlen("timeout")*/ + 1; - sprintf((char *)pkt, "%d", TIMEOUT); -#ifdef ET_DEBUG - printf("send option \"timeout %s\"\n", (char *)pkt); -#endif - pkt += strlen((char *)pkt) + 1; + pkt += sprintf((uchar *)pkt, "%s%coctet%ctimeout%c%d", + tftp_filename, 0, 0, 0, TIMEOUT) + 1; len = pkt - xp; break; |