Wed Dec 2 17:18:59 2009 UTC ()
fix inverted comparison


(pooka)
diff -r1.32 -r1.33 src/sys/rump/librump/rumpvfs/rumpblk.c

cvs diff -r1.32 -r1.33 src/sys/rump/librump/rumpvfs/rumpblk.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpvfs/rumpblk.c 2009/11/25 15:01:28 1.32
+++ src/sys/rump/librump/rumpvfs/rumpblk.c 2009/12/02 17:18:59 1.33
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rumpblk.c,v 1.32 2009/11/25 15:01:28 pooka Exp $ */ 1/* $NetBSD: rumpblk.c,v 1.33 2009/12/02 17:18:59 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2009 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 * Finnish Cultural Foundation. 7 * Finnish Cultural Foundation.
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
@@ -42,27 +42,27 @@ @@ -42,27 +42,27 @@
42 * we get way less carnage. 42 * we get way less carnage.
43 * 43 *
44 * However, it is quite costly in writing large amounts of 44 * However, it is quite costly in writing large amounts of
45 * file data, since old contents cannot merely be overwritten, but 45 * file data, since old contents cannot merely be overwritten, but
46 * must be paged in first before replacing (i.e. r/m/w). Ideally, 46 * must be paged in first before replacing (i.e. r/m/w). Ideally,
47 * we should use directio. The problem is that directio can fail 47 * we should use directio. The problem is that directio can fail
48 * silently causing improper file system semantics (i.e. unflushed 48 * silently causing improper file system semantics (i.e. unflushed
49 * data). Therefore, default to mmap for now. Even so, directio 49 * data). Therefore, default to mmap for now. Even so, directio
50 * _should_ be safe and can be enabled by compiling this module 50 * _should_ be safe and can be enabled by compiling this module
51 * with -DHAS_DIRECTIO. 51 * with -DHAS_DIRECTIO.
52 */ 52 */
53 53
54#include <sys/cdefs.h> 54#include <sys/cdefs.h>
55__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.32 2009/11/25 15:01:28 pooka Exp $"); 55__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.33 2009/12/02 17:18:59 pooka Exp $");
56 56
57#include <sys/param.h> 57#include <sys/param.h>
58#include <sys/buf.h> 58#include <sys/buf.h>
59#include <sys/conf.h> 59#include <sys/conf.h>
60#include <sys/condvar.h> 60#include <sys/condvar.h>
61#include <sys/disklabel.h> 61#include <sys/disklabel.h>
62#include <sys/evcnt.h> 62#include <sys/evcnt.h>
63#include <sys/fcntl.h> 63#include <sys/fcntl.h>
64#include <sys/kmem.h> 64#include <sys/kmem.h>
65#include <sys/malloc.h> 65#include <sys/malloc.h>
66#include <sys/queue.h> 66#include <sys/queue.h>
67#include <sys/stat.h> 67#include <sys/stat.h>
68 68
@@ -403,27 +403,27 @@ rumpblk_register(const char *path, devmi @@ -403,27 +403,27 @@ rumpblk_register(const char *path, devmi
403 if (minors[i].rblk_path == NULL) 403 if (minors[i].rblk_path == NULL)
404 break; 404 break;
405 if (i == RUMPBLK_SIZE) { 405 if (i == RUMPBLK_SIZE) {
406 mutex_exit(&rumpblk_lock); 406 mutex_exit(&rumpblk_lock);
407 return EBUSY; 407 return EBUSY;
408 } 408 }
409 409
410 rblk = &minors[i]; 410 rblk = &minors[i];
411 len = strlen(path); 411 len = strlen(path);
412 rblk->rblk_path = malloc(len + 1, M_TEMP, M_WAITOK); 412 rblk->rblk_path = malloc(len + 1, M_TEMP, M_WAITOK);
413 strcpy(rblk->rblk_path, path); 413 strcpy(rblk->rblk_path, path);
414 rblk->rblk_fd = -1; 414 rblk->rblk_fd = -1;
415 rblk->rblk_hostoffset = offset; 415 rblk->rblk_hostoffset = offset;
416 if (size == RUMPBLK_SIZENOTSET) { 416 if (size != RUMPBLK_SIZENOTSET) {
417 KASSERT(size + offset <= flen); 417 KASSERT(size + offset <= flen);
418 rblk->rblk_size = size; 418 rblk->rblk_size = size;
419 } else { 419 } else {
420 KASSERT(offset < flen); 420 KASSERT(offset < flen);
421 rblk->rblk_size = flen - offset; 421 rblk->rblk_size = flen - offset;
422 } 422 }
423 rblk->rblk_ftype = ftype; 423 rblk->rblk_ftype = ftype;
424 makedefaultlabel(&rblk->rblk_label, rblk->rblk_size, i); 424 makedefaultlabel(&rblk->rblk_label, rblk->rblk_size, i);
425 mutex_exit(&rumpblk_lock); 425 mutex_exit(&rumpblk_lock);
426 426
427 *dmin = i; 427 *dmin = i;
428 return 0; 428 return 0;
429} 429}