Wed Jan 23 20:22:34 2013 UTC ()
Assert equality, not assignment, in puffs__fsframe_cmp.


(riastradh)
diff -r1.23 -r1.24 src/lib/libpuffs/requests.c

cvs diff -r1.23 -r1.24 src/lib/libpuffs/requests.c (expand / switch to unified diff)

--- src/lib/libpuffs/requests.c 2008/01/29 14:54:08 1.23
+++ src/lib/libpuffs/requests.c 2013/01/23 20:22:34 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: requests.c,v 1.23 2008/01/29 14:54:08 pooka Exp $ */ 1/* $NetBSD: requests.c,v 1.24 2013/01/23 20:22:34 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Development of this software was supported by the 6 * Development of this software was supported by the
7 * Research Foundation of Helsinki University of Technology 7 * Research Foundation of Helsinki University of Technology
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32#if !defined(lint) 32#if !defined(lint)
33__RCSID("$NetBSD: requests.c,v 1.23 2008/01/29 14:54:08 pooka Exp $"); 33__RCSID("$NetBSD: requests.c,v 1.24 2013/01/23 20:22:34 riastradh Exp $");
34#endif /* !lint */ 34#endif /* !lint */
35 35
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/queue.h> 38#include <sys/queue.h>
39#include <sys/socket.h> 39#include <sys/socket.h>
40 40
41#include <dev/putter/putter.h> 41#include <dev/putter/putter.h>
42 42
43#include <assert.h> 43#include <assert.h>
44#include <errno.h> 44#include <errno.h>
45#include <puffs.h> 45#include <puffs.h>
46#include <stdio.h> 46#include <stdio.h>
@@ -199,41 +199,41 @@ puffs__fsframe_write(struct puffs_usermo @@ -199,41 +199,41 @@ puffs__fsframe_write(struct puffs_usermo
199/*ARGSUSED*/ 199/*ARGSUSED*/
200int 200int
201puffs__fsframe_cmp(struct puffs_usermount *pu, 201puffs__fsframe_cmp(struct puffs_usermount *pu,
202 struct puffs_framebuf *pb1, struct puffs_framebuf *pb2, int *notresp) 202 struct puffs_framebuf *pb1, struct puffs_framebuf *pb2, int *notresp)
203{ 203{
204 struct puffs_req *preq1, *preq2; 204 struct puffs_req *preq1, *preq2;
205 size_t winlen; 205 size_t winlen;
206 int rv; 206 int rv;
207 207
208 /* map incoming preq */ 208 /* map incoming preq */
209 winlen = sizeof(struct puffs_req); 209 winlen = sizeof(struct puffs_req);
210 rv = puffs_framebuf_getwindow(pb1, 0, (void *)&preq1, &winlen); 210 rv = puffs_framebuf_getwindow(pb1, 0, (void *)&preq1, &winlen);
211 assert(rv == 0); /* frames are always at least puffs_req in size */ 211 assert(rv == 0); /* frames are always at least puffs_req in size */
212 assert(winlen = sizeof(struct puffs_req)); 212 assert(winlen == sizeof(struct puffs_req));
213 213
214 /* 214 /*
215 * Check if this is not a response in this slot. That's the 215 * Check if this is not a response in this slot. That's the
216 * likely case. 216 * likely case.
217 */ 217 */
218 if ((preq1->preq_opclass & PUFFSOPFLAG_ISRESPONSE) == 0) { 218 if ((preq1->preq_opclass & PUFFSOPFLAG_ISRESPONSE) == 0) {
219 *notresp = 1; 219 *notresp = 1;
220 return 0; 220 return 0;
221 } 221 }
222 222
223 /* map second preq */ 223 /* map second preq */
224 winlen = sizeof(struct puffs_req); 224 winlen = sizeof(struct puffs_req);
225 rv = puffs_framebuf_getwindow(pb2, 0, (void *)&preq2, &winlen); 225 rv = puffs_framebuf_getwindow(pb2, 0, (void *)&preq2, &winlen);
226 assert(rv == 0); /* frames are always at least puffs_req in size */ 226 assert(rv == 0); /* frames are always at least puffs_req in size */
227 assert(winlen = sizeof(struct puffs_req)); 227 assert(winlen == sizeof(struct puffs_req));
228 228
229 /* then compare: resid equal? */ 229 /* then compare: resid equal? */
230 return preq1->preq_id != preq2->preq_id; 230 return preq1->preq_id != preq2->preq_id;
231} 231}
232 232
233void 233void
234puffs__fsframe_gotframe(struct puffs_usermount *pu, struct puffs_framebuf *pb) 234puffs__fsframe_gotframe(struct puffs_usermount *pu, struct puffs_framebuf *pb)
235{ 235{
236 236
237 puffs_framebuf_seekset(pb, 0); 237 puffs_framebuf_seekset(pb, 0);
238 puffs__ml_dispatch(pu, pb); 238 puffs__ml_dispatch(pu, pb);
239} 239}