Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2014 22:41:55 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273751 - head/sys/contrib/rdma/krping
Message-ID:  <201410272241.s9RMftda035459@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Mon Oct 27 22:41:55 2014
New Revision: 273751
URL: https://svnweb.freebsd.org/changeset/base/273751

Log:
  krping: In verbose mode print only first 128 bytes of krping data.
  
  Submitted by:	Hariprasad at Chelsio dot com.
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/contrib/rdma/krping/krping.c

Modified: head/sys/contrib/rdma/krping/krping.c
==============================================================================
--- head/sys/contrib/rdma/krping/krping.c	Mon Oct 27 22:22:46 2014	(r273750)
+++ head/sys/contrib/rdma/krping/krping.c	Mon Oct 27 22:41:55 2014	(r273751)
@@ -1011,9 +1011,17 @@ static void krping_test_server(struct kr
 		DEBUG_LOG(cb, "server received read complete\n");
 
 		/* Display data in recv buf */
-		if (cb->verbose)
-			PRINTF(cb, "server ping data: %s\n", 
-				cb->rdma_buf);
+		if (cb->verbose) {
+			if (strlen(cb->rdma_buf) > 128) {
+				char msgbuf[128];
+
+				strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf));
+				PRINTF(cb, "server ping data stripped: %s\n",
+				       msgbuf);
+			} else
+				PRINTF(cb, "server ping data: %s\n",
+				       cb->rdma_buf);
+		}
 
 		/* Tell client to continue */
 		if (cb->server && cb->server_invalidate) {
@@ -1713,8 +1721,16 @@ static void krping_test_client(struct kr
 				break;
 			}
 
-		if (cb->verbose)
-			PRINTF(cb, "ping data: %s\n", cb->rdma_buf);
+		if (cb->verbose) {
+			if (strlen(cb->rdma_buf) > 128) {
+				char msgbuf[128];
+
+				strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf));
+				PRINTF(cb, "ping data stripped: %s\n",
+				       msgbuf);
+			} else
+				PRINTF(cb, "ping data: %s\n", cb->rdma_buf);
+		}
 #ifdef SLOW_KRPING
 		wait_event_interruptible_timeout(cb->sem, cb->state == ERROR, HZ);
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410272241.s9RMftda035459>