On Thu, 16 Apr 2015, Fu, Siyuan wrote:
> Most of the patch is ok but there are a little problem about the opening 
> brace place after a complex predicate expression. See details in 
> https://github.com/tianocore/tianocore.github.io/wiki/Code-Style-C
> In EDK2_C_Coding_Standards_2_0, Rule 5.1.1.1-6 has two parts:
>       a) the sub-expressions on either side of the && or || operators must be 
> on separate lines, and
>       b) the opening brace of the body must be on a line by itself and 
> aligned with the first letter of the statement's keyword.
> While the example in the Coding Style document shows the && and || operators 
> on the left side of the second sub-expression, they are more traditionally 
> placed to the right side of the preceding sub-expression. Either placement is 
> allowed, as long as it matches whatever is used in the rest of the file.
> So I made a little update on your patch, please review it. Thanks.

Fine with me.

Thanks,
BALATON Zoltan

>
> Best Regards
> Siyuan
>
> -----Original Message-----
> From: BALATON Zoltan [mailto:[email protected]]
> Sent: Saturday, April 11, 2015 5:59 AM
> To: [email protected]
> Cc: Fu, Siyuan
> Subject: [PATCH] Network/TcpDxe: Fix some grammar and converge formatting of 
> the two versions of TcpInput.c
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: BALATON Zoltan <[email protected]>
> ---
> MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 31 ++++-----
> NetworkPkg/TcpDxe/TcpInput.c                       | 79 +++++++++++-----------
> 2 files changed, 55 insertions(+), 55 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c 
> b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
> index 2e87b3f..8553557 100644
> --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
> +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
> @@ -61,7 +61,7 @@ TcpFastRecover (
>     //
>     // Step 1A: Invoking fast retransmission.
>     //
> -    FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
> +    FlightSize        = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
>
>     Tcb->Ssthresh     = MAX (FlightSize >> 1, (UINT32) (2 * Tcb->SndMss));
>     Tcb->Recover      = Tcb->SndNxt;
> @@ -109,7 +109,7 @@ TcpFastRecover (
>       // Step 5 - Full ACK:
>       // deflate the congestion window, and exit fast recovery
>       //
> -      FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
> +      FlightSize        = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
>
>       Tcb->CWnd         = MIN (Tcb->Ssthresh, FlightSize + Tcb->SndMss);
>
> @@ -556,15 +556,15 @@ TcpQueueData (
>   if (IsListEmpty (Head)) {
>
>     InsertTailList (Head, &Nbuf->List);
> -    return ;
> +    return;
>   }
>
>   //
>   // Find the point to insert the buffer
>   //
>   for (Prev = Head, Cur = Head->ForwardLink;
> -      Cur != Head;
> -      Prev = Cur, Cur = Cur->ForwardLink) {
> +       Cur != Head;
> +       Prev = Cur, Cur = Cur->ForwardLink) {
>
>     Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
>
> @@ -585,7 +585,7 @@ TcpQueueData (
>       if (TCP_SEQ_LEQ (Seg->End, TCPSEG_NETBUF (Node)->End)) {
>
>         NetbufFree (Nbuf);
> -        return ;
> +        return;
>       }
>
>       TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End); @@ -617,7 
> +617,7 @@ TcpQueueData (
>
>         RemoveEntryList (&Nbuf->List);
>         NetbufFree (Nbuf);
> -        return ;
> +        return;
>       }
>
>       TcpTrimSegment (Nbuf, Seg->Seq, TCPSEG_NETBUF (Node)->Seq); @@ -716,7 
> +716,7 @@ TcpInput (
>   if ((Head->HeadLen < 5) || (Len < 0) ||
>       (TcpChecksum (Nbuf, NetPseudoHeadChecksum (Src, Dst, 6, 0)) != 0)) {
>
> -    DEBUG ((EFI_D_INFO, "TcpInput: received an mal-formated packet\n"));
> +    DEBUG ((EFI_D_INFO, "TcpInput: received a malformed packet\n"));
>     goto DISCARD;
>   }
>
> @@ -737,7 +737,7 @@ TcpInput (
>           );
>
>   if ((Tcb == NULL) || (Tcb->State == TCP_CLOSED)) {
> -    DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB find\n"));
> +    DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB
> + found\n"));
>
>     Tcb = NULL;
>     goto SEND_RESET;
> @@ -751,7 +751,7 @@ TcpInput (
>   //
>   if (TcpParseOption (Nbuf->Tcp, &Option) == -1) {
>     DEBUG ((EFI_D_ERROR, "TcpInput: reset the peer because"
> -      " of mal-format option for Tcb %p\n", Tcb));
> +      " of malformed option for TCB %p\n", Tcb));
>
>     goto SEND_RESET;
>   }
> @@ -799,7 +799,7 @@ TcpInput (
>       Tcb     = TcpCloneTcb (Parent);
>       if (Tcb == NULL) {
>         DEBUG ((EFI_D_ERROR, "TcpInput: discard a segment because"
> -          " failed to clone a child for TCB%x\n", Tcb));
> +          " failed to clone a child for TCB %p\n", Tcb));
>
>         goto DISCARD;
>       }
> @@ -865,7 +865,7 @@ TcpInput (
>     //
>
>     //
> -    // Fourth step: Check SYN. Pay attention to sitimulatous open
> +    // Fourth step: Check SYN. Pay attention to simultaneous open
>     //
>     if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
>
> @@ -902,7 +902,7 @@ TcpInput (
>         goto StepSix;
>       } else {
>         //
> -        // Received a SYN segment without ACK, simultanous open.
> +        // Received a SYN segment without ACK, simultaneous open.
>         //
>         TcpSetState (Tcb, TCP_SYN_RCVD);
>
> @@ -911,7 +911,7 @@ TcpInput (
>
>         TcpTrimInWnd (Tcb, Nbuf);
>
> -        DEBUG ((EFI_D_WARN, "TcpInput: simultanous open "
> +        DEBUG ((EFI_D_WARN, "TcpInput: simultaneous open "
>           "for TCB %p in SYN_SENT\n", Tcb));
>
>         goto StepSix;
> @@ -1289,8 +1289,7 @@ StepSix:
>   Tcb->Idle = 0;
>   TcpSetKeepaliveTimer (Tcb);
>
> -  if (TCP_FLG_ON (Seg->Flag, TCP_FLG_URG) &&
> -      !TCP_FIN_RCVD (Tcb->State)) {
> +  if (TCP_FLG_ON (Seg->Flag, TCP_FLG_URG) && !TCP_FIN_RCVD
> + (Tcb->State)) {
>
>     DEBUG ((EFI_D_INFO, "TcpInput: received urgent data "
>       "from peer for connected TCB %p\n", Tcb)); diff --git 
> a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c index 
> e63469a..6addcfa 100644
> --- a/NetworkPkg/TcpDxe/TcpInput.c
> +++ b/NetworkPkg/TcpDxe/TcpInput.c
> @@ -531,8 +531,7 @@ TcpDeliverData (
>       Urgent = 0;
>
>       if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) &&
> -          TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvUp)
> -          ) {
> +          TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvUp)) {
>
>         if (TCP_SEQ_LEQ (Seg->End, Tcb->RcvUp)) {
>           Urgent = Nbuf->TotalSize;
> @@ -596,8 +595,7 @@ TcpQueueData (
>   //
>   for (Prev = Head, Cur = Head->ForwardLink;
>        Cur != Head;
> -       Prev = Cur, Cur = Cur->ForwardLink
> -       ) {
> +       Prev = Cur, Cur = Cur->ForwardLink) {
>
>     Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
>
> @@ -753,7 +751,7 @@ TcpInput (
>
>   if ((Head->HeadLen < 5) || (Len < 0)) {
>
> -    DEBUG ((EFI_D_INFO, "TcpInput: received an mal-formated packet\n"));
> +    DEBUG ((EFI_D_INFO, "TcpInput: received a malformed packet\n"));
>     goto DISCARD;
>   }
>
> @@ -788,7 +786,7 @@ TcpInput (
>           );
>
>   if ((Tcb == NULL) || (Tcb->State == TCP_CLOSED)) {
> -    DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB find\n"));
> +    DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB
> + found\n"));
>
>     Tcb = NULL;
>     goto SEND_RESET;
> @@ -803,7 +801,7 @@ TcpInput (
>   if (TcpParseOption (Nbuf->Tcp, &Option) == -1) {
>     DEBUG (
>       (EFI_D_ERROR,
> -      "TcpInput: reset the peer because of mal-format option for Tcb %p\n",
> +      "TcpInput: reset the peer because of malformed option for TCB
> + %p\n",
>       Tcb)
>       );
>
> @@ -860,7 +858,7 @@ TcpInput (
>       if (Tcb == NULL) {
>         DEBUG (
>           (EFI_D_ERROR,
> -          "TcpInput: discard a segment because failed to clone a child for 
> TCB%p\n",
> +          "TcpInput: discard a segment because failed to clone a child
> + for TCB %p\n",
>           Tcb)
>           );
>
> @@ -940,7 +938,7 @@ TcpInput (
>     //
>
>     //
> -    // Fourth step: Check SYN. Pay attention to sitimulatous open
> +    // Fourth step: Check SYN. Pay attention to simultaneous open
>     //
>     if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
>
> @@ -961,8 +959,7 @@ TcpInput (
>         TcpDeliverData (Tcb);
>
>         if ((Tcb->CongestState == TCP_CONGEST_OPEN) &&
> -            TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RTT_ON)
> -            ) {
> +            TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RTT_ON)) {
>
>           TcpComputeRtt (Tcb, Tcb->RttMeasure);
>           TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_RTT_ON); @@ -981,7 +978,7 @@ 
> TcpInput (
>         goto StepSix;
>       } else {
>         //
> -        // Received a SYN segment without ACK, simultanous open.
> +        // Received a SYN segment without ACK, simultaneous open.
>         //
>         TcpSetState (Tcb, TCP_SYN_RCVD);
>
> @@ -992,7 +989,7 @@ TcpInput (
>
>         DEBUG (
>           (EFI_D_WARN,
> -          "TcpInput: simultanous open for TCB %p in SYN_SENT\n",
> +          "TcpInput: simultaneous open for TCB %p in SYN_SENT\n",
>           Tcb)
>           );
>
> @@ -1034,8 +1031,7 @@ TcpInput (
>
>   if ((TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2)) &&
>       (Tcb->RcvWl2 == Seg->End) &&
> -      !TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN | TCP_FLG_FIN)
> -        ) {
> +      !TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN | TCP_FLG_FIN)) {
>
>     TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW);
>   }
> @@ -1058,14 +1054,14 @@ TcpInput (
>       // if it comes from a LISTEN TCB.
>       //
>     } else if ((Tcb->State == TCP_ESTABLISHED) ||
> -             (Tcb->State == TCP_FIN_WAIT_1) ||
> -             (Tcb->State == TCP_FIN_WAIT_2) ||
> -             (Tcb->State == TCP_CLOSE_WAIT)
> -            ) {
> +               (Tcb->State == TCP_FIN_WAIT_1) ||
> +               (Tcb->State == TCP_FIN_WAIT_2) ||
> +               (Tcb->State == TCP_CLOSE_WAIT)) {
>
>       SOCK_ERROR (Tcb->Sk, EFI_CONNECTION_RESET);
>
>     } else {
> +
>     }
>
>     goto DROP_CONNECTION;
> @@ -1114,7 +1110,8 @@ TcpInput (
>
>   if (Tcb->State == TCP_SYN_RCVD) {
>
> -    if (TCP_SEQ_LT (Tcb->SndUna, Seg->Ack) && TCP_SEQ_LEQ (Seg->Ack, 
> Tcb->SndNxt)) {
> +    if (TCP_SEQ_LT (Tcb->SndUna, Seg->Ack) &&
> +        TCP_SEQ_LEQ (Seg->Ack, Tcb->SndNxt)) {
>
>       Tcb->SndWnd     = Seg->Wnd;
>       Tcb->SndWndMax  = MAX (Tcb->SndWnd, Tcb->SndWndMax); @@ -1127,7 +1124,7 
> @@ TcpInput (
>
>       DEBUG (
>         (EFI_D_INFO,
> -        "TcpInput: connection established  for TCB %p in SYN_RCVD\n",
> +        "TcpInput: connection established for TCB %p in SYN_RCVD\n",
>         Tcb)
>         );
>
> @@ -1176,7 +1173,8 @@ TcpInput (
>     // RcvWl2 equals to the variable "LastAckSent"
>     // defined there.
>     //
> -    if (TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvWl2) && TCP_SEQ_LT (Tcb->RcvWl2, 
> Seg->End)) {
> +    if (TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvWl2) &&
> +        TCP_SEQ_LT (Tcb->RcvWl2, Seg->End)) {
>
>       Tcb->TsRecent     = Option.TSVal;
>       Tcb->TsRecentAge  = mTcpTick;
> @@ -1206,8 +1204,7 @@ TcpInput (
>   if ((Seg->Ack == Tcb->SndUna) &&
>       (Tcb->SndUna != Tcb->SndNxt) &&
>       (Seg->Wnd == Tcb->SndWnd) &&
> -      (0 == Len)
> -      ) {
> +      (0 == Len)) {
>
>     Tcb->DupAck++;
>   } else {
> @@ -1219,8 +1216,7 @@ TcpInput (
>   // Congestion avoidance, fast recovery and fast retransmission.
>   //
>   if (((Tcb->CongestState == TCP_CONGEST_OPEN) && (Tcb->DupAck < 3)) ||
> -      (Tcb->CongestState == TCP_CONGEST_LOSS)
> -      ) {
> +      (Tcb->CongestState == TCP_CONGEST_LOSS)) {
>
>     if (TCP_SEQ_GT (Seg->Ack, Tcb->SndUna)) {
>
> @@ -1249,8 +1245,7 @@ TcpInput (
>     Tcb->SndUna = Seg->Ack;
>
>     if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_URG) &&
> -        TCP_SEQ_LT (Tcb->SndUp, Seg->Ack)
> -        ) {
> +        TCP_SEQ_LT (Tcb->SndUp, Seg->Ack)) {
>
>       TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_URG);
>     }
> @@ -1260,8 +1255,7 @@ TcpInput (
>   // Update window info
>   //
>   if (TCP_SEQ_LT (Tcb->SndWl1, Seg->Seq) ||
> -      ((Tcb->SndWl1 == Seg->Seq) && TCP_SEQ_LEQ (Tcb->SndWl2, Seg->Ack))
> -      ) {
> +      ((Tcb->SndWl1 == Seg->Seq) && TCP_SEQ_LEQ (Tcb->SndWl2,
> + Seg->Ack))) {
>
>     Right = Seg->Ack + Seg->Wnd;
>
> @@ -1269,8 +1263,7 @@ TcpInput (
>
>       if ((Tcb->SndWl1 == Seg->Seq) &&
>           (Tcb->SndWl2 == Seg->Ack) &&
> -          (Len == 0)
> -          ) {
> +          (Len == 0)) {
>
>         goto NO_UPDATE;
>       }
> @@ -1281,12 +1274,14 @@ TcpInput (
>         Tcb)
>         );
>
> -      if ((Tcb->CongestState == TCP_CONGEST_RECOVER) && (TCP_SEQ_LT (Right, 
> Tcb->Recover))) {
> +      if ((Tcb->CongestState == TCP_CONGEST_RECOVER) &&
> +          (TCP_SEQ_LT (Right, Tcb->Recover))) {
>
>         Tcb->Recover = Right;
>       }
>
> -      if ((Tcb->CongestState == TCP_CONGEST_LOSS) && (TCP_SEQ_LT (Right, 
> Tcb->LossRecover))) {
> +      if ((Tcb->CongestState == TCP_CONGEST_LOSS) &&
> +          (TCP_SEQ_LT (Right, Tcb->LossRecover))) {
>
>         Tcb->LossRecover = Right;
>       }
> @@ -1311,7 +1306,8 @@ TcpInput (
>
> NO_UPDATE:
>
> -  if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT) && (Tcb->SndUna == 
> Tcb->SndNxt)) {
> +  if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT) &&
> +      (Tcb->SndUna == Tcb->SndNxt)) {
>
>     DEBUG (
>       (EFI_D_INFO,
> @@ -1417,7 +1413,8 @@ StepSix:
>
>     Urg = Seg->Seq + Seg->Urg;
>
> -    if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) && TCP_SEQ_GT (Urg, 
> Tcb->RcvUp)) {
> +    if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) &&
> +        TCP_SEQ_GT (Urg, Tcb->RcvUp)) {
>
>       Tcb->RcvUp = Urg;
>     } else {
> @@ -1480,8 +1477,7 @@ StepSix:
>
>   if ((Tcb->State != TCP_CLOSED) &&
>       (TcpToSendData (Tcb, 0) == 0) &&
> -      (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || (Nbuf->TotalSize != 
> 0))
> -      ) {
> +      (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || (Nbuf->TotalSize
> + != 0))) {
>
>     TcpToSendAck (Tcb);
>   }
> @@ -1574,7 +1570,12 @@ TcpIcmpInput (
>     goto CLEAN_EXIT;
>   }
>
> -  IcmpErrStatus = IpIoGetIcmpErrStatus (IcmpErr, Tcb->Sk->IpVersion, 
> &IcmpErrIsHard, &IcmpErrNotify);
> +  IcmpErrStatus = IpIoGetIcmpErrStatus (
> +                    IcmpErr,
> +                    Tcb->Sk->IpVersion,
> +                    &IcmpErrIsHard,
> +                    &IcmpErrNotify
> +                    );
>
>   if (IcmpErrNotify) {
>
> --
> 1.8.1.5
>
>

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to