Wed Jul 22 21:06:56 2009 UTC ()
Since rumpfs can now be used from publically exported routines,
convert unsupported checking KASSERTs to return EOPNOTSUPP.


(pooka)
diff -r1.19 -r1.20 src/sys/rump/librump/rumpvfs/rumpfs.c

cvs diff -r1.19 -r1.20 src/sys/rump/librump/rumpvfs/rumpfs.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpvfs/rumpfs.c 2009/06/10 12:12:23 1.19
+++ src/sys/rump/librump/rumpvfs/rumpfs.c 2009/07/22 21:06:56 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rumpfs.c,v 1.19 2009/06/10 12:12:23 pooka Exp $ */ 1/* $NetBSD: rumpfs.c,v 1.20 2009/07/22 21:06:56 pooka 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 Google Summer of Code. 6 * Development of this software was supported by Google Summer of Code.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.19 2009/06/10 12:12:23 pooka Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.20 2009/07/22 21:06:56 pooka Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/mount.h> 34#include <sys/mount.h>
35#include <sys/vnode.h> 35#include <sys/vnode.h>
36#include <sys/errno.h> 36#include <sys/errno.h>
37#include <sys/kauth.h> 37#include <sys/kauth.h>
38#include <sys/lock.h> 38#include <sys/lock.h>
39#include <sys/lockf.h> 39#include <sys/lockf.h>
40#include <sys/stat.h> 40#include <sys/stat.h>
41#include <sys/namei.h> 41#include <sys/namei.h>
42#include <sys/queue.h> 42#include <sys/queue.h>
43#include <sys/filedesc.h> 43#include <sys/filedesc.h>
44#include <sys/syscallargs.h> 44#include <sys/syscallargs.h>
@@ -220,30 +220,33 @@ rump_vop_lookup(void *v) @@ -220,30 +220,33 @@ rump_vop_lookup(void *v)
220 struct componentname *a_cnp; 220 struct componentname *a_cnp;
221 }; */ *ap = v; 221 }; */ *ap = v;
222 struct componentname *cnp = ap->a_cnp; 222 struct componentname *cnp = ap->a_cnp;
223 struct vnode *dvp = ap->a_dvp; 223 struct vnode *dvp = ap->a_dvp;
224 struct vnode **vpp = ap->a_vpp; 224 struct vnode **vpp = ap->a_vpp;
225 struct vnode *vp; 225 struct vnode *vp;
226 struct rumpfs_node *rn = dvp->v_data; 226 struct rumpfs_node *rn = dvp->v_data;
227 struct rumpfs_dent *rd; 227 struct rumpfs_dent *rd;
228 uint64_t fsize; 228 uint64_t fsize;
229 enum vtype vt; 229 enum vtype vt;
230 int rv, error, ft; 230 int rv, error, ft;
231 231
232 /* we handle only some "non-special" cases */ 232 /* we handle only some "non-special" cases */
233 KASSERT(((cnp->cn_flags & ISLASTCN) == 0) 233 if (!(((cnp->cn_flags & ISLASTCN) == 0)
234 || (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == CREATE)); 234 || (cnp->cn_nameiop == LOOKUP || cnp->cn_nameiop == CREATE)))
235 KASSERT((cnp->cn_flags & ISDOTDOT) == 0); 235 return EOPNOTSUPP;
236 KASSERT(cnp->cn_namelen != 0 && cnp->cn_pnbuf[0] != '.'); 236 if (!((cnp->cn_flags & ISDOTDOT) == 0))
 237 return EOPNOTSUPP;
 238 if (!(cnp->cn_namelen != 0 && cnp->cn_pnbuf[0] != '.'))
 239 return EOPNOTSUPP;
237 240
238 /* check if we are returning a faked block device */ 241 /* check if we are returning a faked block device */
239 if (dvp == rootvnode && cnp->cn_nameiop == LOOKUP) { 242 if (dvp == rootvnode && cnp->cn_nameiop == LOOKUP) {
240 if (rump_fakeblk_find(cnp->cn_pnbuf)) { 243 if (rump_fakeblk_find(cnp->cn_pnbuf)) {
241 rv = rumpuser_getfileinfo(cnp->cn_pnbuf, &fsize, 244 rv = rumpuser_getfileinfo(cnp->cn_pnbuf, &fsize,
242 &ft, &error); 245 &ft, &error);
243 if (rv) 246 if (rv)
244 return rv; 247 return rv;
245 switch (ft) { 248 switch (ft) {
246 case RUMPUSER_FT_DIR: 249 case RUMPUSER_FT_DIR:
247 vt = VDIR; 250 vt = VDIR;
248 break; 251 break;
249 case RUMPUSER_FT_REG: 252 case RUMPUSER_FT_REG: