Add support for compiling ZFS and Solaris modules as RUMP libraries. Add

some locking and rumpcopy primitives and refactor module building Makefiles
to work with both RUMP and kernel modules. This is first part of adding
support for regular test of zfs on NetBSD to hunt some bugs and make it
stable.

Ok by pooka@.
This commit is contained in:
haad 2011-01-18 22:21:22 +00:00
parent 1a10f3f0aa
commit 61583090b2
18 changed files with 511 additions and 230 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: shl.mi,v 1.568 2011/01/18 20:09:38 pooka Exp $
# $NetBSD: shl.mi,v 1.569 2011/01/18 22:21:22 haad Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -534,12 +534,18 @@
./usr/lib/librumpfs_union.so base-rump-shlib
./usr/lib/librumpfs_union.so.0 base-rump-shlib
./usr/lib/librumpfs_union.so.0.0 base-rump-shlib
./usr/lib/librumpfs_zfs.so base-rump-shlib
./usr/lib/librumpfs_zfs.so.0 base-rump-shlib
./usr/lib/librumpfs_zfs.so.0.0 base-rump-shlib
./usr/lib/librumpkern_crypto.so base-rump-shlib
./usr/lib/librumpkern_crypto.so.0 base-rump-shlib
./usr/lib/librumpkern_crypto.so.0.0 base-rump-shlib
./usr/lib/librumpkern_ksem.so base-rump-shlib
./usr/lib/librumpkern_ksem.so.0 base-rump-shlib
./usr/lib/librumpkern_ksem.so.0.0 base-rump-shlib
./usr/lib/librumpkern_solaris.so base-rump-shlib
./usr/lib/librumpkern_solaris.so.0 base-rump-shlib
./usr/lib/librumpkern_solaris.so.0.0 base-rump-shlib
./usr/lib/librumpkern_tty.so base-rump-shlib
./usr/lib/librumpkern_tty.so.0 base-rump-shlib
./usr/lib/librumpkern_tty.so.0.0 base-rump-shlib

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1570 2011/01/18 21:07:51 pooka Exp $
# $NetBSD: mi,v 1.1571 2011/01/18 22:21:22 haad Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -2784,12 +2784,16 @@
./usr/lib/librumpfs_union.a comp-c-lib
./usr/lib/librumpfs_union_g.a -unknown- debuglib
./usr/lib/librumpfs_union_p.a comp-c-proflib profile
./usr/lib/librumpfs_zfs.a comp-c-lib
./usr/lib/librumpfs_zfs_p.a comp-c-piclib profile
./usr/lib/librumpkern_crypto.a comp-c-lib
./usr/lib/librumpkern_crypto_g.a -unknown- debuglib
./usr/lib/librumpkern_crypto_p.a comp-c-proflib profile
./usr/lib/librumpkern_ksem.a comp-c-lib
./usr/lib/librumpkern_ksem_g.a -unknown- debuglib
./usr/lib/librumpkern_ksem_p.a comp-c-proflib profile
./usr/lib/librumpkern_solaris.a comp-c-lib
./usr/lib/librumpkern_solaris_p.a comp-c-proflib profile
./usr/lib/librumpkern_tty.a comp-c-lib
./usr/lib/librumpkern_tty_g.a -unknown- debuglib
./usr/lib/librumpkern_tty_p.a comp-c-proflib profile

View File

@ -1,4 +1,4 @@
# $NetBSD: shl.mi,v 1.150 2011/01/18 21:07:52 pooka Exp $
# $NetBSD: shl.mi,v 1.151 2011/01/18 22:21:22 haad Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -147,8 +147,10 @@
./usr/lib/librumpfs_umap_pic.a comp-c-piclib
./usr/lib/librumpfs_umapfs_pic.a comp-obsolete obsolete
./usr/lib/librumpfs_union_pic.a comp-c-piclib
./usr/lib/librumpfs_zfs_pic.a comp-c-piclib
./usr/lib/librumpkern_crypto_pic.a comp-c-piclib
./usr/lib/librumpkern_ksem_pic.a comp-c-piclib
./usr/lib/librumpkern_solaris_pic.a comp-c-piclib
./usr/lib/librumpkern_tty_pic.a comp-c-piclib
./usr/lib/librumpkern_z_pic.a comp-c-piclib
./usr/lib/librumpnet_agr_pic.a comp-c-piclib
@ -336,8 +338,10 @@
./usr/libdata/debug/usr/lib/librumpfs_udf.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpfs_umap.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpfs_union.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpfs_zfs.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpkern_crypto.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpkern_ksem.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpkern_solaris.so.0.0.debug comp-rump-debuf debug
./usr/libdata/debug/usr/lib/librumpkern_tty.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpkern_z.so.0.0.debug comp-rump-debug debug
./usr/libdata/debug/usr/lib/librumpnet.so.0.0.debug comp-rump-debug debug

View File

@ -1,95 +1,8 @@
# $NetBSD: Makefile,v 1.4 2010/03/12 21:37:37 darran Exp $
# $NetBSD: Makefile,v 1.5 2011/01/18 22:21:22 haad Exp $
.include "../Makefile.inc"
CFLAGS+= -g -fno-inline
KMOD= solaris
ZFSDIR= ${S}/../external/cddl/osnet
.PATH: ${ZFSDIR}/dist/common/avl
SRCS= avl.c
.PATH: ${ZFSDIR}/dist/common/nvpair
SRCS+= nvpair.c
SRCS+= nvpair_alloc_fixed.c
.PATH: ${ZFSDIR}/dist/common/unicode
SRCS+= u8_textprep.c
.PATH: ${ZFSDIR}/dist/uts/common/os
SRCS+= fm.c
SRCS+= list.c
SRCS+= nvpair_alloc_system.c
.PATH: ${ZFSDIR}/dist/uts/common/rpc
SRCS+= xdr.c
SRCS+= xdr_array.c
SRCS+= xdr_mem.c
.PATH: ${ZFSDIR}/dist/uts/common/zmod
SRCS+= adler32.c
SRCS+= crc32.c
SRCS+= deflate.c
SRCS+= inffast.c
SRCS+= inflate.c
SRCS+= inftrees.c
SRCS+= trees.c
SRCS+= zmod.c
SRCS+= zmod_subr.c
SRCS+= zutil.c
.PATH: ${ZFSDIR}/dist/common/acl
SRCS+= acl_common.c
.PATH: ${ZFSDIR}/sys/kern
SRCS+= kobj.c
SRCS+= kstat.c
SRCS+= misc.c
SRCS+= policy.c
SRCS+= string.c
SRCS+= zone.c
SRCS+= callb.c
SRCS+= ddi.c
SRCS+= mod.c
SRCS+= printf.c
SRCS+= taskq.c
SRCS+= vfs.c
SRCS+= opensolaris.c
WARNS= 0
NOGCCERROR= yes
CWARNFLAGS+= -Wall
CWARNFLAGS+= -Wno-unknown-pragmas
CWARNFLAGS+= -Wno-missing-braces
CWARNFLAGS+= -Wno-parentheses
CWARNFLAGS+= -Wno-uninitialized
CWARNFLAGS+= -Wno-unused
CWARNFLAGS+= -Wno-switch
CWARNFLAGS+= -Wno-strict-prototypes
CWARNFLAGS+= -Wno-missing-prototypes
CWARNFLAGS+= -Wno-format
CPPFLAGS+= -I${ZFSDIR}/sys
CPPFLAGS+= -I${ZFSDIR}/dist/common/acl
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zmod
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -I${ZFSDIR}/sys/sys
CPPFLAGS+= -Dcaddr_t=__caddr_t "-D__va_list=va_list"
CPPFLAGS+= -std=c99
# CPPFLAGS+= -D_NFS_NFS_H_
# CPPFLAGS+= -D_PROPLIB_ZFS_CONFLICT
CFLAGS+= -g -O0 -DDIAGNOSTIC
.include "Makefile.solmod"
.include <bsd.kmodule.mk>

View File

@ -0,0 +1,90 @@
# $NetBSD: Makefile.solmod,v 1.1 2011/01/18 22:21:22 haad Exp $
CFLAGS+= -g -fno-inline
ZFSDIR= ${S}/../external/cddl/osnet
.PATH: ${ZFSDIR}/dist/common/avl
SRCS= avl.c
.PATH: ${ZFSDIR}/dist/common/nvpair
SRCS+= nvpair.c
SRCS+= nvpair_alloc_fixed.c
.PATH: ${ZFSDIR}/dist/common/unicode
SRCS+= u8_textprep.c
.PATH: ${ZFSDIR}/dist/uts/common/os
SRCS+= fm.c
SRCS+= list.c
SRCS+= nvpair_alloc_system.c
.PATH: ${ZFSDIR}/dist/uts/common/rpc
SRCS+= xdr.c
SRCS+= xdr_array.c
SRCS+= xdr_mem.c
.PATH: ${ZFSDIR}/dist/uts/common/zmod
SRCS+= adler32.c
SRCS+= crc32.c
SRCS+= deflate.c
SRCS+= inffast.c
SRCS+= inflate.c
SRCS+= inftrees.c
SRCS+= trees.c
SRCS+= zmod.c
SRCS+= zmod_subr.c
SRCS+= zutil.c
.PATH: ${ZFSDIR}/dist/common/acl
SRCS+= acl_common.c
.PATH: ${ZFSDIR}/sys/kern
SRCS+= kobj.c
SRCS+= kstat.c
SRCS+= misc.c
SRCS+= policy.c
SRCS+= string.c
SRCS+= zone.c
SRCS+= callb.c
SRCS+= ddi.c
SRCS+= mod.c
SRCS+= printf.c
SRCS+= taskq.c
SRCS+= vfs.c
SRCS+= opensolaris.c
WARNS= 0
NOGCCERROR= yes
CWARNFLAGS+= -Wall
CWARNFLAGS+= -Wno-unknown-pragmas
CWARNFLAGS+= -Wno-missing-braces
CWARNFLAGS+= -Wno-parentheses
CWARNFLAGS+= -Wno-uninitialized
CWARNFLAGS+= -Wno-unused
CWARNFLAGS+= -Wno-switch
CWARNFLAGS+= -Wno-strict-prototypes
CWARNFLAGS+= -Wno-missing-prototypes
CWARNFLAGS+= -Wno-format
CPPFLAGS+= -I${ZFSDIR}/sys
CPPFLAGS+= -I${ZFSDIR}/dist/common/acl
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zmod
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -I${ZFSDIR}/sys/sys
CPPFLAGS+= -Dcaddr_t=__caddr_t "-D__va_list=va_list"
CPPFLAGS+= -std=c99
# CPPFLAGS+= -D_NFS_NFS_H_
# CPPFLAGS+= -D_PROPLIB_ZFS_CONFLICT
CFLAGS+= -g -O0 -DDIAGNOSTIC

View File

@ -1,136 +1,8 @@
# $NetBSD: Makefile,v 1.3 2010/02/28 15:22:16 haad Exp $
# $NetBSD: Makefile,v 1.4 2011/01/18 22:21:22 haad Exp $
.include "../Makefile.inc"
KMOD= zfs
ZFSDIR= ${S}/../external/cddl/osnet
.PATH: ${ZFSDIR}/dist/common/zfs
SRCS+= zfs_comutil.c
SRCS+= zfs_deleg.c
SRCS+= zfs_fletcher.c
SRCS+= zfs_namecheck.c
SRCS+= zfs_prop.c
SRCS+= zpool_prop.c
SRCS+= zprop_common.c
.PATH: ${ZFSDIR}/dist/uts/common/fs
#SRCS+= gfs.c
.PATH: ${ZFSDIR}/dist/uts/common/zmod
SRCS+= trees.c
.PATH: ${ZFSDIR}/dist/uts/common/fs/zfs
SRCS+= arc.c
SRCS+= bplist.c
SRCS+= dbuf.c
SRCS+= ddt.c
SRCS+= ddt_zap.c
SRCS+= dmu.c
SRCS+= dmu_object.c
SRCS+= dmu_objset.c
SRCS+= dmu_send.c
SRCS+= dmu_traverse.c
SRCS+= dmu_tx.c
SRCS+= dmu_zfetch.c
SRCS+= dnode.c
SRCS+= dnode_sync.c
SRCS+= dsl_dataset.c
SRCS+= dsl_deleg.c
SRCS+= dsl_dir.c
SRCS+= dsl_pool.c
SRCS+= dsl_prop.c
SRCS+= dsl_scrub.c
SRCS+= dsl_synctask.c
SRCS+= gzip.c
SRCS+= lzjb.c
SRCS+= metaslab.c
SRCS+= refcount.c
SRCS+= rrwlock.c
SRCS+= sha256.c
SRCS+= spa.c
SRCS+= spa_config.c
SRCS+= spa_errlog.c
SRCS+= spa_history.c
SRCS+= spa_misc.c
SRCS+= space_map.c
SRCS+= txg.c
SRCS+= uberblock.c
SRCS+= unique.c
SRCS+= vdev.c
SRCS+= vdev_cache.c
SRCS+= vdev_disk.c
SRCS+= vdev_file.c
SRCS+= vdev_label.c
SRCS+= vdev_mirror.c
SRCS+= vdev_missing.c
SRCS+= vdev_queue.c
SRCS+= vdev_raidz.c
SRCS+= vdev_root.c
SRCS+= zap.c
SRCS+= zap_leaf.c
SRCS+= zap_micro.c
SRCS+= zfs_byteswap.c
#SRCS+= zfs_ctldir.c
SRCS+= zfs_dir.c
SRCS+= zfs_fuid.c
SRCS+= zfs_fm.c
SRCS+= zfs_ioctl.c
SRCS+= zfs_log.c
SRCS+= zfs_replay.c
SRCS+= zfs_rlock.c
SRCS+= zfs_vfsops.c
SRCS+= zfs_vnops.c
SRCS+= zfs_znode.c
SRCS+= zfs_acl.c
SRCS+= zil.c
SRCS+= zio.c
SRCS+= zio_checksum.c
SRCS+= zio_compress.c
SRCS+= zio_inject.c
SRCS+= zutil.c
SRCS+= zvol.c
SRCS+= zle.c
.PATH: ${ZFSDIR}/sys/kern
SRCS+= zfs_stub.c
WARNS= 0
NOGCCERROR= yes
CWARNFLAGS+= -Wall
CWARNFLAGS+= -Wno-unknown-pragmas
CWARNFLAGS+= -Wno-missing-braces
CWARNFLAGS+= -Wno-parentheses
CWARNFLAGS+= -Wno-uninitialized
CWARNFLAGS+= -Wno-unused
CWARNFLAGS+= -Wno-switch
CWARNFLAGS+= -Wno-strict-prototypes
CWARNFLAGS+= -Wno-missing-prototypes
CWARNFLAGS+= -Wno-format
CPPFLAGS+= -I${ZFSDIR}/sys
CPPFLAGS+= -I${ZFSDIR}/dist/common
CPPFLAGS+= -I${ZFSDIR}/dist/common/acl
CPPFLAGS+= -I${ZFSDIR}/dist/common/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/fs/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zmod
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -Dcaddr_t=__caddr_t "-D__va_list=va_list" -D__NetBSD__
CPPFLAGS+= -std=c99
CPPFLAGS+= -D_NFS_NFS_H_
CPPFLAGS+= -D_PROPLIB_ZFS_CONFLICT
CFLAGS+= -DDIAGNOSTIC -g -O0
# -DZFS_DEBUG
.include "Makefile.zfsmod"
.include <bsd.kmodule.mk>

View File

