Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump Add initial version of RUMP based device-mapper por...
details: https://anonhg.NetBSD.org/src/rev/c29f83b3cdfb
branches: trunk
changeset: 749631:c29f83b3cdfb
user: haad <haad%NetBSD.org@localhost>
date: Fri Dec 04 22:13:59 2009 +0000
description:
Add initial version of RUMP based device-mapper port. libdm compile whole
device-mapper driver in userspace and allows us to test a develop new dm targets
in userspace.
diffstat:
sys/rump/dev/Makefile.rumpdev | 4 +-
sys/rump/dev/lib/libdm/Makefile | 19 ++++++++
sys/rump/dev/lib/libdm/component.c | 68 +++++++++++++++++++++++++++++
sys/rump/dev/lib/libdm/shlib_version | 4 +
sys/rump/librump/rumpdev/rump_dev.c | 6 +-
sys/rump/librump/rumpdev/rump_dev_private.h | 3 +-
6 files changed, 99 insertions(+), 5 deletions(-)
diffs (167 lines):
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/dev/Makefile.rumpdev
--- a/sys/rump/dev/Makefile.rumpdev Fri Dec 04 22:13:26 2009 +0000
+++ b/sys/rump/dev/Makefile.rumpdev Fri Dec 04 22:13:59 2009 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile.rumpdev,v 1.5 2009/10/11 11:26:40 pooka Exp $
+# $NetBSD: Makefile.rumpdev,v 1.6 2009/12/04 22:13:59 haad Exp $
#
-RUMPDEVLIST= cgd disk netsmb raidframe rnd
+RUMPDEVLIST= cgd disk netsmb raidframe rnd dm
.for var in ${RUMPDEVLIST}
RUMPDEVLIBS+=lib${var}
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/dev/lib/libdm/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/libdm/Makefile Fri Dec 04 22:13:59 2009 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1 2009/12/04 22:13:59 haad Exp $
+#
+
+.PATH: ${.CURDIR}/../../../../dev/dm
+
+LIB= rumpdev_dm
+
+SRCS= device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c dm_table.c dm_target.c \
+ dm_target_linear.c dm_target_stripe.c
+
+SRCS+= component.c
+
+CPPFLAGS+= -Wno-pointer-sign
+CPPFLAGS+= -I${RUMPTOP}/librump/rumpvfs
+
+LDADD+= -lrumpvfs
+
+.include <bsd.lib.mk>
+.include <bsd.klinks.mk>
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/dev/lib/libdm/component.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/libdm/component.c Fri Dec 04 22:13:59 2009 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: component.c,v 1.1 2009/12/04 22:13:59 haad Exp $ */
+
+/*
+ * Copyright (c) 2009 Antti Kantee. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/12/04 22:13:59 haad Exp $");
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/stat.h>
+#include <sys/filedesc.h>
+
+#include <sys/vfs_syscalls.h>
+
+
+#include "rump_dev_private.h"
+#include "rump_vfs_private.h"
+
+void dmattach(int);
+
+void
+rump_dev_dm_init()
+{
+ extern const struct bdevsw dm_bdevsw;
+ extern const struct cdevsw dm_cdevsw;
+ devmajor_t bmaj, cmaj;
+ int error;
+
+ /* go, mydevfs */
+ bmaj = cmaj = -1;
+
+ if ((error = devsw_attach("dm", &dm_bdevsw, &bmaj,
+ &dm_cdevsw, &cmaj)) != 0)
+ panic("cannot attach dm: %d", error);
+
+ do_sys_mkdir("/dev/mapper", 0770, UIO_SYSSPACE);
+
+ if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/mapper/control", 0,
+ cmaj, 0, 1)) != 0) {
+ panic("cannot create device-mapper control device: %d", error);
+
+ }
+ rump_pdev_add(dmattach, 1);
+}
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/dev/lib/libdm/shlib_version
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/dev/lib/libdm/shlib_version Fri Dec 04 22:13:59 2009 +0000
@@ -0,0 +1,4 @@
+# $NetBSD: shlib_version,v 1.1 2009/12/04 22:13:59 haad Exp $
+#
+major=0
+minor=0
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/librump/rumpdev/rump_dev.c
--- a/sys/rump/librump/rumpdev/rump_dev.c Fri Dec 04 22:13:26 2009 +0000
+++ b/sys/rump/librump/rumpdev/rump_dev.c Fri Dec 04 22:13:59 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_dev.c,v 1.8 2009/10/10 21:10:04 pooka Exp $ */
+/* $NetBSD: rump_dev.c,v 1.9 2009/12/04 22:13:59 haad Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.8 2009/10/10 21:10:04 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.9 2009/12/04 22:13:59 haad Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -36,6 +36,7 @@
void nocomponent(void);
void nocomponent() {}
__weak_alias(rump_dev_cgd_init,nocomponent);
+__weak_alias(rump_dev_dm_init,nocomponent);
__weak_alias(rump_dev_raidframe_init,nocomponent);
__weak_alias(rump_dev_netsmb_init,nocomponent);
__weak_alias(rump_dev_rnd_init,nocomponent);
@@ -55,6 +56,7 @@
config_init_mi();
rump_dev_cgd_init();
+ rump_dev_dm_init();
rump_dev_raidframe_init();
rump_dev_netsmb_init();
rump_dev_rnd_init();
diff -r 97664d252362 -r c29f83b3cdfb sys/rump/librump/rumpdev/rump_dev_private.h
--- a/sys/rump/librump/rumpdev/rump_dev_private.h Fri Dec 04 22:13:26 2009 +0000
+++ b/sys/rump/librump/rumpdev/rump_dev_private.h Fri Dec 04 22:13:59 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_dev_private.h,v 1.6 2009/10/03 19:06:36 pooka Exp $ */
+/* $NetBSD: rump_dev_private.h,v 1.7 2009/12/04 22:13:59 haad Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -34,6 +34,7 @@
void rump_pdev_finalize(void);
void rump_dev_cgd_init(void);
+void rump_dev_dm_init(void);
void rump_dev_raidframe_init(void);
void rump_dev_netsmb_init(void);
void rump_dev_rnd_init(void);
Home |
Main Index |
Thread Index |
Old Index