Sun Oct 31 22:33:16 2010 UTC ()
Fix format strings so it builds on amd64


(pgoyette)
diff -r1.4 -r1.5 src/tests/fs/common/fstest_puffs.c

cvs diff -r1.4 -r1.5 src/tests/fs/common/fstest_puffs.c (expand / switch to unified diff)

--- src/tests/fs/common/fstest_puffs.c 2010/10/31 22:05:35 1.4
+++ src/tests/fs/common/fstest_puffs.c 2010/10/31 22:33:16 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fstest_puffs.c,v 1.4 2010/10/31 22:05:35 pooka Exp $ */ 1/* $NetBSD: fstest_puffs.c,v 1.5 2010/10/31 22:33:16 pgoyette Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -69,50 +69,50 @@ readshovel(void *arg) @@ -69,50 +69,50 @@ readshovel(void *arg)
69 comfd = args->pta_servfd; 69 comfd = args->pta_servfd;
70 puffsfd = args->pta_rumpfd; 70 puffsfd = args->pta_rumpfd;
71 71
72 phdr = (void *)buf; 72 phdr = (void *)buf;
73 preq = (void *)buf; 73 preq = (void *)buf;
74 74
75 rump_pub_lwproc_newlwp(1); 75 rump_pub_lwproc_newlwp(1);
76 76
77 for (;;) { 77 for (;;) {
78 ssize_t n; 78 ssize_t n;
79 79
80 n = rump_sys_read(puffsfd, buf, sizeof(*phdr)); 80 n = rump_sys_read(puffsfd, buf, sizeof(*phdr));
81 if (n <= 0) { 81 if (n <= 0) {
82 fprintf(stderr, "readshovel r1 %d / %d\n", n, errno); 82 fprintf(stderr, "readshovel r1 %zd / %d\n", n, errno);
83 break; 83 break;
84 } 84 }
85 85
86 assert(phdr->pth_framelen < BUFSIZE); 86 assert(phdr->pth_framelen < BUFSIZE);
87 n = rump_sys_read(puffsfd, buf+sizeof(*phdr),  87 n = rump_sys_read(puffsfd, buf+sizeof(*phdr),
88 phdr->pth_framelen - sizeof(*phdr)); 88 phdr->pth_framelen - sizeof(*phdr));
89 if (n <= 0) { 89 if (n <= 0) {
90 fprintf(stderr, "readshovel r2 %d / %d\n", n, errno); 90 fprintf(stderr, "readshovel r2 %zd / %d\n", n, errno);
91 break; 91 break;
92 } 92 }
93 93
94 /* Analyze request */ 94 /* Analyze request */
95 if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS) { 95 if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS) {
96 assert(preq->preq_optype < PUFFS_VFS_MAX); 96 assert(preq->preq_optype < PUFFS_VFS_MAX);
97 args->pta_vfs_toserv_ops[preq->preq_optype]++; 97 args->pta_vfs_toserv_ops[preq->preq_optype]++;
98 } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) { 98 } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) {
99 assert(preq->preq_optype < PUFFS_VN_MAX); 99 assert(preq->preq_optype < PUFFS_VN_MAX);
100 args->pta_vn_toserv_ops[preq->preq_optype]++; 100 args->pta_vn_toserv_ops[preq->preq_optype]++;
101 } 101 }
102 102
103 n = phdr->pth_framelen; 103 n = phdr->pth_framelen;
104 if (write(comfd, buf, n) != n) { 104 if (write(comfd, buf, n) != n) {
105 fprintf(stderr, "readshovel write %d / %d\n", n, errno); 105 fprintf(stderr, "readshovel write %zd / %d\n", n, errno);
106 break; 106 break;
107 } 107 }
108 } 108 }
109 109
110 abort(); 110 abort();
111} 111}
112 112
113static void * 113static void *
114writeshovel(void *arg) 114writeshovel(void *arg)
115{ 115{
116 struct puffstestargs *args = arg; 116 struct puffstestargs *args = arg;
117 struct putter_hdr *phdr; 117 struct putter_hdr *phdr;
118 char buf[BUFSIZE]; 118 char buf[BUFSIZE];
@@ -130,40 +130,40 @@ writeshovel(void *arg) @@ -130,40 +130,40 @@ writeshovel(void *arg)
130 uint64_t off; 130 uint64_t off;
131 ssize_t n; 131 ssize_t n;
132 132
133 /* 133 /*
134 * Need to write everything to the "kernel" in one chunk, 134 * Need to write everything to the "kernel" in one chunk,
135 * so make sure we have it here. 135 * so make sure we have it here.
136 */ 136 */
137 off = 0; 137 off = 0;
138 toread = sizeof(struct putter_hdr); 138 toread = sizeof(struct putter_hdr);
139 assert(toread < BUFSIZE); 139 assert(toread < BUFSIZE);
140 do { 140 do {
141 n = read(comfd, buf+off, toread); 141 n = read(comfd, buf+off, toread);
142 if (n <= 0) { 142 if (n <= 0) {
143 fprintf(stderr, "writeshovel read %d / %d\n", 143 fprintf(stderr, "writeshovel read %zd / %d\n",
144 n, errno); 144 n, errno);
145 break; 145 break;
146 } 146 }
147 off += n; 147 off += n;
148 if (off >= sizeof(struct putter_hdr)) 148 if (off >= sizeof(struct putter_hdr))
149 toread = phdr->pth_framelen - off; 149 toread = phdr->pth_framelen - off;
150 else 150 else
151 toread = off - sizeof(struct putter_hdr); 151 toread = off - sizeof(struct putter_hdr);
152 } while (toread); 152 } while (toread);
153 153
154 n = rump_sys_write(puffsfd, buf, phdr->pth_framelen); 154 n = rump_sys_write(puffsfd, buf, phdr->pth_framelen);
155 if ((size_t)n != phdr->pth_framelen) { 155 if ((size_t)n != phdr->pth_framelen) {
156 fprintf(stderr, "writeshovel wr %d / %d\n", n, errno); 156 fprintf(stderr, "writeshovel wr %zd / %d\n", n, errno);
157 break; 157 break;
158 } 158 }
159 } 159 }
160 160
161 abort(); 161 abort();
162} 162}
163 163
164static void 164static void
165rumpshovels(struct puffstestargs *args) 165rumpshovels(struct puffstestargs *args)
166{ 166{
167 pthread_t pt; 167 pthread_t pt;
168 int rv; 168 int rv;
169 169