Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

tftptest.c 995B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <stdint.h>
  2. #include <string.h>
  3. #include <console.h>
  4. #include <gpxe/udp.h>
  5. #include <gpxe/tftp.h>
  6. #include <gpxe/async.h>
  7. #include <gpxe/uaccess.h>
  8. #include "pxe.h"
  9. static void test_tftp_callback ( struct tftp_session *tftp, unsigned int block,
  10. void *data, size_t len ) {
  11. unsigned long offset = ( ( block - 1 ) * tftp->blksize );
  12. userptr_t pxe_buffer = real_to_user ( 0, 0x7c00 );
  13. copy_to_user ( pxe_buffer, offset, data, len );
  14. }
  15. int test_tftp ( struct net_device *netdev, struct sockaddr_tcpip *target,
  16. const char *filename ) {
  17. struct tftp_session tftp;
  18. int rc;
  19. memset ( &tftp, 0, sizeof ( tftp ) );
  20. udp_connect ( &tftp.udp, target );
  21. tftp.filename = filename;
  22. tftp.callback = test_tftp_callback;
  23. printf ( "Fetching \"%s\" via TFTP\n", filename );
  24. if ( ( rc = async_wait ( tftp_get ( &tftp ) ) ) != 0 )
  25. return rc;
  26. printf ( "Attempting PXE boot\n" );
  27. pxe_netdev = netdev;
  28. rc = pxe_boot();
  29. printf ( "PXE NBP returned with status %04x\n", rc );
  30. return 0;
  31. }