Module Name: src
Committed By: pooka
Date: Sun Oct 11 17:54:22 UTC 2009
Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c
Log Message:
Support creating file system sockets (non-sockets not supported in
VOP_CREATE since I don't want to have to write read/write support
for non-etfs files).
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/rump/librump/rumpvfs/rumpfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.25 src/sys/rump/librump/rumpvfs/rumpfs.c:1.26
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.25 Wed Oct 7 09:17:54 2009
+++ src/sys/rump/librump/rumpvfs/rumpfs.c Sun Oct 11 17:54:22 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.25 2009/10/07 09:17:54 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.26 2009/10/11 17:54:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.25 2009/10/07 09:17:54 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.26 2009/10/11 17:54:22 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -59,6 +59,7 @@
static int rump_vop_getattr(void *);
static int rump_vop_mkdir(void *);
static int rump_vop_mknod(void *);
+static int rump_vop_create(void *);
static int rump_vop_inactive(void *);
static int rump_vop_reclaim(void *);
static int rump_vop_success(void *);
@@ -82,6 +83,7 @@
{ &vop_getattr_desc, rump_vop_getattr },
{ &vop_mkdir_desc, rump_vop_mkdir },
{ &vop_mknod_desc, rump_vop_mknod },
+ { &vop_create_desc, rump_vop_create },
{ &vop_access_desc, rump_vop_success },
{ &vop_read_desc, rump_vop_read },
{ &vop_write_desc, rump_vop_write },
@@ -371,7 +373,8 @@
vpops = rump_vnodeop_p;
}
if (vpops != rump_specop_p && va->va_type != VDIR
- && !(va->va_type == VREG && rn->rn_hostpath != NULL))
+ && !(va->va_type == VREG && rn->rn_hostpath != NULL)
+ && va->va_type != VSOCK)
return EOPNOTSUPP;
rv = getnewvnode(VT_RUMP, &rump_mnt, vpops, &vp);
@@ -563,6 +566,47 @@
}
static int
+rump_vop_create(void *v)
+{
+ struct vop_create_args /* {
+ struct vnode *a_dvp;
+ struct vnode **a_vpp;
+ struct componentname *a_cnp;
+ struct vattr *a_vap;
+ }; */ *ap = v;
+ struct vnode *dvp = ap->a_dvp;
+ struct vnode **vpp = ap->a_vpp;
+ struct componentname *cnp = ap->a_cnp;
+ struct vattr *va = ap->a_vap;
+ struct rumpfs_node *rnd = dvp->v_data, *rn;
+ struct rumpfs_dent *rdent;
+ int rv;
+
+ if (va->va_type != VSOCK) {
+ rv = EOPNOTSUPP;
+ goto out;
+ }
+ rn = makeprivate(VSOCK, NODEV, DEV_BSIZE, NULL);
+ mutex_enter(&reclock);
+ rv = makevnode(rn, vpp);
+ mutex_exit(&reclock);
+ if (rv)
+ goto out;
+
+ rdent = kmem_alloc(sizeof(*rdent), KM_SLEEP);
+ rdent->rd_name = kmem_alloc(cnp->cn_namelen+1, KM_SLEEP);
+ rdent->rd_node = (*vpp)->v_data;
+ rdent->rd_node->rn_va.va_rdev = NODEV;
+ strlcpy(rdent->rd_name, cnp->cn_nameptr, cnp->cn_namelen+1);
+
+ LIST_INSERT_HEAD(&rnd->rn_dir, rdent, rd_entries);
+
+ out:
+ vput(dvp);
+ return rv;
+}
+
+static int
rump_vop_open(void *v)
{
struct vop_open_args /* {