Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 May 2017 17:20:55 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r319344 - stable/10/tests/sys/aio
Message-ID:  <201705311720.v4VHKt0x045028@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Wed May 31 17:20:55 2017
New Revision: 319344
URL: https://svnweb.freebsd.org/changeset/base/319344

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

Modified:
  stable/10/tests/sys/aio/aio_kqueue_test.c
  stable/10/tests/sys/aio/lio_kqueue_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tests/sys/aio/aio_kqueue_test.c
==============================================================================
--- stable/10/tests/sys/aio/aio_kqueue_test.c	Wed May 31 16:32:33 2017	(r319343)
+++ stable/10/tests/sys/aio/aio_kqueue_test.c	Wed May 31 17:20:55 2017	(r319344)
@@ -161,7 +161,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
@@ -169,7 +170,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: stable/10/tests/sys/aio/lio_kqueue_test.c
==============================================================================
--- stable/10/tests/sys/aio/lio_kqueue_test.c	Wed May 31 16:32:33 2017	(r319343)
+++ stable/10/tests/sys/aio/lio_kqueue_test.c	Wed May 31 17:20:55 2017	(r319344)
@@ -54,7 +54,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
@@ -101,9 +102,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);
@@ -113,7 +114,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;
@@ -123,11 +124,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) {
@@ -167,7 +168,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?201705311720.v4VHKt0x045028>