Module Name:    src
Committed By:   haad
Date:           Fri Dec  4 22:13:59 UTC 2009

Modified Files:
        src/sys/rump/dev: Makefile.rumpdev
        src/sys/rump/librump/rumpdev: rump_dev.c rump_dev_private.h
Added Files:
        src/sys/rump/dev/lib/libdm: Makefile component.c shlib_version

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/dev/Makefile.rumpdev
cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/lib/libdm/Makefile \
    src/sys/rump/dev/lib/libdm/component.c \
    src/sys/rump/dev/lib/libdm/shlib_version
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/librump/rumpdev/rump_dev.c
cvs rdiff -u -r1.6 -r1.7 src/sys/rump/librump/rumpdev/rump_dev_private.h

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/dev/Makefile.rumpdev
diff -u src/sys/rump/dev/Makefile.rumpdev:1.5 src/sys/rump/dev/Makefile.rumpdev:1.6
--- src/sys/rump/dev/Makefile.rumpdev:1.5	Sun Oct 11 11:26:40 2009
+++ src/sys/rump/dev/Makefile.rumpdev	Fri Dec  4 22:13:59 2009
@@ -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}

Index: src/sys/rump/librump/rumpdev/rump_dev.c
diff -u src/sys/rump/librump/rumpdev/rump_dev.c:1.8 src/sys/rump/librump/rumpdev/rump_dev.c:1.9
--- src/sys/rump/librump/rumpdev/rump_dev.c:1.8	Sat Oct 10 21:10:04 2009
+++ src/sys/rump/librump/rumpdev/rump_dev.c	Fri Dec  4 22:13:59 2009
@@ -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();

Index: src/sys/rump/librump/rumpdev/rump_dev_private.h
diff -u src/sys/rump/librump/rumpdev/rump_dev_private.h:1.6 src/sys/rump/librump/rumpdev/rump_dev_private.h:1.7
--- src/sys/rump/librump/rumpdev/rump_dev_private.h:1.6	Sat Oct  3 19:06:36 2009
+++ src/sys/rump/librump/rumpdev/rump_dev_private.h	Fri Dec  4 22:13:59 2009
@@ -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);

Added files:

Index: src/sys/rump/dev/lib/libdm/Makefile
diff -u /dev/null src/sys/rump/dev/lib/libdm/Makefile:1.1
--- /dev/null	Fri Dec  4 22:14:00 2009
+++ src/sys/rump/dev/lib/libdm/Makefile	Fri Dec  4 22:13:59 2009
@@ -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>
Index: src/sys/rump/dev/lib/libdm/component.c
diff -u /dev/null src/sys/rump/dev/lib/libdm/component.c:1.1
--- /dev/null	Fri Dec  4 22:14:00 2009
+++ src/sys/rump/dev/lib/libdm/component.c	Fri Dec  4 22:13:59 2009
@@ -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);
+}
Index: src/sys/rump/dev/lib/libdm/shlib_version
diff -u /dev/null src/sys/rump/dev/lib/libdm/shlib_version:1.1
--- /dev/null	Fri Dec  4 22:14:00 2009
+++ src/sys/rump/dev/lib/libdm/shlib_version	Fri Dec  4 22:13:59 2009
@@ -0,0 +1,4 @@
+#	$NetBSD: shlib_version,v 1.1 2009/12/04 22:13:59 haad Exp $
+#
+major=0
+minor=0

Reply via email to