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.
This commit is contained in:
parent
63d5a98148
commit
1d798011f9
|
@ -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}
|
||||
|
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# $NetBSD: shlib_version,v 1.1 2009/12/04 22:13:59 haad Exp $
|
||||
#
|
||||
major=0
|
||||
minor=0
|
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.8 2009/10/10 21:10:04 pooka Exp $");
|
|||
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 @@ rump_dev_init(void)
|
|||
config_init_mi();
|
||||
|
||||
rump_dev_cgd_init();
|
||||
rump_dev_dm_init();
|
||||
rump_dev_raidframe_init();
|
||||
rump_dev_netsmb_init();
|
||||
rump_dev_rnd_init();
|
||||
|
|
|
@ -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_add(void (*fn)(int), int);
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue