Updated EFI_MTFTP4_TOKEN structure to add member Context. It's an incompatible change adopted by UEFI group.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9005 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-07-24 17:36:07 +00:00
parent e7d41e1818
commit ea886bef0a
4 changed files with 23 additions and 26 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Interface routine for Mtftp4. Interface routine for Mtftp4.
Copyright (c) 2006 - 2007, 2009, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -111,13 +111,11 @@ Mtftp4GetInfoCheckPacket (
IN EFI_MTFTP4_PACKET *Packet IN EFI_MTFTP4_PACKET *Packet
) )
{ {
MTFTP4_PROTOCOL *Instance;
MTFTP4_GETINFO_STATE *State; MTFTP4_GETINFO_STATE *State;
EFI_STATUS Status; EFI_STATUS Status;
UINT16 OpCode; UINT16 OpCode;
Instance = MTFTP4_PROTOCOL_FROM_THIS (This); State = (MTFTP4_GETINFO_STATE *) Token->Context;
State = &Instance->GetInfoState;
OpCode = NTOHS (Packet->OpCode); OpCode = NTOHS (Packet->OpCode);
// //
@ -984,8 +982,7 @@ EfiMtftp4GetInfo (
) )
{ {
EFI_MTFTP4_TOKEN Token; EFI_MTFTP4_TOKEN Token;
MTFTP4_PROTOCOL *Instance; MTFTP4_GETINFO_STATE State;
MTFTP4_GETINFO_STATE *State;
EFI_STATUS Status; EFI_STATUS Status;
if ((This == NULL) || (Filename == NULL) || (PacketLength == NULL) || if ((This == NULL) || (Filename == NULL) || (PacketLength == NULL) ||
@ -998,11 +995,9 @@ EfiMtftp4GetInfo (
} }
*PacketLength = 0; *PacketLength = 0;
Instance = MTFTP4_PROTOCOL_FROM_THIS (This); State.Packet = Packet;
State = &Instance->GetInfoState; State.PacketLen = PacketLength;
State->Packet = Packet; State.Status = EFI_SUCCESS;
State->PacketLen = PacketLength;
State->Status = EFI_SUCCESS;
// //
// Fill in the Token to issue an synchronous ReadFile operation // Fill in the Token to issue an synchronous ReadFile operation
@ -1016,6 +1011,7 @@ EfiMtftp4GetInfo (
Token.OptionList = OptionList; Token.OptionList = OptionList;
Token.BufferSize = 0; Token.BufferSize = 0;
Token.Buffer = NULL; Token.Buffer = NULL;
Token.Context = &State;
Token.CheckPacket = Mtftp4GetInfoCheckPacket; Token.CheckPacket = Mtftp4GetInfoCheckPacket;
Token.TimeoutCallback = NULL; Token.TimeoutCallback = NULL;
Token.PacketNeeded = NULL; Token.PacketNeeded = NULL;
@ -1023,7 +1019,7 @@ EfiMtftp4GetInfo (
Status = EfiMtftp4ReadFile (This, &Token); Status = EfiMtftp4ReadFile (This, &Token);
if (EFI_ABORTED == Status) { if (EFI_ABORTED == Status) {
return State->Status; return State.Status;
} }
return Status; return Status;

View File

@ -9,7 +9,7 @@
RFC2348 - TFTP Blocksize Option RFC2348 - TFTP Blocksize Option
RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC2349 - TFTP Timeout Interval and Transfer Size Options
Copyright (c) 2006 - 2007, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -149,8 +149,6 @@ struct _MTFTP4_PROTOCOL {
UINT16 McastPort; UINT16 McastPort;
BOOLEAN Master; BOOLEAN Master;
UDP_IO_PORT *McastUdpPort; UDP_IO_PORT *McastUdpPort;
MTFTP4_GETINFO_STATE GetInfoState;
}; };
/** /**

View File

@ -14,9 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PxeBcImpl.h" #include "PxeBcImpl.h"
VOID *TokenContext = NULL; UINT8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
"blksize", "blksize",
"timeout", "timeout",
"tsize", "tsize",
@ -55,7 +53,7 @@ PxeBcCheckPacket (
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *Callback; EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *Callback;
EFI_STATUS Status; EFI_STATUS Status;
Private = (PXEBC_PRIVATE_DATA *) TokenContext; Private = (PXEBC_PRIVATE_DATA *) Token->Context;
Callback = Private->PxeBcCallback; Callback = Private->PxeBcCallback;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -271,7 +269,7 @@ PxeBcTftpReadFile (
Token.ModeStr = NULL; Token.ModeStr = NULL;
Token.OptionCount = OptCnt; Token.OptionCount = OptCnt;
Token.OptionList = ReqOpt; Token.OptionList = ReqOpt;
TokenContext = Private; Token.Context = Private;
if (DontUseBuffer) { if (DontUseBuffer) {
Token.BufferSize = 0; Token.BufferSize = 0;
@ -428,7 +426,7 @@ PxeBcTftpReadDirectory (
Token.ModeStr = NULL; Token.ModeStr = NULL;
Token.OptionCount = OptCnt; Token.OptionCount = OptCnt;
Token.OptionList = ReqOpt; Token.OptionList = ReqOpt;
TokenContext = Private; Token.Context = Private;
if (DontUseBuffer) { if (DontUseBuffer) {
Token.BufferSize = 0; Token.BufferSize = 0;

View File

@ -1,7 +1,7 @@
/** @file /** @file
EFI Multicast Trivial File Tranfer Protocol Definition EFI Multicast Trivial File Tranfer Protocol Definition
Copyright (c) 2006 - 2008, Intel Corporation Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -356,8 +356,8 @@ EFI_STATUS
@param Packet Pointer to the OACK packet to be parsed. @param Packet Pointer to the OACK packet to be parsed.
@param OptionCount Pointer to the number of options in following OptionList. @param OptionCount Pointer to the number of options in following OptionList.
@param OptionList Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot @param OptionList Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot
Service FreePool() to release each option if they are not Service FreePool() to release the OptionList if the options
needed any more. in this OptionList are not needed any more.
@retval EFI_SUCCESS The OACK packet was valid and the OptionCount and @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and
OptionList parameters have been updated. OptionList parameters have been updated.
@ -540,13 +540,18 @@ struct _EFI_MTFTP4_TOKEN {
/// ///
/// Size of the data buffer. /// Size of the data buffer.
/// ///
OUT UINT64 BufferSize; UINT64 BufferSize;
/// ///
/// Pointer to the data buffer. Data that is downloaded from the /// Pointer to the data buffer. Data that is downloaded from the
/// MTFTPv4 server is stored here. Data that is uploaded to the /// MTFTPv4 server is stored here. Data that is uploaded to the
/// MTFTPv4 server is read from here. Ignored if BufferSize is zero. /// MTFTPv4 server is read from here. Ignored if BufferSize is zero.
/// ///
OUT VOID *Buffer; VOID *Buffer;
///
/// Pointer to the context that will be used by CheckPacket,
/// TimeoutCallback and PacketNeeded.
///
VOID *Context;
/// ///
/// Pointer to the callback function to check the contents of the received packet. /// Pointer to the callback function to check the contents of the received packet.
/// ///