summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorMichael Brown2007-01-11 16:14:54 +0100
committerMichael Brown2007-01-11 16:14:54 +0100
commit0010e10ef3d242f0ba92010b63f6222366e5ec05 (patch)
tree90de66f3fbcbd4e0ca4e3223f57673e554664b46 /src/tests
parentUse physical address in debug messages; they make more sense to read. (diff)
downloadipxe-0010e10ef3d242f0ba92010b63f6222366e5ec05.tar.gz
ipxe-0010e10ef3d242f0ba92010b63f6222366e5ec05.tar.xz
ipxe-0010e10ef3d242f0ba92010b63f6222366e5ec05.zip
Update TFTP to use a struct buffer rather than a callback.
Add debug autocolourisation to TFTP.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/tftptest.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/tests/tftptest.c b/src/tests/tftptest.c
index e09ef585..2e558a35 100644
--- a/src/tests/tftptest.c
+++ b/src/tests/tftptest.c
@@ -5,25 +5,23 @@
#include <gpxe/tftp.h>
#include <gpxe/async.h>
#include <gpxe/uaccess.h>
+#include <gpxe/buffer.h>
#include "pxe.h"
-static void test_tftp_callback ( struct tftp_session *tftp, unsigned int block,
- void *data, size_t len ) {
- unsigned long offset = ( ( block - 1 ) * tftp->blksize );
- userptr_t pxe_buffer = real_to_user ( 0, 0x7c00 );
-
- copy_to_user ( pxe_buffer, offset, data, len );
-}
-
int test_tftp ( struct net_device *netdev, struct sockaddr_tcpip *target,
const char *filename ) {
struct tftp_session tftp;
+ struct buffer buffer;
int rc;
+ memset ( &buffer, 0, sizeof ( buffer ) );
+ buffer.addr = real_to_user ( 0, 0x7c00 );
+ buffer.len = ( 512 * 1024 - 0x7c00 );
+
memset ( &tftp, 0, sizeof ( tftp ) );
udp_connect ( &tftp.udp, target );
tftp.filename = filename;
- tftp.callback = test_tftp_callback;
+ tftp.buffer = &buffer;
printf ( "Fetching \"%s\" via TFTP\n", filename );
if ( ( rc = async_wait ( tftp_get ( &tftp ) ) ) != 0 )