diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:07 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | d1050b9dff1cace252aff86630bfdb59dff5f507 (patch) | |
tree | 77f796143980742d97a883f62ce339a270474801 /NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c | |
parent | 2f88bd3a1296c522317f1c21377876de63de5be7 (diff) | |
download | edk2-d1050b9dff1cace252aff86630bfdb59dff5f507.zip edk2-d1050b9dff1cace252aff86630bfdb59dff5f507.tar.gz edk2-d1050b9dff1cace252aff86630bfdb59dff5f507.tar.bz2 |
NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the NetworkPkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Diffstat (limited to 'NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c')
-rw-r--r-- | NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c | 170 |
1 files changed, 79 insertions, 91 deletions
diff --git a/NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c b/NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c index 5d479fa..9ebefc7 100644 --- a/NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c +++ b/NetworkPkg/Mtftp4Dxe/Mtftp4Wrq.c @@ -8,8 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "Mtftp4Impl.h"
-
-
/**
Build then send a MTFTP data packet for the MTFTP upload session.
@@ -24,17 +22,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
EFI_STATUS
Mtftp4WrqSendBlock (
- IN OUT MTFTP4_PROTOCOL *Instance,
- IN UINT16 BlockNum
+ IN OUT MTFTP4_PROTOCOL *Instance,
+ IN UINT16 BlockNum
)
{
- EFI_MTFTP4_PACKET *Packet;
- EFI_MTFTP4_TOKEN *Token;
- NET_BUF *UdpPacket;
- EFI_STATUS Status;
- UINT16 DataLen;
- UINT8 *DataBuf;
- UINT64 Start;
+ EFI_MTFTP4_PACKET *Packet;
+ EFI_MTFTP4_TOKEN *Token;
+ NET_BUF *UdpPacket;
+ EFI_STATUS Status;
+ UINT16 DataLen;
+ UINT8 *DataBuf;
+ UINT64 Start;
//
// Allocate a buffer to hold the user data
@@ -45,7 +43,7 @@ Mtftp4WrqSendBlock ( return EFI_OUT_OF_RESOURCES;
}
- Packet = (EFI_MTFTP4_PACKET *) NetbufAllocSpace (UdpPacket, MTFTP4_DATA_HEAD_LEN, FALSE);
+ Packet = (EFI_MTFTP4_PACKET *)NetbufAllocSpace (UdpPacket, MTFTP4_DATA_HEAD_LEN, FALSE);
ASSERT (Packet != NULL);
Packet->Data.OpCode = HTONS (EFI_MTFTP4_OPCODE_DATA);
@@ -61,16 +59,15 @@ Mtftp4WrqSendBlock ( Start = MultU64x32 (BlockNum - 1, Instance->BlkSize);
if (Token->BufferSize < Start + Instance->BlkSize) {
- DataLen = (UINT16) (Token->BufferSize - Start);
+ DataLen = (UINT16)(Token->BufferSize - Start);
Instance->LastBlock = BlockNum;
Mtftp4SetLastBlockNum (&Instance->Blocks, BlockNum);
}
if (DataLen > 0) {
NetbufAllocSpace (UdpPacket, DataLen, FALSE);
- CopyMem (Packet->Data.Data, (UINT8 *) Token->Buffer + Start, DataLen);
+ CopyMem (Packet->Data.Data, (UINT8 *)Token->Buffer + Start, DataLen);
}
-
} else {
//
// Get data from PacketNeeded
@@ -80,7 +77,7 @@ Mtftp4WrqSendBlock ( &Instance->Mtftp4,
Token,
&DataLen,
- (VOID **) &DataBuf
+ (VOID **)&DataBuf
);
if (EFI_ERROR (Status) || (DataLen > Instance->BlkSize)) {
@@ -95,7 +92,7 @@ Mtftp4WrqSendBlock ( Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
- (UINT8 *) "User aborted the transfer"
+ (UINT8 *)"User aborted the transfer"
);
return EFI_ABORTED;
@@ -116,7 +113,6 @@ Mtftp4WrqSendBlock ( return Mtftp4SendPacket (Instance, UdpPacket);
}
-
/**
Function to handle received ACK packet.
@@ -135,19 +131,19 @@ Mtftp4WrqSendBlock ( **/
EFI_STATUS
Mtftp4WrqHandleAck (
- IN MTFTP4_PROTOCOL *Instance,
- IN EFI_MTFTP4_PACKET *Packet,
- IN UINT32 Len,
- OUT BOOLEAN *Completed
+ IN MTFTP4_PROTOCOL *Instance,
+ IN EFI_MTFTP4_PACKET *Packet,
+ IN UINT32 Len,
+ OUT BOOLEAN *Completed
)
{
- UINT16 AckNum;
- INTN Expected;
- UINT64 BlockCounter;
+ UINT16 AckNum;
+ INTN Expected;
+ UINT64 BlockCounter;
- *Completed = FALSE;
- AckNum = NTOHS (Packet->Ack.Block[0]);
- Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
+ *Completed = FALSE;
+ AckNum = NTOHS (Packet->Ack.Block[0]);
+ Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
ASSERT (Expected >= 0);
@@ -169,7 +165,6 @@ Mtftp4WrqHandleAck ( Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
if (Expected < 0) {
-
//
// The block range is empty. It may either because the last
// block has been ACKed, or the sequence number just looped back,
@@ -179,22 +174,20 @@ Mtftp4WrqHandleAck ( ASSERT (Instance->LastBlock >= 1);
*Completed = TRUE;
return EFI_SUCCESS;
-
} else {
Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
- (UINT8 *) "Block number rolls back, not supported, try blksize option"
+ (UINT8 *)"Block number rolls back, not supported, try blksize option"
);
return EFI_TFTP_ERROR;
}
}
- return Mtftp4WrqSendBlock (Instance, (UINT16) Expected);
+ return Mtftp4WrqSendBlock (Instance, (UINT16)Expected);
}
-
/**
Check whether the received OACK is valid.
@@ -213,8 +206,8 @@ Mtftp4WrqHandleAck ( **/
BOOLEAN
Mtftp4WrqOackValid (
- IN MTFTP4_OPTION *Reply,
- IN MTFTP4_OPTION *Request
+ IN MTFTP4_OPTION *Reply,
+ IN MTFTP4_OPTION *Request
)
{
//
@@ -229,14 +222,14 @@ Mtftp4WrqOackValid ( // return the timeout matches that requested.
//
if ((((Reply->Exist & MTFTP4_BLKSIZE_EXIST) != 0) && (Reply->BlkSize > Request->BlkSize)) ||
- (((Reply->Exist & MTFTP4_TIMEOUT_EXIST) != 0) && (Reply->Timeout != Request->Timeout))) {
+ (((Reply->Exist & MTFTP4_TIMEOUT_EXIST) != 0) && (Reply->Timeout != Request->Timeout)))
+ {
return FALSE;
}
return TRUE;
}
-
/**
Function to handle the MTFTP OACK packet.
@@ -254,16 +247,16 @@ Mtftp4WrqOackValid ( **/
EFI_STATUS
Mtftp4WrqHandleOack (
- IN OUT MTFTP4_PROTOCOL *Instance,
- IN EFI_MTFTP4_PACKET *Packet,
- IN UINT32 Len,
- OUT BOOLEAN *Completed
+ IN OUT MTFTP4_PROTOCOL *Instance,
+ IN EFI_MTFTP4_PACKET *Packet,
+ IN UINT32 Len,
+ OUT BOOLEAN *Completed
)
{
- MTFTP4_OPTION Reply;
- EFI_MTFTP4_PACKET Bogus;
- EFI_STATUS Status;
- INTN Expected;
+ MTFTP4_OPTION Reply;
+ EFI_MTFTP4_PACKET Bogus;
+ EFI_STATUS Status;
+ INTN Expected;
*Completed = FALSE;
@@ -291,7 +284,7 @@ Mtftp4WrqHandleOack ( Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION,
- (UINT8 *) "Malformatted OACK packet"
+ (UINT8 *)"Malformatted OACK packet"
);
}
@@ -310,8 +303,8 @@ Mtftp4WrqHandleOack ( // Build a bogus ACK0 packet then pass it to the Mtftp4WrqHandleAck,
// which will start the transmission of the first data block.
//
- Bogus.Ack.OpCode = HTONS (EFI_MTFTP4_OPCODE_ACK);
- Bogus.Ack.Block[0] = 0;
+ Bogus.Ack.OpCode = HTONS (EFI_MTFTP4_OPCODE_ACK);
+ Bogus.Ack.Block[0] = 0;
Status = Mtftp4WrqHandleAck (
Instance,
@@ -323,7 +316,6 @@ Mtftp4WrqHandleOack ( return Status;
}
-
/**
The input process routine for MTFTP upload.
@@ -336,20 +328,20 @@ Mtftp4WrqHandleOack ( VOID
EFIAPI
Mtftp4WrqInput (
- IN NET_BUF *UdpPacket,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *UdpPacket,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
)
{
- MTFTP4_PROTOCOL *Instance;
- EFI_MTFTP4_PACKET *Packet;
- BOOLEAN Completed;
- EFI_STATUS Status;
- UINT32 Len;
- UINT16 Opcode;
-
- Instance = (MTFTP4_PROTOCOL *) Context;
+ MTFTP4_PROTOCOL *Instance;
+ EFI_MTFTP4_PACKET *Packet;
+ BOOLEAN Completed;
+ EFI_STATUS Status;
+ UINT32 Len;
+ UINT16 Opcode;
+
+ Instance = (MTFTP4_PROTOCOL *)Context;
NET_CHECK_SIGNATURE (Instance, MTFTP4_PROTOCOL_SIGNATURE);
Completed = FALSE;
@@ -392,10 +384,9 @@ Mtftp4WrqInput ( goto ON_EXIT;
}
- NetbufCopy (UdpPacket, 0, Len, (UINT8 *) Packet);
-
+ NetbufCopy (UdpPacket, 0, Len, (UINT8 *)Packet);
} else {
- Packet = (EFI_MTFTP4_PACKET *) NetbufGetByte (UdpPacket, 0, NULL);
+ Packet = (EFI_MTFTP4_PACKET *)NetbufGetByte (UdpPacket, 0, NULL);
ASSERT (Packet != NULL);
}
@@ -406,12 +397,12 @@ Mtftp4WrqInput ( // if CheckPacket returns an EFI_ERROR code.
//
if ((Instance->Token->CheckPacket != NULL) &&
- ((Opcode == EFI_MTFTP4_OPCODE_OACK) || (Opcode == EFI_MTFTP4_OPCODE_ERROR))) {
-
+ ((Opcode == EFI_MTFTP4_OPCODE_OACK) || (Opcode == EFI_MTFTP4_OPCODE_ERROR)))
+ {
Status = Instance->Token->CheckPacket (
&Instance->Mtftp4,
Instance->Token,
- (UINT16) Len,
+ (UINT16)Len,
Packet
);
@@ -423,7 +414,7 @@ Mtftp4WrqInput ( Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
- (UINT8 *) "User aborted the transfer"
+ (UINT8 *)"User aborted the transfer"
);
}
@@ -433,28 +424,28 @@ Mtftp4WrqInput ( }
switch (Opcode) {
- case EFI_MTFTP4_OPCODE_ACK:
- if (Len != MTFTP4_OPCODE_LEN + MTFTP4_BLKNO_LEN) {
- goto ON_EXIT;
- }
+ case EFI_MTFTP4_OPCODE_ACK:
+ if (Len != MTFTP4_OPCODE_LEN + MTFTP4_BLKNO_LEN) {
+ goto ON_EXIT;
+ }
- Status = Mtftp4WrqHandleAck (Instance, Packet, Len, &Completed);
- break;
+ Status = Mtftp4WrqHandleAck (Instance, Packet, Len, &Completed);
+ break;
- case EFI_MTFTP4_OPCODE_OACK:
- if (Len <= MTFTP4_OPCODE_LEN) {
- goto ON_EXIT;
- }
+ case EFI_MTFTP4_OPCODE_OACK:
+ if (Len <= MTFTP4_OPCODE_LEN) {
+ goto ON_EXIT;
+ }
- Status = Mtftp4WrqHandleOack (Instance, Packet, Len, &Completed);
- break;
+ Status = Mtftp4WrqHandleOack (Instance, Packet, Len, &Completed);
+ break;
- case EFI_MTFTP4_OPCODE_ERROR:
- Status = EFI_TFTP_ERROR;
- break;
+ case EFI_MTFTP4_OPCODE_ERROR:
+ Status = EFI_TFTP_ERROR;
+ break;
- default:
- break;
+ default:
+ break;
}
ON_EXIT:
@@ -482,8 +473,6 @@ ON_EXIT: }
}
-
-
/**
Start the MTFTP session for upload.
@@ -500,11 +489,11 @@ ON_EXIT: **/
EFI_STATUS
Mtftp4WrqStart (
- IN MTFTP4_PROTOCOL *Instance,
- IN UINT16 Operation
+ IN MTFTP4_PROTOCOL *Instance,
+ IN UINT16 Operation
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// The valid block number range are [0, 0xffff]. For example:
@@ -526,4 +515,3 @@ Mtftp4WrqStart ( return UdpIoRecvDatagram (Instance->UnicastPort, Mtftp4WrqInput, Instance, 0);
}
-
|