Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2017 15:37:09 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318593 - head/tests/sys/aio
Message-ID:  <201705211537.v4LFb9Z5078495@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Sun May 21 15:37:08 2017
New Revision: 318593
URL: https://svnweb.freebsd.org/changeset/base/318593

Log:
  Fix build of AIO tests with -DDEBUG
  
  Also, redefine some constants for clarity.  No functional change.
  
  MFC after:	1 week

Modified:
  head/tests/sys/aio/aio_kqueue_test.c
  head/tests/sys/aio/lio_kqueue_test.c

Modified: head/tests/sys/aio/aio_kqueue_test.c
==============================================================================
--- head/tests/sys/aio/aio_kqueue_test.c	Sun May 21 14:35:16 2017	(r318592)
+++ head/tests/sys/aio/aio_kqueue_test.c	Sun May 21 15:37:08 2017	(r318593)
@@ -163,7 +163,8 @@ main (int argc, char *argv[])
 				printf("kevent %d %d errno %d return.ident %p "
 				       "return.data %p return.udata %p %p\n",
 				       i, result, error,
-				       kq_returned.ident, kq_returned.data,
+				       (void*)kq_returned.ident,
+				       (void*)kq_returned.data,
 				       kq_returned.udata,
 				       kq_iocb);
 #endif
@@ -171,7 +172,7 @@ main (int argc, char *argv[])
 				if (kq_iocb)
 					break;
 #ifdef DEBUG
-				printf("Try again left %d out of %d %d\n",
+				printf("Try again left %d out of %lu %d\n",
 				    pending, nitems(iocb), cancel);
 #endif
 			}

Modified: head/tests/sys/aio/lio_kqueue_test.c
==============================================================================
--- head/tests/sys/aio/lio_kqueue_test.c	Sun May 21 14:35:16 2017	(r318592)
+++ head/tests/sys/aio/lio_kqueue_test.c	Sun May 21 15:37:08 2017	(r318593)
@@ -55,7 +55,8 @@
 #define PATH_TEMPLATE   "aio.XXXXXXXXXX"
 
 #define LIO_MAX 5
-#define MAX_IOCBS LIO_MAX * 16
+#define IOCBS_PER_LIO	16
+#define MAX_IOCBS (LIO_MAX * IOCBS_PER_LIO)
 #define MAX_RUNS 300
 
 int
@@ -103,9 +104,9 @@ main(int argc, char *argv[])
 #endif
 		for (j = 0; j < LIO_MAX; j++) {
 			lio[j] =
-			    malloc(sizeof(struct aiocb *) * MAX_IOCBS/LIO_MAX);
-			for (i = 0; i < MAX_IOCBS / LIO_MAX; i++) {
-				k = (MAX_IOCBS / LIO_MAX * j) + i;
+			    malloc(sizeof(struct aiocb *) * IOCBS_PER_LIO);
+			for (i = 0; i < IOCBS_PER_LIO; i++) {
+				k = (IOCBS_PER_LIO * j) + i;
 				lio[j][i] = iocb[k] =
 				    calloc(1, sizeof(struct aiocb));
 				iocb[k]->aio_nbytes = sizeof(buffer);
@@ -115,7 +116,7 @@ main(int argc, char *argv[])
 				    = iocb[k]->aio_nbytes * k * (run + 1);
 
 #ifdef DEBUG
-				printf("hello iocb[k] %d\n",
+				printf("hello iocb[k] %ld\n",
 				       iocb[k]->aio_offset);
 #endif
 				iocb[k]->aio_lio_opcode = LIO_WRITE;
@@ -125,11 +126,11 @@ main(int argc, char *argv[])
 			sig.sigev_notify = SIGEV_KEVENT;
 			time(&time1);
 			result = lio_listio(LIO_NOWAIT, lio[j],
-					    MAX_IOCBS / LIO_MAX, &sig);
+					    IOCBS_PER_LIO, &sig);
 			error = errno;
 			time(&time2);
 #ifdef DEBUG
-			printf("Time %d %d %d result -> %d\n",
+			printf("Time %ld %ld %ld result -> %d\n",
 			    time1, time2, time2-time1, result);
 #endif
 			if (result != 0) {
@@ -169,7 +170,8 @@ main(int argc, char *argv[])
 				printf("kevent %d %d errno %d return.ident %p "
 				       "return.data %p return.udata %p %p\n",
 				       i, result, error,
-				       kq_returned.ident, kq_returned.data,
+				       (void*)kq_returned.ident,
+				       (void*)kq_returned.data,
 				       kq_returned.udata,
 				       lio[j]);
 #endif



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