@ -0,0 +1,130 @@
# $NetBSD: Makefile.zfsmod,v 1.1 2011/01/18 22:21:22 haad Exp $
ZFSDIR= ${S}/../external/cddl/osnet
.PATH: ${ZFSDIR}/dist/common/zfs
SRCS+= zfs_comutil.c
SRCS+= zfs_deleg.c
SRCS+= zfs_fletcher.c
SRCS+= zfs_namecheck.c
SRCS+= zfs_prop.c
SRCS+= zpool_prop.c
SRCS+= zprop_common.c
.PATH: ${ZFSDIR}/dist/uts/common/fs
#SRCS+= gfs.c
.PATH: ${ZFSDIR}/dist/uts/common/zmod
SRCS+= trees.c
.PATH: ${ZFSDIR}/dist/uts/common/fs/zfs
SRCS+= arc.c
SRCS+= bplist.c
SRCS+= dbuf.c
SRCS+= ddt.c
SRCS+= ddt_zap.c
SRCS+= dmu.c
SRCS+= dmu_object.c
SRCS+= dmu_objset.c
SRCS+= dmu_send.c
SRCS+= dmu_traverse.c
SRCS+= dmu_tx.c
SRCS+= dmu_zfetch.c
SRCS+= dnode.c
SRCS+= dnode_sync.c
SRCS+= dsl_dataset.c
SRCS+= dsl_deleg.c
SRCS+= dsl_dir.c
SRCS+= dsl_pool.c
SRCS+= dsl_prop.c
SRCS+= dsl_scrub.c
SRCS+= dsl_synctask.c
SRCS+= gzip.c
SRCS+= lzjb.c
SRCS+= metaslab.c
SRCS+= refcount.c
SRCS+= rrwlock.c
SRCS+= sha256.c
SRCS+= spa.c
SRCS+= spa_config.c
SRCS+= spa_errlog.c
SRCS+= spa_history.c
SRCS+= spa_misc.c
SRCS+= space_map.c
SRCS+= txg.c
SRCS+= uberblock.c
SRCS+= unique.c
SRCS+= vdev.c
SRCS+= vdev_cache.c
SRCS+= vdev_disk.c
SRCS+= vdev_file.c
SRCS+= vdev_label.c
SRCS+= vdev_mirror.c
SRCS+= vdev_missing.c
SRCS+= vdev_queue.c
SRCS+= vdev_raidz.c
SRCS+= vdev_root.c
SRCS+= zap.c
SRCS+= zap_leaf.c
SRCS+= zap_micro.c
SRCS+= zfs_byteswap.c
#SRCS+= zfs_ctldir.c
SRCS+= zfs_dir.c
SRCS+= zfs_fuid.c
SRCS+= zfs_fm.c
SRCS+= zfs_ioctl.c
SRCS+= zfs_log.c
SRCS+= zfs_replay.c
SRCS+= zfs_rlock.c
SRCS+= zfs_vfsops.c
SRCS+= zfs_vnops.c
SRCS+= zfs_znode.c
SRCS+= zfs_acl.c
SRCS+= zil.c
SRCS+= zio.c
SRCS+= zio_checksum.c
SRCS+= zio_compress.c
SRCS+= zio_inject.c
SRCS+= zutil.c
SRCS+= zvol.c
SRCS+= zle.c
.PATH: ${ZFSDIR}/sys/kern
SRCS+= zfs_stub.c
WARNS= 0
NOGCCERROR= yes
CWARNFLAGS+= -Wall
CWARNFLAGS+= -Wno-unknown-pragmas
CWARNFLAGS+= -Wno-missing-braces
CWARNFLAGS+= -Wno-parentheses
CWARNFLAGS+= -Wno-uninitialized
CWARNFLAGS+= -Wno-unused
CWARNFLAGS+= -Wno-switch
CWARNFLAGS+= -Wno-strict-prototypes
CWARNFLAGS+= -Wno-missing-prototypes
CWARNFLAGS+= -Wno-format
CPPFLAGS+= -I${ZFSDIR}/sys
CPPFLAGS+= -I${ZFSDIR}/dist/common
CPPFLAGS+= -I${ZFSDIR}/dist/common/acl
CPPFLAGS+= -I${ZFSDIR}/dist/common/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/fs/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zmod
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zfs
CPPFLAGS+= -I${ZFSDIR}/dist/uts/common
CPPFLAGS+= -Dcaddr_t=__caddr_t "-D__va_list=va_list" -D__NetBSD__
CPPFLAGS+= -std=c99
CPPFLAGS+= -D_NFS_NFS_H_
CPPFLAGS+= -D_PROPLIB_ZFS_CONFLICT
CFLAGS+= -DDIAGNOSTIC -g -O0
# -DZFS_DEBUG

