Module Name: src
Committed By: pooka
Date: Mon Dec 6 10:48:19 UTC 2010
Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c
Log Message:
Allow creation with NULL busname (to be later set with SIOCSLINKSTR).
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/rump/net/lib/libshmif/if_shmem.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/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.32 src/sys/rump/net/lib/libshmif/if_shmem.c:1.33
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.32 Wed Nov 17 17:51:22 2010
+++ src/sys/rump/net/lib/libshmif/if_shmem.c Mon Dec 6 10:48:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.32 2010/11/17 17:51:22 pooka Exp $ */
+/* $NetBSD: if_shmem.c,v 1.33 2010/12/06 10:48:18 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.32 2010/11/17 17:51:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.33 2010/12/06 10:48:18 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -279,19 +279,27 @@
rump_shmif_create(const char *path, int *ifnum)
{
struct shmif_sc *sc;
- int unit, error, memfd;
+ int unit, error;
+ int memfd = -1; /* XXXgcc */
- memfd = rumpuser_open(path, O_RDWR | O_CREAT, &error);
- if (memfd == -1)
- return error;
+ if (path) {
+ memfd = rumpuser_open(path, O_RDWR | O_CREAT, &error);
+ if (memfd == -1)
+ return error;
+ }
unit = vmem_xalloc(shmif_units, 1, 0, 0, 0, 0, 0,
VM_INSTANTFIT | VM_SLEEP) - 1;
if ((error = allocif(unit, &sc)) != 0) {
- rumpuser_close(memfd, NULL);
+ if (path)
+ rumpuser_close(memfd, NULL);
return error;
}
+
+ if (!path)
+ goto out;
+
error = initbackend(sc, memfd);
if (error) {
shmif_unclone(&sc->sc_ec.ec_if);
@@ -302,6 +310,7 @@
sc->sc_backfile = kmem_alloc(sc->sc_backfilelen, KM_SLEEP);
strcpy(sc->sc_backfile, path);
+ out:
if (ifnum)
*ifnum = unit;