Author: tuexen
Date: Sun Apr 29 18:46:19 2012
New Revision: 234811
URL: http://svn.freebsd.org/changeset/base/234811

Log:
  MFC r234461:
  Use the same pattern for mbuf logging everywhere.

Modified:
  stable/8/sys/netinet/sctp_input.c
  stable/8/sys/netinet/sctp_output.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netinet/sctp_input.c
==============================================================================
--- stable/8/sys/netinet/sctp_input.c   Sun Apr 29 18:44:24 2012        
(r234810)
+++ stable/8/sys/netinet/sctp_input.c   Sun Apr 29 18:46:19 2012        
(r234811)
@@ -2463,12 +2463,10 @@ sctp_handle_cookie_echo(struct mbuf *m, 
        if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
                struct mbuf *mat;
 
-               mat = m_sig;
-               while (mat) {
+               for (mat = m_sig; mat; mat = SCTP_BUF_NEXT(mat)) {
                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                sctp_log_mb(mat, SCTP_MBUF_SPLIT);
                        }
-                       mat = SCTP_BUF_NEXT(mat);
                }
        }
 #endif
@@ -5470,12 +5468,10 @@ process_control_chunks:
                                                        if 
(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
                                                                struct mbuf 
*mat;
 
-                                                               mat = 
SCTP_BUF_NEXT(mm);
-                                                               while (mat) {
+                                                               for (mat = 
SCTP_BUF_NEXT(mm); mat; mat = SCTP_BUF_NEXT(mat)) {
                                                                        if 
(SCTP_BUF_IS_EXTENDED(mat)) {
                                                                                
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                                                                        }
-                                                                       mat = 
SCTP_BUF_NEXT(mat);
                                                                }
                                                        }
 #endif
@@ -5808,10 +5804,6 @@ sctp_print_mbuf_chain(struct mbuf *m)
 void
 sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
 {
-#ifdef SCTP_MBUF_LOGGING
-       struct mbuf *mat;
-
-#endif
        struct mbuf *m;
        int iphlen;
        uint32_t vrf_id = 0;
@@ -5846,6 +5838,8 @@ sctp_input_with_port(struct mbuf *i_pak,
 #ifdef SCTP_MBUF_LOGGING
        /* Log in any input mbufs */
        if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
+               struct mbuf *mat;
+
                for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                sctp_log_mb(mat, SCTP_MBUF_INPUT);

Modified: stable/8/sys/netinet/sctp_output.c
==============================================================================
--- stable/8/sys/netinet/sctp_output.c  Sun Apr 29 18:44:24 2012        
(r234810)
+++ stable/8/sys/netinet/sctp_output.c  Sun Apr 29 18:46:19 2012        
(r234811)
@@ -3714,12 +3714,10 @@ sctp_add_cookie(struct mbuf *init, int i
        if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
                struct mbuf *mat;
 
-               mat = copy_init;
-               while (mat) {
+               for (mat = copy_init; mat; mat = SCTP_BUF_NEXT(mat)) {
                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                        }
-                       mat = SCTP_BUF_NEXT(mat);
                }
        }
 #endif
@@ -3734,12 +3732,10 @@ sctp_add_cookie(struct mbuf *init, int i
        if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
                struct mbuf *mat;
 
-               mat = copy_initack;
-               while (mat) {
+               for (mat = copy_initack; mat; mat = SCTP_BUF_NEXT(mat)) {
                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                        }
-                       mat = SCTP_BUF_NEXT(mat);
                }
        }
 #endif
@@ -6446,12 +6442,10 @@ error_out:
                        if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_MBUF_LOGGING_ENABLE) {
                                struct mbuf *mat;
 
-                               mat = appendchain;
-                               while (mat) {
+                               for (mat = appendchain; mat; mat = 
SCTP_BUF_NEXT(mat)) {
                                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                                sctp_log_mb(mat, 
SCTP_MBUF_ICOPY);
                                        }
-                                       mat = SCTP_BUF_NEXT(mat);
                                }
                        }
 #endif
@@ -6547,12 +6541,10 @@ sctp_sendall_iterator(struct sctp_inpcb 
                if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_MBUF_LOGGING_ENABLE) {
                        struct mbuf *mat;
 
-                       mat = m;
-                       while (mat) {
+                       for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
                                if (SCTP_BUF_IS_EXTENDED(mat)) {
                                        sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                                }
-                               mat = SCTP_BUF_NEXT(mat);
                        }
                }
 #endif
@@ -7350,12 +7342,10 @@ dont_do_it:
                if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_MBUF_LOGGING_ENABLE) {
                        struct mbuf *mat;
 
-                       mat = chk->data;
-                       while (mat) {
+                       for (mat = chk->data; mat; mat = SCTP_BUF_NEXT(mat)) {
                                if (SCTP_BUF_IS_EXTENDED(mat)) {
                                        sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                                }
-                               mat = SCTP_BUF_NEXT(mat);
                        }
                }
 #endif
@@ -8953,12 +8943,10 @@ sctp_send_cookie_echo(struct mbuf *m,
                        if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_MBUF_LOGGING_ENABLE) {
                                struct mbuf *mat;
 
-                               mat = cookie;
-                               while (mat) {
+                               for (mat = cookie; mat; mat = 
SCTP_BUF_NEXT(mat)) {
                                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                                sctp_log_mb(mat, 
SCTP_MBUF_ICOPY);
                                        }
-                                       mat = SCTP_BUF_NEXT(mat);
                                }
                        }
 #endif
@@ -9027,12 +9015,10 @@ sctp_send_heartbeat_ack(struct sctp_tcb 
        if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
                struct mbuf *mat;
 
-               mat = outchain;
-               while (mat) {
+               for (mat = outchain; mat; mat = SCTP_BUF_NEXT(mat)) {
                        if (SCTP_BUF_IS_EXTENDED(mat)) {
                                sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                        }
-                       mat = SCTP_BUF_NEXT(mat);
                }
        }
 #endif
@@ -9313,12 +9299,10 @@ sctp_send_asconf_ack(struct sctp_tcb *st
                if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_MBUF_LOGGING_ENABLE) {
                        struct mbuf *mat;
 
-                       mat = m_ack;
-                       while (mat) {
+                       for (mat = m_ack; mat; mat = SCTP_BUF_NEXT(mat)) {
                                if (SCTP_BUF_IS_EXTENDED(mat)) {
                                        sctp_log_mb(mat, SCTP_MBUF_ICOPY);
                                }
-                               mat = SCTP_BUF_NEXT(mat);
                        }
                }
 #endif
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to