View File

@ -1,10 +1,15 @@
# $NetBSD: Makefile.rumpfscomp,v 1.1 2010/12/05 16:53:46 pooka Exp $
# $NetBSD: Makefile.rumpfscomp,v 1.2 2011/01/18 22:21:23 haad Exp $
#
RUMPFSCOMP= cd9660 efs ext2fs fdesc ffs hfs kernfs lfs mfs msdos \
nfs nilfs ntfs null ptyfs smbfs syspuffs sysvbfs \
tmpfs udf umap union
.if ${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "x86_64"
RUMPFSCOMP+= zfs
.endif
RUMPFSCOMP+= nfsserver
RUMPVFSCOMP+= fifo layer

View File

@ -0,0 +1,17 @@
# $NetBSD: Makefile,v 1.1 2011/01/18 22:21:23 haad Exp $
#
S!= cd ${.PARSEDIR}/../../../../;pwd
.include "${.CURDIR}/../../../../modules/zfs/Makefile.zfsmod"
LIB= rumpfs_zfs
# RUMP stuff
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs\
-I${RUMPTOP}/librump/rumpdev
SRCS+= component.c
.include <bsd.lib.mk>
.include <bsd.klinks.mk>

View File

@ -0,0 +1,110 @@
/* $NetBSD: component.c,v 1.1 2011/01/18 22:21:23 haad Exp $ */
/*
* Copyright (c) 2010 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 2011/01/18 22:21:23 haad Exp $");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <sys/buf.h>
#include <sys/modctl.h>
#include <sys/open.h>
#include <sys/file.h>
#include <sys/kmem.h>
#include <sys/conf.h>
#include <sys/cmn_err.h>
#include <sys/stat.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_znode.h>
#include <sys/zap.h>
#include <sys/spa.h>
#include <sys/spa_impl.h>
#include <sys/vdev.h>
#include <sys/priv_impl.h>
#include <sys/dmu.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_deleg.h>
#include <sys/dmu_objset.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/sunldi.h>
#include <sys/policy.h>
#include <sys/zone.h>
#include <sys/nvpair.h>
#include <sys/pathname.h>
#include <sys/mount.h>
#include <sys/sdt.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_dir.h>
#include <sys/zvol.h>
#include <sharefs/share.h>
#include <sys/dmu_objset.h>
#include <sys/callb.h>
#include <sys/taskq.h>
#include "rump_private.h"
#include "rump_dev_private.h"
#include "rump_vfs_private.h"
RUMP_COMPONENT(RUMP_COMPONENT_KERN_VFS)
{
int error;
extern int physmem;
extern uint_t zfs_fsyncer_key;
extern uint_t rrw_tsd_key;
extern const struct bdevsw zfs_bdevsw;
extern const struct cdevsw zfs_cdevsw;
static int zfs_bmajor = -1;
static int zfs_cmajor = -1;
/* Set physmem to fit zfs limits. ZFS_MINMEGS * 2048 / PAGE_SIZE */
physmem = 262144;
error = devsw_attach("zfs", &zfs_bdevsw, &zfs_bmajor,
&zfs_cdevsw, &zfs_cmajor);
if (error != 0) {
zvol_fini();
zfs_vfsfini();
spa_fini();
lwp_specific_key_delete(zfs_fsyncer_key);
lwp_specific_key_delete(rrw_tsd_key);
}
return;
}

View File

@ -0,0 +1,4 @@
# $NetBSD: shlib_version,v 1.1 2011/01/18 22:21:23 haad Exp $
#
major=0
minor=0

View File

@ -1,8 +1,13 @@
# $NetBSD: Makefile.rumpkerncomp,v 1.2 2010/12/05 20:11:22 pooka Exp $
# $NetBSD: Makefile.rumpkerncomp,v 1.3 2011/01/18 22:21:23 haad Exp $
#
RUMPKERNCOMPS= crypto ksem tty z
.if ${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "x86_64"
RUMPKERNCOMPS+= solaris
.endif
.for var in ${RUMPKERNCOMPS}
RUMPKERNLIBS+=lib${var}
RUMPKERNLDADD+=-lrumpkern_${var}

View File

@ -0,0 +1,18 @@
# $NetBSD: Makefile,v 1.1 2011/01/18 22:21:23 haad Exp $
#
S!= cd ${.PARSEDIR}/../../../../;pwd
.include "${.CURDIR}/../../../../modules/solaris/Makefile.solmod"
LIB= rumpkern_solaris
# RUMP Stuff
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs\
-I${RUMPTOP}/librump/rumpdev
CPPFLAGS+= -DASSERT=KASSERT
SRCS+= component.c
.include <bsd.lib.mk>
.include <bsd.klinks.mk>

View File

@ -0,0 +1,54 @@
/* $NetBSD: component.c,v 1.1 2011/01/18 22:21:23 haad Exp $ */
/*
* Copyright (c) 2010 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 2011/01/18 22:21:23 haad Exp $");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/kthread.h>
#include <sys/callb.h>
#include "rump_private.h"
#include "rump_vfs_private.h"
void opensolaris_init(void *);
void opensolaris_fini(void *);
RUMP_COMPONENT(RUMP_COMPONENT_KERN_VFS)
{
extern void taskq_init(void);
extern void taskq_fini(void);
callb_init(NULL);
taskq_init();
opensolaris_init(NULL);
return;
}

View File

@ -0,0 +1,4 @@
# $NetBSD: shlib_version,v 1.1 2011/01/18 22:21:23 haad Exp $
#
major=0
minor=0

View File

@ -1,4 +1,4 @@
/* $NetBSD: locks.c,v 1.47 2011/01/12 12:51:21 pooka Exp $ */
/* $NetBSD: locks.c,v 1.48 2011/01/18 22:21:23 haad Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.47 2011/01/12 12:51:21 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.48 2011/01/18 22:21:23 haad Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -221,6 +221,21 @@ rw_tryupgrade(krwlock_t *rw)
return 0;
}
void
rw_downgrade(krwlock_t *rw)
{
#ifdef LOCKDEBUG
KASSERT(!rw_write_held(rw));
#endif
/*
* XXX HACK: How we can downgrade re lock in rump properly.
*/
rw_exit(rw);
rw_enter(rw, RW_READER);
return;
}
int
rw_write_held(krwlock_t *rw)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpcopy.c,v 1.16 2011/01/13 15:38:29 pooka Exp $ */
/* $NetBSD: rumpcopy.c,v 1.17 2011/01/18 22:21:23 haad Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.16 2011/01/13 15:38:29 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.17 2011/01/18 22:21:23 haad Exp $");
#include <sys/param.h>
#include <sys/lwp.h>
@ -206,3 +206,19 @@ uvm_io(struct vm_map *vm, struct uio *uio)
return error;
}
/*
* Copy one byte from userspace to kernel.
*/
int
fubyte(const void *base)
{
unsigned char val;
int error;
error = copyin(base, &val, sizeof(char));
if (error != 0)
return -1;
return (int)val;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm.c,v 1.106 2011/01/13 15:38:29 pooka Exp $ */
/* $NetBSD: vm.c,v 1.107 2011/01/18 22:21:23 haad Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.106 2011/01/13 15:38:29 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.107 2011/01/18 22:21:23 haad Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@ -342,6 +342,20 @@ uvm_pageunwire(struct vm_page *pg)
/* nada */
}
void
uvm_reclaim_hook_add(struct uvm_reclaim_hook *hook_entry)
{
/* nada */
}
void
uvm_reclaim_hook_del(struct uvm_reclaim_hook *hook_entry)
{
/* nada */
}
/* where's your schmonz now? */
#define PUNLIMIT(a) \
p->p_rlimit[a].rlim_cur = p->p_rlimit[a].rlim_max = RLIM_INFINITY;