CVS commit: src/sys/kern
Module Name:src Committed By: haad Date: Thu Aug 13 08:57:43 UTC 2009 Modified Files: src/sys/kern: sys_generic.c Log Message: Allow undescribed, direct ioctls as used by Unix. This capability was removed in BSD, presumably because nothing used it any more. Third party system software written for Unix (like ZFS) requires this to work without significant modifications. Ok supremeleader@ To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/kern/sys_generic.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/kern/sys_generic.c diff -u src/sys/kern/sys_generic.c:1.123 src/sys/kern/sys_generic.c:1.124 --- src/sys/kern/sys_generic.c:1.123 Sun May 24 21:41:26 2009 +++ src/sys/kern/sys_generic.c Thu Aug 13 08:57:43 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_generic.c,v 1.123 2009/05/24 21:41:26 ad Exp $ */ +/* $NetBSD: sys_generic.c,v 1.124 2009/08/13 08:57:43 haad Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.123 2009/05/24 21:41:26 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.124 2009/08/13 08:57:43 haad Exp $"); #include #include @@ -565,31 +565,40 @@ goto out; } memp = NULL; - if (size > sizeof(stkbuf)) { - memp = kmem_alloc(size, KM_SLEEP); - data = memp; - } else - data = (void *)stkbuf; - if (com&IOC_IN) { - if (size) { - error = copyin(SCARG(uap, data), data, size); - if (error) { -if (memp) - kmem_free(memp, size); -goto out; + if ((com >> IOCPARM_SHIFT) == 0) { + /* UNIX-style ioctl. */ + data = SCARG(uap, data); + } else { + if (size > sizeof(stkbuf)) { + memp = kmem_alloc(size, KM_SLEEP); + data = memp; + } else { + data = (void *)stkbuf; + } + if (com&IOC_IN) { + if (size) { +error = copyin(SCARG(uap, data), data, size); +if (error) { + if (memp) { + kmem_free(memp, size); + } + goto out; +} +ktrgenio(SCARG(uap, fd), UIO_WRITE, +SCARG(uap, data), size, 0); + } else { +*(void **)data = SCARG(uap, data); } - ktrgenio(SCARG(uap, fd), UIO_WRITE, SCARG(uap, data), - size, 0); - } else + } else if ((com&IOC_OUT) && size) { + /* + * Zero the buffer so the user always + * gets back something deterministic. + */ + memset(data, 0, size); + } else if (com&IOC_VOID) { *(void **)data = SCARG(uap, data); - } else if ((com&IOC_OUT) && size) - /* - * Zero the buffer so the user always - * gets back something deterministic. - */ - memset(data, 0, size); - else if (com&IOC_VOID) - *(void **)data = SCARG(uap, data); + } + } switch (com) {
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Wed Sep 9 22:38:49 UTC 2009 Modified Files: src/sys/dev/dm: dm_dev.c dm_ioctl.c dm_pdev.c dm_target.c dm_target_linear.c dm_target_stripe.c Log Message: Fix bug in kmem_alloc/kmem_free of params string. Params string was allocated with length DM_MAX_PARAMS_SIZE and released with strlen + 1 size. Disable KM_NOSLEEP allocation because we do not need them here there is nothing critical in ioctl part of dm driver. Bug reported by j...@. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/dm_dev.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_ioctl.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dm/dm_pdev.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_target.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/dm/dm_target_linear.c \ src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm_dev.c diff -u src/sys/dev/dm/dm_dev.c:1.5 src/sys/dev/dm/dm_dev.c:1.6 --- src/sys/dev/dm/dm_dev.c:1.5 Mon Apr 13 18:51:54 2009 +++ src/sys/dev/dm/dm_dev.c Wed Sep 9 22:38:49 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_dev.c,v 1.5 2009/04/13 18:51:54 haad Exp $ */ +/*$NetBSD: dm_dev.c,v 1.6 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -304,10 +304,10 @@ { dm_dev_t *dmv; - dmv = kmem_zalloc(sizeof(dm_dev_t), KM_NOSLEEP); + dmv = kmem_zalloc(sizeof(dm_dev_t), KM_SLEEP); if(dmv != NULL) - dmv->diskp = kmem_zalloc(sizeof(struct disk), KM_NOSLEEP); + dmv->diskp = kmem_zalloc(sizeof(struct disk), KM_SLEEP); return dmv; } Index: src/sys/dev/dm/dm_ioctl.c diff -u src/sys/dev/dm/dm_ioctl.c:1.13 src/sys/dev/dm/dm_ioctl.c:1.14 --- src/sys/dev/dm/dm_ioctl.c:1.13 Fri Jun 5 21:52:31 2009 +++ src/sys/dev/dm/dm_ioctl.c Wed Sep 9 22:38:49 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_ioctl.c,v 1.13 2009/06/05 21:52:31 haad Exp $ */ +/*$NetBSD: dm_ioctl.c,v 1.14 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -746,7 +746,7 @@ } if ((table_en = kmem_alloc(sizeof(dm_table_entry_t), - KM_NOSLEEP)) == NULL) { + KM_SLEEP)) == NULL) { dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE); dm_dev_unbusy(dmv); return ENOMEM; @@ -913,7 +913,7 @@ prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, params); -kmem_free(params, strlen(params) + 1); +kmem_free(params, DM_MAX_PARAMS_SIZE); } } Index: src/sys/dev/dm/dm_pdev.c diff -u src/sys/dev/dm/dm_pdev.c:1.3 src/sys/dev/dm/dm_pdev.c:1.4 --- src/sys/dev/dm/dm_pdev.c:1.3 Wed Mar 18 10:22:39 2009 +++ src/sys/dev/dm/dm_pdev.c Wed Sep 9 22:38:49 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_pdev.c,v 1.3 2009/03/18 10:22:39 cegger Exp $ */ +/*$NetBSD: dm_pdev.c,v 1.4 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -141,7 +141,7 @@ { dm_pdev_t *dmp; - if ((dmp = kmem_zalloc(sizeof(dm_pdev_t), KM_NOSLEEP)) == NULL) + if ((dmp = kmem_zalloc(sizeof(dm_pdev_t), KM_SLEEP)) == NULL) return NULL; strlcpy(dmp->name, name, MAX_DEV_NAME); Index: src/sys/dev/dm/dm_target.c diff -u src/sys/dev/dm/dm_target.c:1.10 src/sys/dev/dm/dm_target.c:1.11 --- src/sys/dev/dm/dm_target.c:1.10 Sun Aug 16 11:02:40 2009 +++ src/sys/dev/dm/dm_target.c Wed Sep 9 22:38:49 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target.c,v 1.10 2009/08/16 11:02:40 yamt Exp $ */ +/*$NetBSD: dm_target.c,v 1.11 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -238,7 +238,7 @@ dm_target_t* dm_target_alloc(const char *name) { - return kmem_zalloc(sizeof(dm_target_t), KM_NOSLEEP); + return kmem_zalloc(sizeof(dm_target_t), KM_SLEEP); } /* Index: src/sys/dev/dm/dm_target_linear.c diff -u src/sys/dev/dm/dm_target_linear.c:1.6 src/sys/dev/dm/dm_target_linear.c:1.7 --- src/sys/dev/dm/dm_target_linear.c:1.6 Sun Aug 16 11:02:24 2009 +++ src/sys/dev/dm/dm_target_linear.c Wed Sep 9 22:38:49 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target_linear.c,v 1.6 2009/08/16 11:02:24 yamt Exp $ */ +/*$NetBSD: dm_target_linear.c,v 1.7 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ aprint_debug("Linear target init function called %s--%"PRIu64"!!\n", device, offset); - if ((tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_NOSLEEP)) + if ((tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_SLEEP)) == NULL) return 1; @@ -109,7 +109,7 @@ aprint_debug("Linear target status function called\n"); - if ((params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_NOSLEEP)) == NULL) + if ((params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_SLEEP)) == NULL) return NULL; aprint_normal("%s %"PRIu64, tlc->pd
CVS commit: src/external/cddl/osnet/dist/cmd/ztest
Module Name:src Committed By: haad Date: Tue Sep 15 01:48:41 UTC 2009 Modified Files: src/external/cddl/osnet/dist/cmd/ztest: ztest.c Log Message: On i386 use 32bit version of atomic_add_op because 64 doesn't work on i486 userland. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/cddl/osnet/dist/cmd/ztest/ztest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/cmd/ztest/ztest.c diff -u src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.1.1.1 src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.2 --- src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.1.1.1 Fri Aug 7 18:32:25 2009 +++ src/external/cddl/osnet/dist/cmd/ztest/ztest.c Tue Sep 15 01:48:41 2009 @@ -2983,10 +2983,13 @@ (double)zi->zi_call_total / zi->zi_call_target > (double)(now - zs->zs_start_time) / (zopt_time * NANOSEC)) continue; - +#ifdef __HAVE_ATOMIC64_OPS atomic_add_64(&zi->zi_calls, 1); atomic_add_64(&zi->zi_call_total, 1); - +#else + atomic_add_32(&zi->zi_calls, 1); + atomic_add_32(&zi->zi_call_total, 1); +#end za->za_diroff = (za->za_instance * ZTEST_FUNCS + f) * ZTEST_DIRSIZE; za->za_diroff_shared = (1ULL << 63); @@ -2995,9 +2998,11 @@ zi->zi_func(za); functime = gethrtime() - now; - +#ifdef __HAVE_ATOMIC64_OPS atomic_add_64(&zi->zi_call_time, functime); - +#else + atomic_add_32(&zi->zi_call_time, functime); +#endif if (zopt_verbose >= 4) { Dl_info dli; (void) dladdr((void *)zi->zi_func, &dli);
CVS commit: src/external/cddl/osnet/dist/cmd/ztest
Module Name:src Committed By: haad Date: Tue Sep 15 02:04:12 UTC 2009 Modified Files: src/external/cddl/osnet/dist/cmd/ztest: ztest.c Log Message: Revert my last wrong change this will need more work. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/cmd/ztest/ztest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/cmd/ztest/ztest.c diff -u src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.2 src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.3 --- src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.2 Tue Sep 15 01:48:41 2009 +++ src/external/cddl/osnet/dist/cmd/ztest/ztest.c Tue Sep 15 02:04:12 2009 @@ -2983,13 +2983,10 @@ (double)zi->zi_call_total / zi->zi_call_target > (double)(now - zs->zs_start_time) / (zopt_time * NANOSEC)) continue; -#ifdef __HAVE_ATOMIC64_OPS + atomic_add_64(&zi->zi_calls, 1); atomic_add_64(&zi->zi_call_total, 1); -#else - atomic_add_32(&zi->zi_calls, 1); - atomic_add_32(&zi->zi_call_total, 1); -#end + za->za_diroff = (za->za_instance * ZTEST_FUNCS + f) * ZTEST_DIRSIZE; za->za_diroff_shared = (1ULL << 63); @@ -2998,11 +2995,9 @@ zi->zi_func(za); functime = gethrtime() - now; -#ifdef __HAVE_ATOMIC64_OPS + atomic_add_64(&zi->zi_call_time, functime); -#else - atomic_add_32(&zi->zi_call_time, functime); -#endif + if (zopt_verbose >= 4) { Dl_info dli; (void) dladdr((void *)zi->zi_func, &dli);
CVS commit: src/external/cddl/osnet/usr.bin/ztest
Module Name:src Committed By: haad Date: Wed Sep 16 09:17:29 UTC 2009 Modified Files: src/external/cddl/osnet/usr.bin/ztest: Makefile Log Message: Remove bogus -L entry. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/usr.bin/ztest/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/usr.bin/ztest/Makefile diff -u src/external/cddl/osnet/usr.bin/ztest/Makefile:1.1 src/external/cddl/osnet/usr.bin/ztest/Makefile:1.2 --- src/external/cddl/osnet/usr.bin/ztest/Makefile:1.1 Fri Aug 7 20:57:59 2009 +++ src/external/cddl/osnet/usr.bin/ztest/Makefile Wed Sep 16 09:17:29 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2009/08/07 20:57:59 haad Exp $ +# $NetBSD: Makefile,v 1.2 2009/09/16 09:17:29 haad Exp $ .include "../../Makefile.zfs" @@ -8,8 +8,6 @@ DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} ${LIBPTHREAD} \ ${LIBZ} ${LIBAVL} -LDADD+=-Lhehehe - LIBAVL_OBJDIR!= cd ${LIBAVL_SRCDIR} && ${PRINTOBJDIR} LDADD+= -L${LIBAVL_OBJDIR} -lavl
CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common
Module Name:src Committed By: haad Date: Mon Oct 5 16:25:27 UTC 2009 Modified Files: src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_pool.c Log Message: Disable *at functions for now. These functions should be implemented because they are part of POSIX standard but it seems to be a long time process. XXX. This commit should be reverted after adding support for openat and fstatat. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.1.1.1 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.2 --- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.1.1.1 Fri Aug 7 18:32:46 2009 +++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c Mon Oct 5 16:25:27 2009 @@ -2092,20 +2092,23 @@ libzfs_handle_t *hdl = zhp->zpool_hdl; char (*paths)[MAXPATHLEN]; size_t size = 4; - int curr, fd, base, ret = 0; + int curr, base, ret = 0; +#ifdef PORT_NETBSD + int fd; DIR *dirp; struct dirent *dp; +#endif struct stat st; if ((base = open("/dev/zvol/dsk", O_RDONLY)) < 0) return (errno == ENOENT ? 0 : -1); - +#ifdef PORT_NETBSD if (fstatat(base, zhp->zpool_name, &st, 0) != 0) { int err = errno; (void) close(base); return (err == ENOENT ? 0 : -1); } - +#endif /* * Oddly this wasn't a directory -- ignore that failure since we * know there are no links lower in the (non-existant) hierarchy. @@ -2122,7 +2125,8 @@ (void) strlcpy(paths[0], zhp->zpool_name, sizeof (paths[0])); curr = 0; - + +#ifdef PORT_NETBSD while (curr >= 0) { if (fstatat(base, paths[curr], &st, AT_SYMLINK_NOFOLLOW) != 0) goto err; @@ -2171,7 +2175,8 @@ curr--; } - +#endif /* PORT_NETBSD */ + free(paths); (void) close(base);
CVS commit: src
Module Name:src Committed By: haad Date: Mon Oct 5 22:32:58 UTC 2009 Modified Files: src/distrib/sets/lists/base: mi shl.mi src/distrib/sets/lists/man: mi src/distrib/sets/lists/modules: mi src/share/mk: bsd.README bsd.own.mk src/sys/modules: Makefile Log Message: Add zfs sets and needed veriables to hook zfs into the build. ZFS on i386 need still one fix othervise it should be ready for testing. To generate a diff of this commit: cvs rdiff -u -r1.831 -r1.832 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.496 -r1.497 src/distrib/sets/lists/base/shl.mi cvs rdiff -u -r1.1161 -r1.1162 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/modules/mi cvs rdiff -u -r1.253 -r1.254 src/share/mk/bsd.README cvs rdiff -u -r1.584 -r1.585 src/share/mk/bsd.own.mk cvs rdiff -u -r1.33 -r1.34 src/sys/modules/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.831 src/distrib/sets/lists/base/mi:1.832 --- src/distrib/sets/lists/base/mi:1.831 Tue Sep 29 23:56:26 2009 +++ src/distrib/sets/lists/base/mi Mon Oct 5 22:32:58 2009 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.831 2009/09/29 23:56:26 tsarna Exp $ +# $NetBSD: mi,v 1.832 2009/10/05 22:32:58 haad Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -301,6 +301,8 @@ ./sbin/vinum base-obsolete obsolete ./sbin/wdogctl base-sysutil-root ./sbin/wsconsctlbase-sysutil-root +./sbin/zpool base-zfs-binzfs +./sbin/zfs base-zfs-binzfs ./stand base-sys-root ./tmp base-sys-root ./usr base-sys-root @@ -667,6 +669,7 @@ ./usr/bin/zgrep base-util-bin ./usr/bin/zmore base-util-bin ./usr/bin/znew base-util-bin +./usr/bin/ztest base-zfs-bin zfs ./usr/games base-games-usr ./usr/games/hidebase-games-usr ./usr/include base-c-usr @@ -1329,6 +1332,7 @@ ./usr/sbin/ypxfrbase-nis-bin yp ./usr/sbin/zdumpbase-sysutil-bin ./usr/sbin/zic base-sysutil-bin +./usr/sbin/zdb base-zfs-bin zfs ./usr/share base-sys-share ./usr/share/atf base-atf-share ./usr/share/atf/atf-run.hooks base-atf-bin share Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.496 src/distrib/sets/lists/base/shl.mi:1.497 --- src/distrib/sets/lists/base/shl.mi:1.496 Mon Oct 5 03:54:17 2009 +++ src/distrib/sets/lists/base/shl.mi Mon Oct 5 22:32:58 2009 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.496 2009/10/05 03:54:17 tsarna Exp $ +# $NetBSD: shl.mi,v 1.497 2009/10/05 22:32:58 haad Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -55,6 +55,12 @@ ./usr/lib/libamu.so.4.0base-amd-shlib ./usr/lib/libarchive.so.3.0 base-sys-shlib ./usr/lib/libasn1.so.8.0 base-krb5-shlib kerberos +./usr/lib/libavl.sobase-zfs-shlib zfs,dynamicroot +./usr/lib/libavl.so.0 base-zfs-shlib zfs,dynamicroot +./usr/lib/libavl.so.0.0 base-zfs-shlib zfs,dynamicroot +./usr/lib/libavl.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libavl_p.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libavl_pic.a base-zfs-shlib zfs,dynamicroot ./usr/lib/libbfd.so.10.0 base-sys-shlib binutils=216 ./usr/lib/libbfd.so.11.0 base-sys-shlib binutils=219 ./usr/lib/libbind9.so.4.0 base-bind-shlib @@ -100,6 +106,12 @@ ./usr/lib/libmagic.so.3.0 base-sys-shlib ./usr/lib/libmenu.so.6.0 base-sys-shlib ./usr/lib/libnetpgp.so.2.0 base-crypto-shlib crypto +./usr/lib/libnvpair.sobase-zfs-shlib zfs,dynamicroot +./usr/lib/libnvpair.so.0 base-zfs-shlib zfs,dynamicroot +./usr/lib/libnvpair.so.0.0 base-zfs-shlib zfs,dynamicroot +./usr/lib/libnvpair.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libnvpair_p.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libnvpair_pic.a base-zfs-shlib zfs,dynamicroot ./usr/lib/libobjc.so.2.0 base-sys-shlib gcc=3 ./usr/lib/libobjc.so.3.0 base-sys-shlib gcc=4 ./usr/lib/libopenpgpsdk.so.0.9 base-obsolete obsolete @@ -162,10 +174,34 @@ ./usr/lib/libtermcap.so.0.6 base-sys-shlib ./usr/lib/libtermlib.so.0.6 base-sys-shlib ./usr/lib/libukfs.so.1.0 base-sys-shlib +./usr/lib/libumem.sobase-zfs-shlib zfs,dynamicroot +./usr/lib/libumem.so.0base-zfs-shlib zfs,dynamicroot +./usr/lib/libumem.so.0.0 base-zfs-shlib zfs,dynamicroot +./usr/lib/libumem.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libumem_p.abase-zfs-shlib zfs,dynamicroot +./usr/lib/libumem_pic.abase-zfs-shlib zfs,dynamicroot ./usr/lib/libusbhid.so.1.0 base-sys-shlib ./usr/lib/libutil.so.7.17 base-sys-shlib +./usr/lib/libuutil.sobase-zfs-shlib zfs,dynamicroot +./usr/lib/libuutil.so.0base-zfs-shlib zfs,dynamicroot +./usr/lib/libuutil.so.0.0 bas
CVS commit: src/etc/rc.d
Module Name:src Committed By: haad Date: Mon Oct 5 22:39:27 UTC 2009 Modified Files: src/etc/rc.d: mountall Log Message: Add support for mounting zfs filesystems to mountall script. ZFS configuration is stored in /etc/zpool.cache and it is automatically loaded to kernel from filesystem. Filesystems are then configured accordingly to their properties loaded from cache file. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/etc/rc.d/mountall Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/mountall diff -u src/etc/rc.d/mountall:1.6 src/etc/rc.d/mountall:1.7 --- src/etc/rc.d/mountall:1.6 Mon Dec 1 14:47:14 2008 +++ src/etc/rc.d/mountall Mon Oct 5 22:39:27 2009 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mountall,v 1.6 2008/12/01 14:47:14 tsutsui Exp $ +# $NetBSD: mountall,v 1.7 2009/10/05 22:39:27 haad Exp $ # # REQUIRE: mountcritremote named ypbind @@ -9,8 +9,40 @@ $_rc_subr_loaded . /etc/rc.subr name="mountall" -start_cmd="echo 'Mounting all filesystems...'; mount -a" -stop_cmd="echo 'Unmounting all filesystems...'; umount -a" +start_cmd="mountall_start" +stop_cmd="mountall_stop" + +mountall_start() +{ + echo 'Mounting all filesystems...' + if [ -f /etc/zfs/zpool.cache ]; then + # Get ZFS module loaded (and thereby, zvols created). + zfs list > /dev/null 2>&1 + # Mount file systems noted in fstab. + mount -a + # Mount ZFS file systems. + zfs mount -a + else + # Mount file systems noted in fstab. + mount -a + fi +} + +mountall_stop() +{ + echo 'Unmounting all filesystems...' + if [ -f /etc/zfs/zpool.cache ]; then + # Unmount ZFS file systems. + zfs unmount -a + # Unmount file systems noted in fstab. + umount -a + # Unload ZFS module, so disk devices are closed. + modunload zfs + else + # Otherwise, just deal with fstab. + umount -a + fi +} load_rc_config $name run_rc_command "$1"
CVS commit: src/external
Module Name:src Committed By: haad Date: Mon Oct 5 22:44:26 UTC 2009 Modified Files: src/external: Makefile Added Files: src/external/cddl: Makefile Log Message: Add cddl directory to external build framework. build things from osnet dir only when MKZFS variable is set. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/Makefile cvs rdiff -u -r0 -r1.1 src/external/cddl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/Makefile diff -u src/external/Makefile:1.7 src/external/Makefile:1.8 --- src/external/Makefile:1.7 Tue Sep 29 23:56:27 2009 +++ src/external/Makefile Mon Oct 5 22:44:26 2009 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.7 2009/09/29 23:56:27 tsarna Exp $ +# $NetBSD: Makefile,v 1.8 2009/10/05 22:44:26 haad Exp $ SUBDIR+= lib .WAIT -SUBDIR+= apache2 bsd intel-fw-eula intel-fw-public gpl2 gpl3 ibm-public intel-public +SUBDIR+= apache2 bsd intel-fw-eula intel-fw-public gpl2 gpl3 ibm-public intel-public cddl .include Added files: Index: src/external/cddl/Makefile diff -u /dev/null src/external/cddl/Makefile:1.1 --- /dev/null Mon Oct 5 22:44:26 2009 +++ src/external/cddl/Makefile Mon Oct 5 22:44:26 2009 @@ -0,0 +1,11 @@ +# $NetBSD: Makefile,v 1.1 2009/10/05 22:44:26 haad Exp $ +.include + +# We need more modular flag e.g. we can add dtrace to osnet later + +.if ( ${MKZFS} != "no") +SUBDIR+= osnet +.endif + +.include +
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Mon Oct 5 23:31:16 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: spa.c Log Message: Do not use sysent solaris framework there is no such thing in a NetBSD. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.2 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.1.1.1 Fri Aug 7 18:33:11 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c Mon Oct 5 23:31:16 2009 @@ -4252,6 +4252,7 @@ void spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) { +#ifndef __NetBSD__ #ifdef _KERNEL sysevent_t *ev; sysevent_attr_list_t *attr = NULL; @@ -4298,4 +4299,5 @@ sysevent_free_attr(attr); sysevent_free(ev); #endif +#endif /* __NetBSD__ */ }
CVS commit: src/external/cddl/osnet
Module Name:src Committed By: haad Date: Tue Oct 6 08:48:00 UTC 2009 Modified Files: src/external/cddl/osnet: TODO Log Message: iMark done tasks as done and move *at implementation task to post-import phase. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/TODO Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/TODO diff -u src/external/cddl/osnet/TODO:1.1 src/external/cddl/osnet/TODO:1.2 --- src/external/cddl/osnet/TODO:1.1 Fri Aug 7 20:57:55 2009 +++ src/external/cddl/osnet/TODO Tue Oct 6 08:47:59 2009 @@ -38,19 +38,18 @@ DONE changes to newfs fsck for zvols. DONE re-read zpool.cache and reconfigure pools. DONE successful unload of the module. -PDONE implement basic getpages/putpages. +DONE implement basic getpages/putpages. DONE callbacks into arc, for reclaim of memory or kernel virual space. DONE prevent module loading if less than 512MB RAM. - maybe changing the order of arguments for pool_cache constructors. -- check ioctl handlers for safety (for patch to allow old-style unix ioctl) +DONE check ioctl handlers for safety (for patch to allow old-style unix ioctl) PDONE port ZFS ACL stuff, enough for POSIX. DONE port zfs_replay.c to NetBSD DONE successfully compile a kernel. - stress testing. -PDONE rc.d integration for zfs. +DONE rc.d integration for zfs. DONE fix dangling vnode panic, get zfs unmount to work DONE fix zfs_rename bug -> fix should be sent back to sun -- implement lookupnameat(), fstatat() and openat() correctly. DONE syncer/atime issues Post-integration tasks. @@ -62,6 +61,7 @@ - zfs/iscsi integration. - native getpages/putpages. - update ZFS to latest. +- Implement *at syscalls correctly. PDONE = Partialy done.
CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common
Module Name:src Committed By: haad Date: Tue Oct 6 12:03:47 UTC 2009 Modified Files: src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c Log Message: Replace another openat call with open + changed path. XXX. This commit should be reverted after proper implementation of *at syscalls. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.1.1.1 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.2 --- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.1.1.1 Fri Aug 7 18:32:44 2009 +++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c Tue Oct 6 12:03:47 2009 @@ -860,7 +860,10 @@ (name[1] == 0 || (name[1] == '.' && name[2] == 0))) continue; - if ((fd = openat64(dfd, name, O_RDONLY)) < 0) + (void)snprintf(path, sizeof (path), "%s/%s", + rdsk, dp->d_name); + + if ((fd = open(path, O_RDONLY)) < 0) continue; /*
CVS commit: src/external/cddl/osnet/lib/libzpool
Module Name:src Committed By: haad Date: Tue Oct 6 16:28:10 UTC 2009 Modified Files: src/external/cddl/osnet/lib/libzpool: Makefile Log Message: Enable build of 64 bit atomic ops in userspace for i386. This is needed for all 32 bit archs which doesn't have a 64 atomic ops. This change enable MKZFS build for a i386. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/lib/libzpool/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libzpool/Makefile diff -u src/external/cddl/osnet/lib/libzpool/Makefile:1.1 src/external/cddl/osnet/lib/libzpool/Makefile:1.2 --- src/external/cddl/osnet/lib/libzpool/Makefile:1.1 Fri Aug 7 20:57:56 2009 +++ src/external/cddl/osnet/lib/libzpool/Makefile Tue Oct 6 16:28:10 2009 @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.1 2009/08/07 20:57:56 haad Exp $ +# $NetBSD: Makefile,v 1.2 2009/10/06 16:28:10 haad Exp $ .include "${.CURDIR}/../../dist/uts/common/Makefile.files" +.include "../../Makefile.zfs" .PATH: ${.CURDIR}/../../dist/common/zfs .PATH: ${.CURDIR}/../../dist/common/unicode @@ -21,8 +22,15 @@ SRCS+= ${ZFS_SHARED_OBJS:C/.o$/.c/} SRCS+= taskq.c util.c list.o u8_textprep.o +# Add opensolaris atomic functions and use fakedones if we do not support them +.if ${MACHINE_ARCH} == "i386" +CPPFLAGS+= -D__HAVE_ATOMIC64_OPS # add NetBSD 64 add operations on i386 +.PATH: ${NETBSDSRCDIR}/common/lib/libc/atomic +SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_inc_64_add.c atomic_dec_64_add.c +.endif + print: echo ${LIST_SRCS} ${LIST_OBJS} -.include "../../Makefile.zfs" + .include
CVS commit: src/external/cddl/osnet/sys/sys
Module Name:src Committed By: haad Date: Wed Oct 7 08:47:12 UTC 2009 Modified Files: src/external/cddl/osnet/sys/sys: zfs_context.h Log Message: Use ptob function from zfs and not NetBSD one. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/sys/zfs_context.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/sys/zfs_context.h diff -u src/external/cddl/osnet/sys/sys/zfs_context.h:1.1 src/external/cddl/osnet/sys/sys/zfs_context.h:1.2 --- src/external/cddl/osnet/sys/sys/zfs_context.h:1.1 Fri Aug 7 20:57:58 2009 +++ src/external/cddl/osnet/sys/sys/zfs_context.h Wed Oct 7 08:47:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zfs_context.h,v 1.1 2009/08/07 20:57:58 haad Exp $ */ +/* $NetBSD: zfs_context.h,v 1.2 2009/10/07 08:47:12 haad Exp $ */ /* * CDDL HEADER START @@ -499,7 +499,10 @@ #define ERESTART (-1) #endif +#ifdef ptob +#undef ptob size_t ptob(size_t); +#endif typedef struct ksiddomain { uint_t kd_ref;
CVS commit: src/distrib/sets
Module Name:src Committed By: haad Date: Wed Oct 7 22:22:18 UTC 2009 Modified Files: src/distrib/sets: sets.subr Log Message: Add MKZFS file so building a release works for others, too. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/distrib/sets/sets.subr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/sets.subr diff -u src/distrib/sets/sets.subr:1.88 src/distrib/sets/sets.subr:1.89 --- src/distrib/sets/sets.subr:1.88 Tue Sep 29 23:56:26 2009 +++ src/distrib/sets/sets.subr Wed Oct 7 22:22:18 2009 @@ -1,4 +1,4 @@ -# $NetBSD: sets.subr,v 1.88 2009/09/29 23:56:26 tsarna Exp $ +# $NetBSD: sets.subr,v 1.89 2009/10/07 22:22:18 haad Exp $ # # @@ -67,6 +67,7 @@ MKX11FONTS \ MKXORG \ MKYP \ + MKZFS \ USE_INET6 \ USE_KERBEROS \ USE_LDAP \ @@ -236,7 +237,7 @@ # In each file, a record consists of a path and a System Package name, # separated by whitespace. E.g., # -# # $NetBSD: sets.subr,v 1.88 2009/09/29 23:56:26 tsarna Exp $ +# # $NetBSD: sets.subr,v 1.89 2009/10/07 22:22:18 haad Exp $ # . base-sys-root [keyword[,...]] # ./altroot base-sys-root # ./bin base-sys-root @@ -299,6 +300,7 @@ # x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" # xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" # yp ${MKYP} != no +# zfs ${MKZFS} != no # # binutils= = value of ${HAVE_BINUTILS} # gcc= = value of ${HAVE_GCC}
CVS commit: src/share/mk
Module Name:src Committed By: haad Date: Fri Oct 9 00:26:53 UTC 2009 Modified Files: src/share/mk: bsd.own.mk Log Message: Enable MKZFS for i386 and amd64 so zfs tools and modules will be included in a daily builds and anyone can test zfs for NetBSD easier. To generate a diff of this commit: cvs rdiff -u -r1.585 -r1.586 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.585 src/share/mk/bsd.own.mk:1.586 --- src/share/mk/bsd.own.mk:1.585 Mon Oct 5 22:32:58 2009 +++ src/share/mk/bsd.own.mk Fri Oct 9 00:26:53 2009 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.585 2009/10/05 22:32:58 haad Exp $ +# $NetBSD: bsd.own.mk,v 1.586 2009/10/09 00:26:53 haad Exp $ .if !defined(_BSD_OWN_MK_) _BSD_OWN_MK_=1 @@ -701,7 +701,7 @@ # .for var in \ MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKDEBUG MKDEBUGLIB \ - MKLVM MKZFS \ + MKLVM \ MKMANZ MKOBJDIRS \ MKPCC MKPCCCMDS \ MKSOFTFLOAT MKSTRIPIDENT \ @@ -726,6 +726,15 @@ .endif # +# We want to build zfs only for i386 and amd64 by default for now. +# +.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" +MKZFS?= yes +.else +MKZFS?= no +.endif + +# # Force some options off if their dependencies are off. #
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: haad Date: Fri Oct 9 00:48:35 UTC 2009 Modified Files: src/distrib/sets/lists/base: shl.elf shl.mi src/distrib/sets/lists/comp: mi shl.mi src/distrib/sets/lists/man: mi Log Message: Fix sets files for MKZFS enabled builds move debuging libs to proper place and add html flags for html manpages. Patch received from Pierre Allegraud and reviewed by me. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/distrib/sets/lists/base/shl.elf cvs rdiff -u -r1.497 -r1.498 src/distrib/sets/lists/base/shl.mi cvs rdiff -u -r1.1319 -r1.1320 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.89 -r1.90 src/distrib/sets/lists/comp/shl.mi cvs rdiff -u -r1.1162 -r1.1163 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/shl.elf diff -u src/distrib/sets/lists/base/shl.elf:1.187 src/distrib/sets/lists/base/shl.elf:1.188 --- src/distrib/sets/lists/base/shl.elf:1.187 Wed Sep 30 03:41:12 2009 +++ src/distrib/sets/lists/base/shl.elf Fri Oct 9 00:48:33 2009 @@ -1,4 +1,4 @@ -# $NetBSD: shl.elf,v 1.187 2009/09/30 03:41:12 tsarna Exp $ +# $NetBSD: shl.elf,v 1.188 2009/10/09 00:48:33 haad Exp $ # # Note: Do not mark "old" major and major.minor shared libraries as # "obsolete"; just remove the entry, as third-party applications @@ -94,6 +94,8 @@ ./usr/lib/libarchive.so.3 base-sys-shlib ./usr/lib/libasn1.sobase-krb5-shlib kerberos ./usr/lib/libasn1.so.8base-krb5-shlib kerberos +./usr/lib/libavl.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libavl.so.0base-zfs-shlib dynamicroot,zfs ./usr/lib/libbfd.so.10base-sys-shlib binutils=216 ./usr/lib/libbfd.so.11base-sys-shlib binutils=219 ./usr/lib/libbind9.sobase-bind-shlib @@ -187,6 +189,8 @@ ./usr/lib/libmenu.so.6base-sys-shlib ./usr/lib/libnetpgp.sobase-crypto-shlib crypto ./usr/lib/libnetpgp.so.2 base-crypto-shlib crypto +./usr/lib/libnvpair.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libnvpair.so.0 base-zfs-shlib dynamicroot,zfs ./usr/lib/libobjc.sobase-sys-shlib gcc ./usr/lib/libobjc.so.3base-sys-shlib gcc ./usr/lib/libopenpgpsdk.so base-obsolete obsolete @@ -309,12 +313,20 @@ ./usr/lib/libtermlib.so.0 base-sys-shlib ./usr/lib/libukfs.sobase-sys-shlib ./usr/lib/libukfs.so.1base-sys-shlib +./usr/lib/libumem.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libumem.so.0base-zfs-shlib dynamicroot,zfs ./usr/lib/libusbhid.sobase-sys-shlib ./usr/lib/libusbhid.so.1 base-sys-shlib ./usr/lib/libutil.sobase-sys-shlib ./usr/lib/libutil.so.7base-sys-shlib +./usr/lib/libuutil.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libuutil.so.0base-zfs-shlib dynamicroot,zfs ./usr/lib/libwrap.sobase-net-shlib ./usr/lib/libwrap.so.1base-net-shlib ./usr/lib/libz.sobase-sys-shlib ./usr/lib/libz.so.1base-sys-shlib +./usr/lib/libzfs.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libzfs.so.0base-zfs-shlib dynamicroot,zfs +./usr/lib/libzpool.sobase-zfs-shlib dynamicroot,zfs +./usr/lib/libzpool.so.0base-zfs-shlib dynamicroot,zfs ./usr/libexec/ld.elf_sobase-sys-shlib Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.497 src/distrib/sets/lists/base/shl.mi:1.498 --- src/distrib/sets/lists/base/shl.mi:1.497 Mon Oct 5 22:32:58 2009 +++ src/distrib/sets/lists/base/shl.mi Fri Oct 9 00:48:34 2009 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.497 2009/10/05 22:32:58 haad Exp $ +# $NetBSD: shl.mi,v 1.498 2009/10/09 00:48:34 haad Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -55,12 +55,7 @@ ./usr/lib/libamu.so.4.0base-amd-shlib ./usr/lib/libarchive.so.3.0 base-sys-shlib ./usr/lib/libasn1.so.8.0 base-krb5-shlib kerberos -./usr/lib/libavl.sobase-zfs-shlib zfs,dynamicroot -./usr/lib/libavl.so.0 base-zfs-shlib zfs,dynamicroot ./usr/lib/libavl.so.0.0 base-zfs-shlib zfs,dynamicroot -./usr/lib/libavl.abase-zfs-shlib zfs,dynamicroot -./usr/lib/libavl_p.abase-zfs-shlib zfs,dynamicroot -./usr/lib/libavl_pic.a base-zfs-shlib zfs,dynamicroot ./usr/lib/libbfd.so.10.0 base-sys-shlib binutils=216 ./usr/lib/libbfd.so.11.0 base-sys-shlib binutils=219 ./usr/lib/libbind9.so.4.0 base-bind-shlib @@ -106,12 +101,7 @@ ./usr/lib/libmagic.so.3.0 base-sys-shlib ./usr/lib/libmenu.so.6.0 base-sys-shlib ./usr/lib/libnetpgp.so.2.0 base-crypto-shlib crypto -./usr/lib/libnvpair.sobase-zfs-shlib zfs,dynamicroot -./usr/lib/libnvpair.so.0 base-zfs-shlib zfs,dynamicroot ./usr/lib/libnvpair.so.0.0 base-zfs-shlib zfs,dynamicroot -./usr/lib/libnvpair.abase-zfs-shlib zfs,dynamicroot -./usr/lib/libnvpair_p.abase-zfs-shlib zfs,dynamicroot -./usr/lib/libnvpair_pic.a base-zfs-shlib
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: haad Date: Fri Oct 9 09:34:23 UTC 2009 Modified Files: src/distrib/sets/lists/comp: mi Log Message: Add entries for pool_cache_invalidate_local manpages. (hi jym@) To generate a diff of this commit: cvs rdiff -u -r1.1320 -r1.1321 src/distrib/sets/lists/comp/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1320 src/distrib/sets/lists/comp/mi:1.1321 --- src/distrib/sets/lists/comp/mi:1.1320 Fri Oct 9 00:48:34 2009 +++ src/distrib/sets/lists/comp/mi Fri Oct 9 09:34:22 2009 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1320 2009/10/09 00:48:34 haad Exp $ +# $NetBSD: mi,v 1.1321 2009/10/09 09:34:22 haad Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -9011,6 +9011,7 @@ ./usr/share/man/cat9/pool_cache_get_paddr.0 comp-sys-catman .cat ./usr/share/man/cat9/pool_cache_init.0 comp-sys-catman .cat ./usr/share/man/cat9/pool_cache_invalidate.0 comp-sys-catman .cat +./usr/share/man/cat9/pool_cache_invalidate_local.0 comp-sys-catman .cat ./usr/share/man/cat9/pool_cache_put.0 comp-sys-catman .cat ./usr/share/man/cat9/pool_cache_put_paddr.0 comp-sys-catman .cat ./usr/share/man/cat9/pool_create.0 comp-sys-catman .cat @@ -14420,6 +14421,7 @@ ./usr/share/man/html9/pool_cache_get_paddr.html comp-sys-htmlman html ./usr/share/man/html9/pool_cache_init.html comp-sys-htmlman html ./usr/share/man/html9/pool_cache_invalidate.html comp-sys-htmlman html +./usr/share/man/html9/pool_cache_invalidate_local.html comp-sys-htmlman html ./usr/share/man/html9/pool_cache_put.html comp-sys-htmlman html ./usr/share/man/html9/pool_cache_put_paddr.html comp-sys-htmlman html ./usr/share/man/html9/pool_create.html comp-sys-htmlman html @@ -19998,6 +2,7 @@ ./usr/share/man/man9/pool_cache_get_paddr.9 comp-sys-man .man ./usr/share/man/man9/pool_cache_init.9 comp-sys-man .man ./usr/share/man/man9/pool_cache_invalidate.9 comp-sys-man .man +./usr/share/man/man9/pool_cache_invalidate_local.9 comp-sys-man.man ./usr/share/man/man9/pool_cache_put.9 comp-sys-man .man ./usr/share/man/man9/pool_cache_put_paddr.9 comp-sys-man .man ./usr/share/man/man9/pool_create.9 comp-sys-man .man
CVS commit: src/external/cddl/osnet/sys/kern
Module Name:src Committed By: haad Date: Sun Oct 11 10:54:52 UTC 2009 Modified Files: src/external/cddl/osnet/sys/kern: vfs.c Log Message: Properly return error when namei_kernel_simple fails. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/kern/vfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/kern/vfs.c diff -u src/external/cddl/osnet/sys/kern/vfs.c:1.1 src/external/cddl/osnet/sys/kern/vfs.c:1.2 --- src/external/cddl/osnet/sys/kern/vfs.c:1.1 Fri Aug 7 20:57:57 2009 +++ src/external/cddl/osnet/sys/kern/vfs.c Sun Oct 11 10:54:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs.c,v 1.1 2009/08/07 20:57:57 haad Exp $ */ +/* $NetBSD: vfs.c,v 1.2 2009/10/11 10:54:52 haad Exp $ */ /*- * Copyright (c) 2006-2007 Pawel Jakub Dawidek @@ -51,7 +51,7 @@ KASSERT(dirvpp == NULL); - namei_simple_kernel(dirname, NSM_FOLLOW_NOEMULROOT, compvpp); + error = namei_simple_kernel(dirname, NSM_FOLLOW_NOEMULROOT, compvpp); return error; }
CVS commit: src/external/cddl/osnet/sys/sys
Module Name:src Committed By: haad Date: Sun Oct 11 10:56:13 UTC 2009 Modified Files: src/external/cddl/osnet/sys/sys: zfs_context.h Log Message: undef ptob if it was already defined/included in some NetBSD header file. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/sys/sys/zfs_context.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/sys/zfs_context.h diff -u src/external/cddl/osnet/sys/sys/zfs_context.h:1.2 src/external/cddl/osnet/sys/sys/zfs_context.h:1.3 --- src/external/cddl/osnet/sys/sys/zfs_context.h:1.2 Wed Oct 7 08:47:12 2009 +++ src/external/cddl/osnet/sys/sys/zfs_context.h Sun Oct 11 10:56:13 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zfs_context.h,v 1.2 2009/10/07 08:47:12 haad Exp $ */ +/* $NetBSD: zfs_context.h,v 1.3 2009/10/11 10:56:13 haad Exp $ */ /* * CDDL HEADER START @@ -614,7 +614,10 @@ #define issig(x) (sigispending(curlwp, 0)) #define ISSIG(thr, why) (sigispending(thr, 0)) #define fm_panic panic +#ifdef ptob +#undef ptob #define ptob(x) ((x) * PAGE_SIZE) +#endif /* ptob */ #define strncat(a, b, c) strlcat(a, b, c) #define tsd_get(x) lwp_getspecific(x) #define tsd_set(x, y) (lwp_setspecific(x, y), 0)
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Sun Oct 11 10:58:06 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c dbuf.c Log Message: Cast physmem to (uint64_t) so it works on a amd64 system with more than 4Gb ram. undef btop if it was already included from other NetBSD header file. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.5 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.4 Wed Aug 12 21:52:41 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Sun Oct 11 10:58:06 2009 @@ -135,7 +135,9 @@ #ifdef __NetBSD__ #include +#ifndef btop #define btop(x) ((x) / PAGE_SIZE) +#endif #define needfree (uvmexp.free < uvmexp.freetarg ? uvmexp.freetarg : 0) #define buf_init arc_buf_init #define freemem uvmexp.free @@ -867,7 +869,7 @@ * with an average 64K block size. The table will take up * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers). */ - while (hsize * 65536 < physmem * PAGESIZE) + while (hsize * 65536 < (uint64_t)physmem * PAGESIZE) hsize <<= 1; retry: buf_hash_table.ht_mask = hsize - 1; Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c Sun Oct 11 10:58:06 2009 @@ -237,13 +237,13 @@ uint64_t hsize = 1ULL << 16; dbuf_hash_table_t *h = &dbuf_hash_table; int i; - + /* * The hash table is big enough to fill all of physical memory * with an average 4K block size. The table will take up * totalmem*sizeof(void*)/4K (i.e. 2MB/GB with 8-byte pointers). */ - while (hsize * 4096 < physmem * PAGESIZE) + while (hsize * 4096 < (uint64_t)physmem * PAGESIZE) hsize <<= 1; retry:
CVS commit: src/external/cddl/osnet/sys/sys
Module Name:src Committed By: haad Date: Sun Oct 11 22:17:57 UTC 2009 Modified Files: src/external/cddl/osnet/sys/sys: zfs_context.h Log Message: Define ptob only if it wasn't defined already in NetBSD headers. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/sys/zfs_context.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/sys/zfs_context.h diff -u src/external/cddl/osnet/sys/sys/zfs_context.h:1.3 src/external/cddl/osnet/sys/sys/zfs_context.h:1.4 --- src/external/cddl/osnet/sys/sys/zfs_context.h:1.3 Sun Oct 11 10:56:13 2009 +++ src/external/cddl/osnet/sys/sys/zfs_context.h Sun Oct 11 22:17:57 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zfs_context.h,v 1.3 2009/10/11 10:56:13 haad Exp $ */ +/* $NetBSD: zfs_context.h,v 1.4 2009/10/11 22:17:57 haad Exp $ */ /* * CDDL HEADER START @@ -499,8 +499,7 @@ #define ERESTART (-1) #endif -#ifdef ptob -#undef ptob +#ifndef ptob size_t ptob(size_t); #endif @@ -614,8 +613,7 @@ #define issig(x) (sigispending(curlwp, 0)) #define ISSIG(thr, why) (sigispending(thr, 0)) #define fm_panic panic -#ifdef ptob -#undef ptob +#ifndef ptob #define ptob(x) ((x) * PAGE_SIZE) #endif /* ptob */ #define strncat(a, b, c) strlcat(a, b, c)
CVS commit: src/external/cddl/osnet/sys/sys
Module Name:src Committed By: haad Date: Mon Oct 12 10:05:29 UTC 2009 Modified Files: src/external/cddl/osnet/sys/sys: zfs_context.h Log Message: Finaly fix ptob problem. ptob was defined for amd64 and not for i386, and NetBSD version of ptob is not compatible with Solaris one. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/zfs_context.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/sys/zfs_context.h diff -u src/external/cddl/osnet/sys/sys/zfs_context.h:1.4 src/external/cddl/osnet/sys/sys/zfs_context.h:1.5 --- src/external/cddl/osnet/sys/sys/zfs_context.h:1.4 Sun Oct 11 22:17:57 2009 +++ src/external/cddl/osnet/sys/sys/zfs_context.h Mon Oct 12 10:05:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: zfs_context.h,v 1.4 2009/10/11 22:17:57 haad Exp $ */ +/* $NetBSD: zfs_context.h,v 1.5 2009/10/12 10:05:29 haad Exp $ */ /* * CDDL HEADER START @@ -499,10 +499,13 @@ #define ERESTART (-1) #endif -#ifndef ptob -size_t ptob(size_t); +#ifdef ptob +#undef ptob #endif +size_t ptob(size_t); + + typedef struct ksiddomain { uint_t kd_ref; uint_t kd_len; @@ -613,9 +616,12 @@ #define issig(x) (sigispending(curlwp, 0)) #define ISSIG(thr, why) (sigispending(thr, 0)) #define fm_panic panic -#ifndef ptob + +#ifdef ptob +#undef ptob +#endif #define ptob(x) ((x) * PAGE_SIZE) -#endif /* ptob */ + #define strncat(a, b, c) strlcat(a, b, c) #define tsd_get(x) lwp_getspecific(x) #define tsd_set(x, y) (lwp_setspecific(x, y), 0)
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Sun Jan 3 12:53:00 UTC 2010 Modified Files: src/sys/dev/dm: dm_pdev.c Log Message: Replace aprint_Verbose with aprint_debug to shutup unnecessary logs. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/dm_pdev.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/dev/dm/dm_pdev.c diff -u src/sys/dev/dm/dm_pdev.c:1.4 src/sys/dev/dm/dm_pdev.c:1.5 --- src/sys/dev/dm/dm_pdev.c:1.4 Wed Sep 9 22:38:49 2009 +++ src/sys/dev/dm/dm_pdev.c Sun Jan 3 12:53:00 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_pdev.c,v 1.4 2009/09/09 22:38:49 haad Exp $ */ +/*$NetBSD: dm_pdev.c,v 1.5 2010/01/03 12:53:00 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -94,7 +94,7 @@ if (dmp != NULL) { dmp->ref_cnt++; - aprint_verbose("dmp_pdev_insert pdev %s already in tree\n",dev_name); + aprint_debug("dmp_pdev_insert pdev %s already in tree\n",dev_name); mutex_exit(&dm_pdev_mutex); return dmp; } @@ -105,7 +105,7 @@ error = dk_lookup(dev_name, curlwp, &dmp->pdev_vnode, UIO_SYSSPACE); if (error) { - aprint_verbose("dk_lookup on device: %s failed with error %d!\n", + aprint_debug("dk_lookup on device: %s failed with error %d!\n", dev_name, error); kmem_free(dmp, sizeof(dm_pdev_t)); return NULL;
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Sun Jan 3 22:22:23 UTC 2010 Modified Files: src/sys/dev/dm: device-mapper.c dm_ioctl.c files.dm Log Message: Hook device-mapper to autoconf framework. Add dm_attach, dm_match and dm_detach routines used by autoconf users. Change dm_dev_remove_ioctl to call dm_detach. This should be primary used by kernel to disable devices during shutdown of system with nested disk devices. Requested by dyo...@. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/device-mapper.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_ioctl.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/files.dm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/device-mapper.c diff -u src/sys/dev/dm/device-mapper.c:1.11 src/sys/dev/dm/device-mapper.c:1.12 --- src/sys/dev/dm/device-mapper.c:1.11 Tue Dec 29 23:37:47 2009 +++ src/sys/dev/dm/device-mapper.c Sun Jan 3 22:22:23 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: device-mapper.c,v 1.11 2009/12/29 23:37:47 haad Exp $ */ +/*$NetBSD: device-mapper.c,v 1.12 2010/01/03 22:22:23 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -58,14 +59,19 @@ static dev_type_size(dmsize); /* attach and detach routines */ -int dmattach(void); -int dmdestroy(void); +static int dmattach(void); +static int dmdestroy(void); static int dm_cmd_to_fun(prop_dictionary_t); static int disk_ioctl_switch(dev_t, u_long, void *); static int dm_ioctl_switch(u_long); static void dmminphys(struct buf *); +/* CF attach/detach functions used for power management */ +static int dm_detach(device_t, int); +static void dm_attach(device_t, device_t, void *); +static int dm_match(device_t, cfdata_t, void *); + /* ***Variable-definitions*** */ const struct bdevsw dm_bdevsw = { .d_open = dmopen, @@ -95,6 +101,14 @@ .d_strategy = dmstrategy }; +/* Autoconf defines */ +CFDRIVER_DECL(dm, DV_DISK, NULL); +CFATTACH_DECL3_NEW(dm, 0, + dm_match, dm_attach, dm_detach, NULL, NULL, NULL, + DVF_DETACH_SHUTDOWN); + +extern struct cfdriver dm_cd; + extern uint64_t dev_counter; /* @@ -134,11 +148,27 @@ { #ifdef _MODULE int bmajor = -1, cmajor = -1; + int error; + + error = 0; switch (cmd) { case MODULE_CMD_INIT: dmattach(); - return devsw_attach("dm", &dm_bdevsw, &bmajor, + + error = config_cfdriver_attach(&dm_cd); + if (error) + break; + + error = config_cfattach_attach(dm_cd.cd_name, &dm_ca); + if (error) { + config_cfdriver_detach(&dm_cd); + aprint_error("Unable to register cfattach for dm driver\n"); + + break; + } + + error = devsw_attach("dm", &dm_bdevsw, &bmajor, &dm_cdevsw, &cmajor); break; @@ -152,7 +182,14 @@ if (dev_counter > 0) return EBUSY; dmdestroy(); - return devsw_detach(&dm_bdevsw, &dm_cdevsw); + + error = config_cfattach_detach(dm_cd.cd_name, &dm_ca); + if (error) + break; + + config_cfdriver_detach(&dm_cd); + + devsw_detach(&dm_bdevsw, &dm_cdevsw); break; case MODULE_CMD_STAT: return ENOTTY; @@ -161,7 +198,7 @@ return ENOTTY; } - return 0; + return error; #else if (cmd == MODULE_CMD_INIT) @@ -172,10 +209,75 @@ } +/* + * dm_match: + * + * Autoconfiguration match function for pseudo-device glue. + */ +static int +dm_match(device_t parent, cfdata_t match, +void *aux) +{ + + /* Pseudo-device; always present. */ + return (1); +} + +/* + * dm_attach: + * + * Autoconfiguration attach function for pseudo-device glue. + */ +static void +dm_attach(device_t parent, device_t self, +void *aux) +{ + return; +} + + +/* + * dm_detach: + * + * Autoconfiguration detach function for pseudo-device glue. + * This routine is called by dm_ioctl::dm_dev_remove_ioctl and by autoconf to + * remove devices created in device-mapper. + */ +static int +dm_detach(device_t self, int flags) +{ + dm_dev_t *dmv; + + /* Detach device from global device list */ + if ((dmv = dm_dev_detach(self)) == NULL) + return ENOENT; + + /* Destroy active table first. */ + dm_table_destroy(&dmv->table_head, DM_TABLE_ACTIVE); + + /* Destroy inactive table if exits, too. */ + dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE); + + dm_table_head_destroy(&dmv->table_head); + + /* Destroy disk device structure */ + disk_detach(dmv->diskp); + disk_destroy(dmv->diskp); + + /* Destroy device */ + (void)dm_dev_free(dmv); + + /* Decrement device counter After removing device */ + atomic_dec_64(&dev_counter); + + return 0; +} + /* attach routine */ -int +static int dmattach(void) { + dm_target_init(); dm_dev_init(); dm_pdev_init(); @@ -184,9 +286,10 @@ } /* Destroy routine */ -int +static int dmdestroy(void) { + dm_dev_destroy(); dm_pdev_destroy(); dm_target_destroy(); @@ -197,6 +300,7 @@ static int dmopen(dev_t dev, int flags, int mode, struct lw
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Sun Jan 3 22:44:10 UTC 2010 Modified Files: src/sys/dev/dm: device-mapper.c Log Message: KNF police, remove unnecessary whitespaces and tabulators. Refactor dmioctl to not use prop_dictionary_copy* functions if NetBSD_DM_IOCTL command was not called on device. If disk_ioctl returms anything else then ENOTTY exit from dmioctl. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c diff -u src/sys/dev/dm/device-mapper.c:1.12 src/sys/dev/dm/device-mapper.c:1.13 --- src/sys/dev/dm/device-mapper.c:1.12 Sun Jan 3 22:22:23 2010 +++ src/sys/dev/dm/device-mapper.c Sun Jan 3 22:44:10 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: device-mapper.c,v 1.12 2010/01/03 22:22:23 haad Exp $ */ +/*$NetBSD: device-mapper.c,v 1.13 2010/01/03 22:44:10 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -139,7 +139,6 @@ {NULL, NULL} }; - MODULE(MODULE_CLASS_DRIVER, dm, NULL); /* New module handle routine */ @@ -301,7 +300,7 @@ dmopen(dev_t dev, int flags, int mode, struct lwp *l) { - aprint_debug("open routine called %" PRIu32 "\n", minor(dev)); + aprint_debug("dm open routine called %" PRIu32 "\n", minor(dev)); return 0; } @@ -309,7 +308,7 @@ dmclose(dev_t dev, int flags, int mode, struct lwp *l) { - aprint_debug("CLOSE routine called\n"); + aprint_debug("dm close routine called %" PRIu32 "\n", minor(dev)); return 0; } @@ -326,9 +325,14 @@ KASSERT(data != NULL); - if (disk_ioctl_switch(dev, cmd, data) != 0) { + if (( r = disk_ioctl_switch(dev, cmd, data)) == ENOTTY) { struct plistref *pref = (struct plistref *) data; + /* Check if we were called with NETBSD_DM_IOCTL ioctl + otherwise quit. */ + if ((r = dm_ioctl_switch(cmd)) != 0) + return r; + if((r = prop_dictionary_copyin_ioctl(pref, cmd, &dm_dict_in)) != 0) return r; @@ -337,18 +341,12 @@ return r; } - /* call cmd selected function */ - if ((r = dm_ioctl_switch(cmd)) != 0) { - prop_object_release(dm_dict_in); - return r; - } - /* run ioctl routine */ if ((r = dm_cmd_to_fun(dm_dict_in)) != 0) { prop_object_release(dm_dict_in); return r; } - + r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in); prop_object_release(dm_dict_in); @@ -366,10 +364,10 @@ prop_string_t command; r = 0; - + if ((command = prop_dictionary_get(dm_dict, DM_IOCTL_COMMAND)) == NULL) return EINVAL; - + for(i = 0; cmd_fn[i].cmd != NULL; i++) if (prop_string_equals_cstring(command, cmd_fn[i].cmd)) break; @@ -379,7 +377,7 @@ aprint_debug("ioctl %s called\n", cmd_fn[i].cmd); r = cmd_fn[i].fn(dm_dict); - + return r; } @@ -387,23 +385,19 @@ static int dm_ioctl_switch(u_long cmd) { - int r; - - r = 0; switch(cmd) { - + case NETBSD_DM_IOCTL: - aprint_debug("NetBSD_DM_IOCTL called\n"); + aprint_debug("dm NetBSD_DM_IOCTL called\n"); break; - default: - aprint_debug("unknown ioctl called\n"); + aprint_debug("dm unknown ioctl called\n"); return ENOTTY; break; /* NOT REACHED */ } - return r; + return 0; } /* @@ -414,21 +408,21 @@ disk_ioctl_switch(dev_t dev, u_long cmd, void *data) { dm_dev_t *dmv; - + switch(cmd) { case DIOCGWEDGEINFO: { struct dkwedge_info *dkw = (void *) data; if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL) - return ENOENT; - + return ENODEV; + aprint_debug("DIOCGWEDGEINFO ioctl called\n"); - + strlcpy(dkw->dkw_devname, dmv->name, 16); strlcpy(dkw->dkw_wname, dmv->name, DM_NAME_LEN); strlcpy(dkw->dkw_parent, dmv->name, 16); - + dkw->dkw_offset = 0; dkw->dkw_size = dm_table_size(&dmv->table_head); strcpy(dkw->dkw_ptype, DKW_PTYPE_FFS); @@ -442,8 +436,8 @@ struct plistref *pref = (struct plistref *) data; if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL) - return ENOENT; - + return ENODEV; + if (dmv->diskp->dk_info == NULL) { dm_dev_unbusy(dmv); return ENOTSUP; @@ -452,16 +446,15 @@ dmv->diskp->dk_info); dm_dev_unbusy(dmv); - break; } default: aprint_debug("unknown disk_ioctl called\n"); - return 1; + return ENOTTY; break; /* NOT REACHED */ } - + return 0; } @@ -481,7 +474,7 @@ uint64_t buf_start, buf_len, issued_len; uint64_t table_start, table_end; uint64_t start, end; - + buf_start = bp->b_blkno * DEV_BSIZE; buf_len = bp->b_bcount; @@ -513,14 +506,14 @@ mutex_enter(&dmv->diskp_mtx); disk_busy(dmv->diskp); mutex_exit(&dmv->diskp_mtx); - + /* Select active table */ tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_ACTIVE); /* Nested buffers count down to zero therefore I have to set bp->b_resid to maximal value. */ bp->b_resid = bp->b_bco
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Sun Jan 3 22:55:26 UTC 2010 Modified Files: src/sys/dev/dm: device-mapper.c Log Message: Refactor dmioctl to by cleaner and to copyout dictionary in case when something went wrong. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c diff -u src/sys/dev/dm/device-mapper.c:1.13 src/sys/dev/dm/device-mapper.c:1.14 --- src/sys/dev/dm/device-mapper.c:1.13 Sun Jan 3 22:44:10 2010 +++ src/sys/dev/dm/device-mapper.c Sun Jan 3 22:55:25 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: device-mapper.c,v 1.13 2010/01/03 22:44:10 haad Exp $ */ +/*$NetBSD: device-mapper.c,v 1.14 2010/01/03 22:55:25 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -336,19 +336,15 @@ if((r = prop_dictionary_copyin_ioctl(pref, cmd, &dm_dict_in)) != 0) return r; - if ((r = dm_check_version(dm_dict_in)) != 0) { - prop_object_release(dm_dict_in); - return r; - } + if ((r = dm_check_version(dm_dict_in)) != 0) + goto cleanup_exit; /* run ioctl routine */ - if ((r = dm_cmd_to_fun(dm_dict_in)) != 0) { - prop_object_release(dm_dict_in); - return r; - } + if ((r = dm_cmd_to_fun(dm_dict_in)) != 0) + goto cleanup_exit; +cleanup_exit: r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in); - prop_object_release(dm_dict_in); }
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Jan 4 00:12:22 UTC 2010 Modified Files: src/sys/dev/dm: dm_target_error.c dm_target_mirror.c dm_target_snapshot.c dm_target_zero.c Log Message: Indent files remove unnecessary blank lines, white spaces and KNFize code. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_target_error.c \ src/sys/dev/dm/dm_target_zero.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/dm_target_mirror.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target_snapshot.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/dev/dm/dm_target_error.c diff -u src/sys/dev/dm/dm_target_error.c:1.9 src/sys/dev/dm/dm_target_error.c:1.10 --- src/sys/dev/dm/dm_target_error.c:1.9 Tue Dec 1 23:12:10 2009 +++ src/sys/dev/dm/dm_target_error.c Mon Jan 4 00:12:22 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target_error.c,v 1.9 2009/12/01 23:12:10 haad Exp $ */ +/*$NetBSD: dm_target_error.c,v 1.10 2010/01/04 00:12:22 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,15 +58,15 @@ dm_target_t *dmt; int r; dmt = NULL; - + switch (cmd) { case MODULE_CMD_INIT: - if ((dmt = dm_target_lookup("error")) != NULL){ + if ((dmt = dm_target_lookup("error")) != NULL) { dm_target_unbusy(dmt); return EEXIST; } dmt = dm_target_alloc("error"); - + dmt->version[0] = 1; dmt->version[1] = 0; dmt->version[2] = 0; @@ -79,7 +79,7 @@ dmt->upcall = &dm_target_error_upcall; r = dm_target_insert(dmt); - + break; case MODULE_CMD_FINI: @@ -95,12 +95,11 @@ return r; } - #endif /* Init function called from dm_table_load_ioctl. */ int -dm_target_error_init(dm_dev_t *dmv, void **target_config, char *argv) +dm_target_error_init(dm_dev_t * dmv, void **target_config, char *argv) { printf("Error target init function called!!\n"); @@ -108,20 +107,18 @@ *target_config = NULL; dmv->dev_type = DM_ERROR_DEV; - + return 0; } - /* Status routine called to get params string. */ char * dm_target_error_status(void *target_config) { return NULL; -} - +} /* Strategy routine called from dm_strategy. */ int -dm_target_error_strategy(dm_table_entry_t *table_en, struct buf *bp) +dm_target_error_strategy(dm_table_entry_t * table_en, struct buf * bp) { printf("Error target read function called!!\n"); @@ -130,32 +127,29 @@ bp->b_resid = 0; biodone(bp); - + return 0; } - /* Doesn't do anything here. */ int -dm_target_error_destroy(dm_table_entry_t *table_en) +dm_target_error_destroy(dm_table_entry_t * table_en) { table_en->target_config = NULL; /* Unbusy target so we can unload it */ dm_target_unbusy(table_en->target); - + return 0; } - /* Doesn't not need to do anything here. */ int -dm_target_error_deps(dm_table_entry_t *table_en, prop_array_t prop_array) -{ +dm_target_error_deps(dm_table_entry_t * table_en, prop_array_t prop_array) +{ return 0; } - /* Unsupported for this target. */ int -dm_target_error_upcall(dm_table_entry_t *table_en, struct buf *bp) +dm_target_error_upcall(dm_table_entry_t * table_en, struct buf * bp) { return 0; } Index: src/sys/dev/dm/dm_target_zero.c diff -u src/sys/dev/dm/dm_target_zero.c:1.9 src/sys/dev/dm/dm_target_zero.c:1.10 --- src/sys/dev/dm/dm_target_zero.c:1.9 Tue Dec 1 23:12:10 2009 +++ src/sys/dev/dm/dm_target_zero.c Mon Jan 4 00:12:22 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target_zero.c,v 1.9 2009/12/01 23:12:10 haad Exp $ */ +/*$NetBSD: dm_target_zero.c,v 1.10 2010/01/04 00:12:22 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,15 +59,15 @@ dm_target_t *dmt; int r; dmt = NULL; - + switch (cmd) { case MODULE_CMD_INIT: - if ((dmt = dm_target_lookup("zero")) != NULL){ + if ((dmt = dm_target_lookup("zero")) != NULL) { dm_target_unbusy(dmt); return EEXIST; } dmt = dm_target_alloc("zero"); - + dmt->version[0] = 1; dmt->version[1] = 0; dmt->version[2] = 0; @@ -96,7 +96,6 @@ return r; } - #endif /* @@ -104,67 +103,62 @@ * target specific config area. */ int -dm_target_zero_init(dm_dev_t *dmv, void **target_config, char *argv) +dm_target_zero_init(dm_dev_t * dmv, void **target_config, char *argv) { printf("Zero target init function called!!\n"); dmv->dev_type = DM_ZERO_DEV; - + *target_config = NULL; - + return 0; } - /* Status routine called to get params string. */ char * dm_target_zero_status(void *target_config) { return NULL; -} - +} + /* * This routine does IO operations. */ int -dm_target_zero_strategy(dm_table_entry_t *table_en, struct buf *bp) +dm_target_zero_strategy(dm_table_entry_t * table_en, struct buf * bp) { /* printf("Zero target read function called %d!!\n", bp->b_bcount); */ - memset(bp->b_data, 0, bp->b_bcount); - bp->b_resid = 0; /* nestio
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Jan 4 00:14:41 UTC 2010 Modified Files: src/sys/dev/dm: dm_target.c dm_target_linear.c dm_target_stripe.c Log Message: Indent files remove unnecessary blank lines, white spaces and KNFize code. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/dm_target_linear.c \ src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm_target.c diff -u src/sys/dev/dm/dm_target.c:1.11 src/sys/dev/dm/dm_target.c:1.12 --- src/sys/dev/dm/dm_target.c:1.11 Wed Sep 9 22:38:49 2009 +++ src/sys/dev/dm/dm_target.c Mon Jan 4 00:14:41 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target.c,v 1.11 2009/09/09 22:38:49 haad Exp $ */ +/*$NetBSD: dm_target.c,v 1.12 2010/01/04 00:14:41 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include "netbsd-dm.h" #include "dm.h" -static dm_target_t* dm_target_lookup_name(const char *); +static dm_target_t *dm_target_lookup_name(const char *); TAILQ_HEAD(dm_target_head, dm_target); @@ -52,21 +52,19 @@ * Called indirectly from dm_table_load_ioctl to mark target as used. */ void -dm_target_busy(dm_target_t *target) +dm_target_busy(dm_target_t * target) { atomic_inc_32(&target->ref_cnt); } - /* * Release reference counter on target. */ void -dm_target_unbusy(dm_target_t *target) +dm_target_unbusy(dm_target_t * target) { KASSERT(target->ref_cnt > 0); atomic_dec_32(&target->ref_cnt); } - /* * Try to autoload target module if it was not found in current * target list. @@ -79,26 +77,25 @@ dm_target_t *dmt; snprintf(name, sizeof(name), "dm_target_%s", dm_target_name); - name[29]='\0'; - + name[29] = '\0'; + do { gen = module_gen; - + /* Try to autoload target module */ mutex_enter(&module_lock); (void) module_autoload(name, MODULE_CLASS_MISC); mutex_exit(&module_lock); - } while (gen != module_gen); + } while (gen != module_gen); mutex_enter(&dm_target_mutex); dmt = dm_target_lookup_name(dm_target_name); if (dmt != NULL) dm_target_busy(dmt); mutex_exit(&dm_target_mutex); - + return dmt; } - /* * Lookup for target in global target list. */ @@ -117,20 +114,20 @@ dmt = dm_target_lookup_name(dm_target_name); if (dmt != NULL) dm_target_busy(dmt); - + mutex_exit(&dm_target_mutex); - - return dmt; + + return dmt; } - /* * Search for name in TAIL and return apropriate pointer. */ -static dm_target_t* +static dm_target_t * dm_target_lookup_name(const char *dm_target_name) { dm_target_t *dm_target; -int dlen; int slen; + int dlen; + int slen; slen = strlen(dm_target_name) + 1; @@ -138,24 +135,23 @@ dlen = strlen(dm_target->name) + 1; if (dlen != slen) continue; - + if (strncmp(dm_target_name, dm_target->name, slen) == 0) return dm_target; } return NULL; } - /* * Insert new target struct into the TAIL. * dm_target * contains name, version, function pointer to specifif target functions. */ int -dm_target_insert(dm_target_t *dm_target) +dm_target_insert(dm_target_t * dm_target) { dm_target_t *dmt; - + mutex_enter(&dm_target_mutex); dmt = dm_target_lookup_name(dm_target->name); @@ -163,11 +159,10 @@ mutex_exit(&dm_target_mutex); return EEXIST; } - TAILQ_INSERT_TAIL(&dm_target_list, dm_target, dm_target_next); mutex_exit(&dm_target_mutex); - + return 0; } @@ -179,32 +174,29 @@ dm_target_rem(char *dm_target_name) { dm_target_t *dmt; - + KASSERT(dm_target_name != NULL); mutex_enter(&dm_target_mutex); - + dmt = dm_target_lookup_name(dm_target_name); if (dmt == NULL) { mutex_exit(&dm_target_mutex); return ENOENT; } - if (dmt->ref_cnt > 0) { mutex_exit(&dm_target_mutex); return EBUSY; } - TAILQ_REMOVE(&dm_target_list, dmt, dm_target_next); mutex_exit(&dm_target_mutex); - - (void)kmem_free(dmt, sizeof(dm_target_t)); + + (void) kmem_free(dmt, sizeof(dm_target_t)); return 0; } - /* * Destroy all targets and remove them from queue. * This routine is called from dm_detach, before module @@ -216,38 +208,36 @@ dm_target_t *dm_target; mutex_enter(&dm_target_mutex); - while (TAILQ_FIRST(&dm_target_list) != NULL){ + while (TAILQ_FIRST(&dm_target_list) != NULL) { dm_target = TAILQ_FIRST(&dm_target_list); - + TAILQ_REMOVE(&dm_target_list, TAILQ_FIRST(&dm_target_list), - dm_target_next); - - (void)kmem_free(dm_target, sizeof(dm_target_t)); + dm_target_next); + + (void) kmem_free(dm_target, sizeof(dm_target_t)); } mutex_exit(&dm_target_mutex); - + mutex_destroy(&dm_target_mutex); - + return 0; } - /* * Allocate new target entry. */ -dm_target_t* +dm_target_t * dm_target_alloc(const char *name) { return kmem_
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Jan 4 00:19:08 UTC 2010 Modified Files: src/sys/dev/dm: dm_dev.c dm_ioctl.c dm_pdev.c dm_table.c Log Message: Indent files remove unnecessary blank lines, white spaces and KNFize code. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/dm_dev.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_ioctl.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/dm_pdev.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/dm_table.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/dev/dm/dm_dev.c diff -u src/sys/dev/dm/dm_dev.c:1.7 src/sys/dev/dm/dm_dev.c:1.8 --- src/sys/dev/dm/dm_dev.c:1.7 Tue Dec 29 23:37:48 2009 +++ src/sys/dev/dm/dm_dev.c Mon Jan 4 00:19:08 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_dev.c,v 1.7 2009/12/29 23:37:48 haad Exp $ */ +/*$NetBSD: dm_dev.c,v 1.8 2010/01/04 00:19:08 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -41,9 +41,9 @@ #include "netbsd-dm.h" #include "dm.h" -static dm_dev_t* dm_dev_lookup_name(const char *); -static dm_dev_t* dm_dev_lookup_uuid(const char *); -static dm_dev_t* dm_dev_lookup_minor(int); +static dm_dev_t *dm_dev_lookup_name(const char *); +static dm_dev_t *dm_dev_lookup_uuid(const char *); +static dm_dev_t *dm_dev_lookup_minor(int); static struct dm_dev_head dm_dev_list = TAILQ_HEAD_INITIALIZER(dm_dev_list); @@ -52,90 +52,88 @@ /* dm_dev_mutex must be holdby caller before using disable_dev. */ __inline static void -disable_dev(dm_dev_t *dmv) +disable_dev(dm_dev_t * dmv) { - TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist); -mutex_enter(&dmv->dev_mtx); -mutex_exit(&dm_dev_mutex); -while(dmv->ref_cnt != 0) - cv_wait(&dmv->dev_cv, &dmv->dev_mtx); -mutex_exit(&dmv->dev_mtx); -} - + TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist); + mutex_enter(&dmv->dev_mtx); + mutex_exit(&dm_dev_mutex); + while (dmv->ref_cnt != 0) + cv_wait(&dmv->dev_cv, &dmv->dev_mtx); + mutex_exit(&dmv->dev_mtx); +} /* - * Generic function used to lookup dm_dev_t. Calling with dm_dev_name + * Generic function used to lookup dm_dev_t. Calling with dm_dev_name * and dm_dev_uuid NULL is allowed. */ -dm_dev_t* +dm_dev_t * dm_dev_lookup(const char *dm_dev_name, const char *dm_dev_uuid, - int dm_dev_minor) +int dm_dev_minor) { dm_dev_t *dmv; - + dmv = NULL; mutex_enter(&dm_dev_mutex); - - /* KASSERT(dm_dev_name != NULL && dm_dev_uuid != NULL && dm_dev_minor > 0); */ + + /* KASSERT(dm_dev_name != NULL && dm_dev_uuid != NULL && dm_dev_minor + * > 0); */ if (dm_dev_minor > 0) - if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL){ + if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL) { dm_dev_busy(dmv); mutex_exit(&dm_dev_mutex); return dmv; } - - if (dm_dev_name != NULL) - if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL){ + if (dm_dev_name != NULL) + if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL) { dm_dev_busy(dmv); mutex_exit(&dm_dev_mutex); - return dmv; + return dmv; } - if (dm_dev_uuid != NULL) - if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL){ + if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL) { dm_dev_busy(dmv); mutex_exit(&dm_dev_mutex); return dmv; } - mutex_exit(&dm_dev_mutex); - return NULL; + mutex_exit(&dm_dev_mutex); + return NULL; } - + /* * Lookup device with its minor number. */ -static dm_dev_t* +static dm_dev_t * dm_dev_lookup_minor(int dm_dev_minor) { dm_dev_t *dmv; - - TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){ + + TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) { if (dm_dev_minor == dmv->minor) return dmv; } - + return NULL; } - /* * Lookup device with it's device name. */ -static dm_dev_t* +static dm_dev_t * dm_dev_lookup_name(const char *dm_dev_name) { dm_dev_t *dmv; - int dlen; int slen; + int dlen; + int slen; slen = strlen(dm_dev_name); if (slen == 0) return NULL; - - TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){ + + TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) { dlen = strlen(dmv->name); - - if(slen != dlen) + + if (slen != dlen) continue; if (strncmp(dm_dev_name, dmv->name, slen) == 0) @@ -144,62 +142,59 @@ return NULL; } - /* * Lookup device with it's device uuid. Used mostly by LVM2tools. */ -static dm_dev_t* +static dm_dev_t * dm_dev_lookup_uuid(const char *dm_dev_uuid) { dm_dev_t *dmv; size_t len; - + len = 0; len = strlen(dm_dev_uuid); - + if (len == 0) return NULL; - TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){ + TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) { if (strlen(dmv->uuid) != len) continue; - + if (strncmp(dm_dev_uuid, dmv->uuid, strlen(dmv->uuid)) == 0) return dmv; } return NULL; } - /* * Insert new device to the global list of d
CVS commit: src
Module Name:src Committed By: haad Date: Mon Jan 4 16:57:48 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile Log Message: Add device-mapper manual page to build and add it to apropriate lists. To generate a diff of this commit: cvs rdiff -u -r1.1178 -r1.1179 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.499 -r1.500 src/share/man/man4/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1178 src/distrib/sets/lists/man/mi:1.1179 --- src/distrib/sets/lists/man/mi:1.1178 Tue Dec 15 03:01:16 2009 +++ src/distrib/sets/lists/man/mi Mon Jan 4 16:57:48 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1178 2009/12/15 03:01:16 mrg Exp $ +# $NetBSD: mi,v 1.1179 2010/01/04 16:57:48 haad Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -858,7 +858,8 @@ ./usr/share/man/cat4/depca.0 man-sys-catman .cat ./usr/share/man/cat4/dge.0 man-sys-catman .cat ./usr/share/man/cat4/dk.0 man-sys-catman .cat -./usr/share/man/cat4/dmoverio.0 man-sys-catman .cat +./usr/share/man/cat4/dm.0 man-sys-catman .cat +./usr/share/man/cat4/dmoverio.0 man-sys-catman .cat ./usr/share/man/cat4/dmphy.0 man-sys-catman .cat ./usr/share/man/cat4/dpt.0 man-sys-catman .cat ./usr/share/man/cat4/dpti.0 man-sys-catman .cat @@ -3489,6 +3490,7 @@ ./usr/share/man/html4/depca.html man-sys-htmlman html ./usr/share/man/html4/dge.html man-sys-htmlman html ./usr/share/man/html4/dk.html man-sys-htmlman html +./usr/share/man/html4/dm.html man-sys-htmlman html ./usr/share/man/html4/dmoverio.html man-sys-htmlman html ./usr/share/man/html4/dmphy.html man-sys-htmlman html ./usr/share/man/html4/dpt.html man-sys-htmlman html @@ -4654,7 +4656,7 @@ ./usr/share/man/html8/iteconfig.html man-sysutil-htmlman html ./usr/share/man/html8/iwictl.html man-sysutil-htmlman html ./usr/share/man/html8/kadmin.html man-krb5-htmlman kerberos,html -./usr/share/man/html8/kadmind.html man-krb5-htmlman kerberos,html +./usr/share/man/html8/kamind.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kcm.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kdc.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kerberos.html man-krb5-htmlman kerberos,html @@ -5898,6 +5900,7 @@ ./usr/share/man/man4/depca.4 man-sys-man .man ./usr/share/man/man4/dge.4 man-sys-man .man ./usr/share/man/man4/dk.4 man-sys-man .man +./usr/share/man/man4/dm.4 man-sys-man .man ./usr/share/man/man4/dmoverio.4 man-sys-man .man ./usr/share/man/man4/dmphy.4 man-sys-man .man ./usr/share/man/man4/dpt.4 man-sys-man .man Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.499 src/share/man/man4/Makefile:1.500 --- src/share/man/man4/Makefile:1.499 Wed Sep 30 22:32:04 2009 +++ src/share/man/man4/Makefile Mon Jan 4 16:57:48 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.499 2009/09/30 22:32:04 jmcneill Exp $ +# $NetBSD: Makefile,v 1.500 2010/01/04 16:57:48 haad Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 acpidalb.4 \ @@ -19,7 +19,7 @@ cec.4 cgd.4 cfb.4 ch.4 chipsfb.4 ciphy.4 ciss.4 clcs.4 clct.4 clnp.4 \ clockctl.4 cltp.4 cmdide.4 cmpci.4 cms.4 cnw.4 \ com.4 coretemp.4 crypto.4 cs80bus.4 cuda.4 cypide.4 \ - ddb.4 ddc.4 de.4 dge.4 dk.4 dmoverio.4 \ + ddb.4 ddc.4 de.4 dge.4 dk.4 dm.4 dmoverio.4 \ dmphy.4 dpt.4 dpti.4 drm.4 drum.4 \ eap.4 ebus.4 edc.4 elmc.4 emuxki.4 en.4 envsys.4 ep.4 esh.4 esis.4 \ esa.4 esiop.4 esm.4 eso.4 etherip.4 exphy.4 \
CVS commit: src/distrib/sets/lists/man
Module Name:src Committed By: haad Date: Mon Jan 4 20:18:02 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi Log Message: Revert my unattended change to kadmind.html page To generate a diff of this commit: cvs rdiff -u -r1.1179 -r1.1180 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1179 src/distrib/sets/lists/man/mi:1.1180 --- src/distrib/sets/lists/man/mi:1.1179 Mon Jan 4 16:57:48 2010 +++ src/distrib/sets/lists/man/mi Mon Jan 4 20:18:02 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1179 2010/01/04 16:57:48 haad Exp $ +# $NetBSD: mi,v 1.1180 2010/01/04 20:18:02 haad Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4656,7 +4656,7 @@ ./usr/share/man/html8/iteconfig.html man-sysutil-htmlman html ./usr/share/man/html8/iwictl.html man-sysutil-htmlman html ./usr/share/man/html8/kadmin.html man-krb5-htmlman kerberos,html -./usr/share/man/html8/kamind.html man-krb5-htmlman kerberos,html +./usr/share/man/html8/kadmind.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kcm.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kdc.html man-krb5-htmlman kerberos,html ./usr/share/man/html8/kerberos.html man-krb5-htmlman kerberos,html @@ -5900,7 +5900,7 @@ ./usr/share/man/man4/depca.4 man-sys-man .man ./usr/share/man/man4/dge.4 man-sys-man .man ./usr/share/man/man4/dk.4 man-sys-man .man -./usr/share/man/man4/dm.4 man-sys-man .man +./usr/share/man/man4/dm.4 man-sys-man .man ./usr/share/man/man4/dmoverio.4 man-sys-man .man ./usr/share/man/man4/dmphy.4 man-sys-man .man ./usr/share/man/man4/dpt.4 man-sys-man .man
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Sun Jan 10 01:35:39 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_replay.c Log Message: Fix problem in ZFS ZIL layer where unclean shutdown of filesystem can change replayed file permissions to 777. Patch from FreeBSD. Original commit message: Be careful which vattr fields are set during setattr replay. Without this fix strange things can appear after unclean shutdown like files with mode set to 0. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c Sun Jan 10 01:35:39 2010 @@ -60,10 +60,14 @@ { VATTR_NULL(vap); vap->va_mask = (uint_t)mask; - vap->va_type = IFTOVT(mode); - vap->va_mode = mode & MODEMASK; - vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid; - vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid; + if (mask & AT_TYPE) + vap->va_type = IFTOVT(mode); + if (mask & AT_MODE) + vap->va_mode = mode & MODEMASK; + if (mask & AT_UID) + vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid; + if (mask & AT_GID) + vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid; vap->va_rdev = zfs_cmpldev(rdev); vap->va_nodeid = nodeid; }
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: haad Date: Sun Jan 17 12:08:29 UTC 2010 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: Fix problem where xbdi->xbdi_size was set to 0 after succesfull DIOCGWEDGEINFO call. Problem reported in private mail. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/xen/xen/xbdback_xenbus.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/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.29 src/sys/arch/xen/xen/xbdback_xenbus.c:1.30 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.29 Tue Dec 15 00:19:52 2009 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sun Jan 17 12:08:29 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.29 2009/12/15 00:19:52 haad Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.30 2010/01/17 12:08:29 haad Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.29 2009/12/15 00:19:52 haad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.30 2010/01/17 12:08:29 haad Exp $"); #include #include @@ -731,9 +731,9 @@ "for domain %d\n", wi.dkw_devname, xbdi->xbdi_size, xbdi->xbdi_domid); } - /* ENOTTY should be returned only when device doesn't implement - DIOCGWEDGEINFO and we are working with non wedge like device. */ - if (err != ENOTTY) { + if ((err != 0) && (err != ENOTTY)) { + /* ENOTTY should be returned only when device doesn't implement + DIOCGWEDGEINFO and we are working with non wedge like device. */ printf("xbdback %s: can't DIOCGWEDGEINFO device " "0x%"PRIx64": %d\n", xbusd->xbusd_path, xbdi->xbdi_dev, err);
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: haad Date: Sun Jan 24 04:06:31 UTC 2010 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: Finaly fix problems with using WEDGE like devices as xen backend devices. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/xen/xbdback_xenbus.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/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.30 src/sys/arch/xen/xen/xbdback_xenbus.c:1.31 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.30 Sun Jan 17 12:08:29 2010 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sun Jan 24 04:06:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.30 2010/01/17 12:08:29 haad Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.31 2010/01/24 04:06:31 haad Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.30 2010/01/17 12:08:29 haad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.31 2010/01/24 04:06:31 haad Exp $"); #include #include @@ -730,35 +730,29 @@ printf("xbd backend: attach device %s (size %" PRIu64 ") " "for domain %d\n", wi.dkw_devname, xbdi->xbdi_size, xbdi->xbdi_domid); - } - if ((err != 0) && (err != ENOTTY)) { - /* ENOTTY should be returned only when device doesn't implement - DIOCGWEDGEINFO and we are working with non wedge like device. */ - printf("xbdback %s: can't DIOCGWEDGEINFO device " - "0x%"PRIx64": %d\n", xbusd->xbusd_path, - xbdi->xbdi_dev, err); - xbdi->xbdi_size = xbdi->xbdi_dev = 0; - vn_close(xbdi->xbdi_vp, FREAD, NOCRED); - xbdi->xbdi_vp = NULL; - return; - } else { + } else { /* disk device, get partition data */ struct partinfo dpart; - err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGPART, &dpart, FREAD, 0); - if (err) { - printf("xbdback %s: can't DIOCGPART device 0x%"PRIx64": %d\n", - xbusd->xbusd_path, xbdi->xbdi_dev, err); - xbdi->xbdi_size = xbdi->xbdi_dev = 0; - vn_close(xbdi->xbdi_vp, FREAD, NOCRED); - xbdi->xbdi_vp = NULL; - return; - } + if ((err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGPART, &dpart, + FREAD, 0)) == 0) { xbdi->xbdi_size = dpart.part->p_size; printf("xbd backend: attach device %s%"PRId32 "%c (size %" PRIu64 ") for domain %d\n", devname, DISKUNIT(xbdi->xbdi_dev), (char)DISKPART(xbdi->xbdi_dev) + 'a', xbdi->xbdi_size, xbdi->xbdi_domid); + } + } + + if (err != 0) { + /* If both Ioctls failed set device size to 0 and return */ + printf("xbdback %s: can't DIOCGWEDGEINFO device " + "0x%"PRIx64": %d\n", xbusd->xbusd_path, + xbdi->xbdi_dev, err); + xbdi->xbdi_size = xbdi->xbdi_dev = 0; + vn_close(xbdi->xbdi_vp, FREAD, NOCRED); + xbdi->xbdi_vp = NULL; + return; } again: xbt = xenbus_transaction_start();
CVS commit: src
Module Name:src Committed By: haad Date: Thu Feb 11 23:13:46 UTC 2010 Modified Files: src/share/man/man9: kmem.9 src/sys/kern: subr_kmem.c src/sys/sys: kmem.h Log Message: Add kmem_asprintf rotuine which allocates string accordingly to format string from kmem pool. Allocated string is string length + 1 char for ending zero. Ok: a...@. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/kmem.9 cvs rdiff -u -r1.32 -r1.33 src/sys/kern/subr_kmem.c cvs rdiff -u -r1.3 -r1.4 src/sys/sys/kmem.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/kmem.9 diff -u src/share/man/man9/kmem.9:1.4 src/share/man/man9/kmem.9:1.5 --- src/share/man/man9/kmem.9:1.4 Sat Jan 23 00:54:43 2010 +++ src/share/man/man9/kmem.9 Thu Feb 11 23:13:46 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: kmem.9,v 1.4 2010/01/23 00:54:43 rmind Exp $ +.\" $NetBSD: kmem.9,v 1.5 2010/02/11 23:13:46 haad Exp $ .\" .\" Copyright (c)2006 YAMAMOTO Takashi, .\" All rights reserved. @@ -45,6 +45,9 @@ .Ft void .Fn kmem_free \ "void *p" "size_t size" +.Ft char * +.Fn kmem_asprintf \ +"const char *fmt" "..." .\" .Pp .Cd "options DEBUG" @@ -93,6 +96,16 @@ except that it initializes the memory to zero. .Pp .\" +.Fn kmem_asprintf +functions as the well known +.Fn asprintf +function, but allocates memory using +.Fn kmem_alloc . +This routine can sleep during allocation. +The size of the allocated area is the length of the returned character string, plus one (for the NUL terminator). +This must be taken into consideration when freeing the returned area with +.Fn kmem_free . +.\" .Fn kmem_free frees kernel wired memory allocated by .Fn kmem_alloc Index: src/sys/kern/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.32 src/sys/kern/subr_kmem.c:1.33 --- src/sys/kern/subr_kmem.c:1.32 Sun Jan 31 11:54:32 2010 +++ src/sys/kern/subr_kmem.c Thu Feb 11 23:13:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.32 2010/01/31 11:54:32 skrll Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.33 2010/02/11 23:13:46 haad Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.32 2010/01/31 11:54:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.33 2010/02/11 23:13:46 haad Exp $"); #include #include @@ -79,6 +79,8 @@ #include +#include + #define KMEM_QUANTUM_SIZE (ALIGNBYTES + 1) #define KMEM_QCACHE_MAX (KMEM_QUANTUM_SIZE * 32) #define KMEM_CACHE_COUNT 16 @@ -456,3 +458,28 @@ } } #endif /* defined(KMEM_SIZE) */ + +/* + * Used to dynamically allocate string with kmem accordingly to format. + */ +char * +kmem_asprintf(const char *fmt, ...) +{ + int size, str_len; + va_list va; + char *str; + char buf[1]; + + va_start(va, fmt); + str_len = vsnprintf(buf, sizeof(buf), fmt, va) + 1; + va_end(va); + + str = kmem_alloc(str_len, KM_SLEEP); + + if ((size = vsnprintf(str, str_len, fmt, va)) == -1) { + kmem_free(str, str_len); + return NULL; + } + + return str; +} Index: src/sys/sys/kmem.h diff -u src/sys/sys/kmem.h:1.3 src/sys/sys/kmem.h:1.4 --- src/sys/sys/kmem.h:1.3 Mon Dec 24 16:45:16 2007 +++ src/sys/sys/kmem.h Thu Feb 11 23:13:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kmem.h,v 1.3 2007/12/24 16:45:16 ad Exp $ */ +/* $NetBSD: kmem.h,v 1.4 2010/02/11 23:13:46 haad Exp $ */ /*- * Copyright (c)2006 YAMAMOTO Takashi, @@ -39,6 +39,7 @@ void kmem_init(void); size_t kmem_roundup_size(size_t); +char *kmem_asprintf(const char *, ...); /* * km_flag_t *
CVS commit: src
Module Name:src Committed By: haad Date: Thu Feb 11 23:16:35 UTC 2010 Modified Files: src/share/man/man9: vnode.9 src/sys/kern: vfs_subr.c src/sys/sys: vnode.h Log Message: Add vrele_async routine which asynchronously release vnodes in different contex and in some time in the future. Ok: a...@. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/share/man/man9/vnode.9 cvs rdiff -u -r1.397 -r1.398 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.213 -r1.214 src/sys/sys/vnode.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/vnode.9 diff -u src/share/man/man9/vnode.9:1.44 src/share/man/man9/vnode.9:1.45 --- src/share/man/man9/vnode.9:1.44 Fri Jan 8 13:15:46 2010 +++ src/share/man/man9/vnode.9 Thu Feb 11 23:16:35 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: vnode.9,v 1.44 2010/01/08 13:15:46 pooka Exp $ +.\" $NetBSD: vnode.9,v 1.45 2010/02/11 23:16:35 haad Exp $ .\" .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,6 +34,7 @@ .Nm vnode , .Nm vref , .Nm vrele , +.Nm vrele_async , .Nm vget , .Nm vput , .Nm vhold , @@ -62,6 +63,8 @@ .Fn vref "struct vnode *vp" .Ft void .Fn vrele "struct vnode *vp" +.Ft void +.Fn vrele_async "struct vnode *vp" .Ft int .Fn vget "struct vnode *vp" "int lockflag" .Ft void @@ -246,6 +249,7 @@ This count is maintained by .Fn vref , .Fn vrele , +.Fn vrele_async , and .Fn vput . The second is the number of active references within the kernel to the @@ -531,6 +535,8 @@ .Em v_holdcnt are zero, the vnode is placed on the freelist. .It Fn vget "vp" "lockflags" +.It Fn vrele_async "vp" +Will asychronously release vnode in different context than caller, sometime in future. Reclaim vnode .Fa vp from the freelist, increment its reference count and lock it. Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.397 src/sys/kern/vfs_subr.c:1.398 --- src/sys/kern/vfs_subr.c:1.397 Fri Jan 15 19:28:26 2010 +++ src/sys/kern/vfs_subr.c Thu Feb 11 23:16:35 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.397 2010/01/15 19:28:26 bouyer Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.398 2010/02/11 23:16:35 haad Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.397 2010/01/15 19:28:26 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.398 2010/02/11 23:16:35 haad Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -1424,8 +1424,12 @@ /* * XXX This ugly block can be largely eliminated if * locking is pushed down into the file systems. + * + * Defer vnode release to vrele_thread if caller + * requests it explicitly. */ - if (curlwp == uvm.pagedaemon_lwp) { + if ((curlwp == uvm.pagedaemon_lwp) || + (flags & VRELEL_ASYNC_RELE) != 0) { /* The pagedaemon can't wait around; defer. */ defer = true; } else if (curlwp == vrele_lwp) { @@ -1599,6 +1603,23 @@ vrelel(vp, 0); } +/* + * Asynchronous vnode release, vnode is released in different context. + */ +void +vrele_async(vnode_t *vp) +{ + + KASSERT((vp->v_iflag & VI_MARKER) == 0); + + if ((vp->v_iflag & VI_INACTNOW) == 0 && vtryrele(vp)) { + return; + } + + mutex_enter(&vp->v_interlock); + vrelel(vp, VRELEL_ASYNC_RELE); +} + static void vrele_thread(void *cookie) { Index: src/sys/sys/vnode.h diff -u src/sys/sys/vnode.h:1.213 src/sys/sys/vnode.h:1.214 --- src/sys/sys/vnode.h:1.213 Wed Jan 27 15:34:08 2010 +++ src/sys/sys/vnode.h Thu Feb 11 23:16:35 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode.h,v 1.213 2010/01/27 15:34:08 uebayasi Exp $ */ +/* $NetBSD: vnode.h,v 1.214 2010/02/11 23:16:35 haad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -601,6 +601,7 @@ void vput(struct vnode *); int vrecycle(struct vnode *, kmutex_t *, struct lwp *); void vrele(struct vnode *); +void vrele_async(struct vnode *); int vtruncbuf(struct vnode *, daddr_t, bool, int); void vwakeup(struct buf *); void vwait(struct vnode *, int); @@ -609,6 +610,7 @@ void vrelel(struct vnode *, int); #define VRELEL_NOINACTIVE 0x01 #define VRELEL_ONHEAD 0x02 +#define VRELEL_ASYNC_RELE 0x03 struct vnode * vnalloc(struct mount *); void vnfree(struct vnode *);
CVS commit: src
Module Name:src Committed By: haad Date: Thu Feb 11 23:28:53 UTC 2010 Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile Log Message: Hook kmem_asprintf and vrele_async manpages to the build. To generate a diff of this commit: cvs rdiff -u -r1.1388 -r1.1389 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.314 -r1.315 src/share/man/man9/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1388 src/distrib/sets/lists/comp/mi:1.1389 --- src/distrib/sets/lists/comp/mi:1.1388 Thu Feb 11 02:29:23 2010 +++ src/distrib/sets/lists/comp/mi Thu Feb 11 23:28:53 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1388 2010/02/11 02:29:23 pooka Exp $ +# $NetBSD: mi,v 1.1389 2010/02/11 23:28:53 haad Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -8999,6 +8999,7 @@ ./usr/share/man/cat9/kmem_alloc.0 comp-sys-catman .cat ./usr/share/man/cat9/kmem_free.0 comp-sys-catman .cat ./usr/share/man/cat9/kmem_zalloc.0 comp-sys-catman .cat +./usr/share/man/cat9/kmem_asprintf.0 comp-sys-catman .cat ./usr/share/man/cat9/knote.0 comp-sys-catman .cat ./usr/share/man/cat9/kpause.0 comp-sys-catman .cat ./usr/share/man/cat9/kpreempt.0 comp-sys-catman .cat @@ -9652,6 +9653,7 @@ ./usr/share/man/cat9/vrecycle.0 comp-sys-catman .cat ./usr/share/man/cat9/vref.0 comp-sys-catman .cat ./usr/share/man/cat9/vrele.0 comp-sys-catman .cat +./usr/share/man/cat9/vrele_async.0 comp-sys-catman .cat ./usr/share/man/cat9/vslock.0 comp-obsolete obsolete ./usr/share/man/cat9/vsnprintf.0 comp-sys-catman .cat ./usr/share/man/cat9/vsprintf.0 comp-sys-catman .cat @@ -14574,6 +14576,7 @@ ./usr/share/man/html9/kmem_alloc.html comp-sys-htmlman html ./usr/share/man/html9/kmem_free.html comp-sys-htmlman html ./usr/share/man/html9/kmem_zalloc.html comp-sys-htmlman html +./usr/share/man/html9/kmem_asprintf.html comp-sys-htmlman html ./usr/share/man/html9/knote.html comp-sys-htmlman html ./usr/share/man/html9/kpause.html comp-sys-htmlman html ./usr/share/man/html9/kpreempt.html comp-sys-htmlman html @@ -15179,6 +15182,7 @@ ./usr/share/man/html9/vrecycle.html comp-sys-htmlman html ./usr/share/man/html9/vref.html comp-sys-htmlman html ./usr/share/man/html9/vrele.html comp-sys-htmlman html +./usr/share/man/html9/vrele_async.html comp-sys-htmlman html ./usr/share/man/html9/vsnprintf.html comp-sys-htmlman html ./usr/share/man/html9/vsprintf.html comp-sys-htmlman html ./usr/share/man/html9/vtruncbuf.html comp-sys-htmlman html @@ -20308,6 +20312,7 @@ ./usr/share/man/man9/kmem_alloc.9 comp-sys-man .man ./usr/share/man/man9/kmem_free.9 comp-sys-man .man ./usr/share/man/man9/kmem_zalloc.9 comp-sys-man .man +./usr/share/man/man9/kmem_asprintf.9 comp-sys-man .man ./usr/share/man/man9/knote.9 comp-sys-man .man ./usr/share/man/man9/kpause.9 comp-sys-man .man ./usr/share/man/man9/kpreempt.9 comp-sys-man .man @@ -20961,6 +20966,7 @@ ./usr/share/man/man9/vrecycle.9 comp-sys-man .man ./usr/share/man/man9/vref.9 comp-sys-man .man ./usr/share/man/man9/vrele.9 comp-sys-man .man +./usr/share/man/man9/vrele_async.9 comp-sys-man .man ./usr/share/man/man9/vslock.9 comp-obsolete obsolete ./usr/share/man/man9/vsnprintf.9 comp-sys-man .man ./usr/share/man/man9/vsprintf.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.314 src/share/man/man9/Makefile:1.315 --- src/share/man/man9/Makefile:1.314 Sat Feb 6 22:32:08 2010 +++ src/share/man/man9/Makefile Thu Feb 11 23:28:53 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.314 2010/02/06 22:32:08 dyoung Exp $ +# $NetBSD: Makefile,v 1.315 2010/02/11 23:28:53 haad Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -345,7 +345,7 @@ isapnp.9 isapnp_unconfig.9 MLINKS+=knote.9 KNOTE.9 \ kfilter_register.9 kfilter_unregister.9 -MLINKS+=kmem.9 kmem_alloc.9 kmem.9 kmem_free.9 kmem.9 kmem_zalloc.9 +MLINKS+=kmem.9 kmem_alloc.9 kmem.9 kmem_free.9 kmem.9 kmem_zalloc.9 kmem_asprintf.9 MAN+= kpreempt.9 MLINKS+=kpreempt.9 kpreempt_disable.9 \ kpreempt.9 kpreempt_disabled.9 \ @@ -756,6 +756,7 @@ vmem.9 vmem_xfree.9 MLINKS+=vnode.9 vref.9 \ vnode.9 vrele.9 \ + vnode.9 vrele_async.9 \ vnode.9 vget.9 \ vnode.9 vput.9 \ vnode.9 vhold.9 \
CVS commit: src/external/gpl2/lvm2/dist/libdm/ioctl
Module Name:src Committed By: haad Date: Fri Mar 12 16:24:40 UTC 2010 Modified Files: src/external/gpl2/lvm2/dist/libdm/ioctl: libdm-nbsd-iface.c Log Message: Fix /var/run/dev.db dependency by adding new get_dev_name routine which converts raw device major:minor number to block device path. By reading /dev and using stat to find block device major:minor numbers. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.6 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.7 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.6 Wed Dec 9 00:15:51 2009 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Fri Mar 12 16:24:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm-nbsd-iface.c,v 1.6 2009/12/09 00:15:51 haad Exp $*/ +/* $NetBSD: libdm-nbsd-iface.c,v 1.7 2010/03/12 16:24:40 haad Exp $*/ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. @@ -358,6 +358,45 @@ return 1; } +static char * +get_dev_name(char *d_name, uint32_t d_major, uint32_t d_minor) +{ + static char d_buf[MAXPATHLEN]; + struct dirent *dire; + struct stat st; + DIR *dev_dir; + + int err; + char *name; + + dev_dir = opendir("/dev"); + + while ((dire = readdir(dev_dir)) != NULL) { + + if (strstr(dire->d_name, d_name) == NULL) + continue; + + snprintf(d_buf, MAXPATHLEN, "/dev/%s", dire->d_name); + + if ((err = stat(d_buf, &st)) < 0) + printf("stat failed with %d", err); + + if (st.st_mode & S_IFBLK){ + if ((major(st.st_rdev) == d_major) && (minor(st.st_rdev) == d_minor)) { +strncpy(d_buf, dire->d_name, strlen(dire->d_name) + 1); +name = d_buf; +break; + } + } + + memset(d_buf, '0', sizeof(d_buf)); + } + + (void)closedir(dev_dir); + + return name; +} + /* * @dev_major is major number of char device * @@ -409,16 +448,17 @@ dev = MKDEV(major,dev_minor); mode |= S_IFBLK; - - name = devname(dev,mode); + + if ((name = devname(dev,mode)) == NULL) + name = get_dev_name(kd[i].d_name, major, dev_minor); r = snprintf(buf, (size_t) bufsize, "/dev/%s",name); free(kd); - + if (r < 0 || r > bufsize - 1 || name == NULL) return 0; - + return 1; }
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Fri Mar 12 16:26:26 UTC 2010 Modified Files: src/sys/dev/dm: device-mapper.c Log Message: Disable disk_ioctl_switch fo device-mapper control device. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c diff -u src/sys/dev/dm/device-mapper.c:1.19 src/sys/dev/dm/device-mapper.c:1.20 --- src/sys/dev/dm/device-mapper.c:1.19 Sat Feb 27 00:31:57 2010 +++ src/sys/dev/dm/device-mapper.c Fri Mar 12 16:26:26 2010 @@ -1,4 +1,4 @@ -/*$NetBSD: device-mapper.c,v 1.19 2010/02/27 00:31:57 jakllsch Exp $ */ +/*$NetBSD: device-mapper.c,v 1.20 2010/03/12 16:26:26 haad Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -424,6 +424,10 @@ { dm_dev_t *dmv; + /* disk ioctls make sense only on block devices */ + if (minor(dev) == 0) + return ENOTTY; + switch(cmd) { case DIOCGWEDGEINFO: {
CVS commit: src/share/mk
Module Name:src Committed By: haad Date: Sat Mar 13 17:07:28 UTC 2010 Modified Files: src/share/mk: bsd.own.mk Log Message: Enable MKZFS by default on i386 and amd64 now when it compiles. To generate a diff of this commit: cvs rdiff -u -r1.621 -r1.622 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.621 src/share/mk/bsd.own.mk:1.622 --- src/share/mk/bsd.own.mk:1.621 Mon Mar 8 09:32:18 2010 +++ src/share/mk/bsd.own.mk Sat Mar 13 17:07:28 2010 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.621 2010/03/08 09:32:18 he Exp $ +# $NetBSD: bsd.own.mk,v 1.622 2010/03/13 17:07:28 haad Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -725,7 +725,7 @@ MKMANDOC MKMANZ MKOBJDIRS \ MKPCC MKPCCCMDS \ MKSOFTFLOAT MKSTRIPIDENT \ - MKUNPRIVED MKUPDATE MKX11 MKZFS + MKUNPRIVED MKUPDATE MKX11 .for var in ${_MKVARS.no} ${var}?=no .endfor
CVS commit: src/sys/arch
Module Name:src Committed By: haad Date: Thu Aug 12 20:16:28 UTC 2010 Modified Files: src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU src/sys/arch/i386/conf: XEN3_DOM0 XEN3_DOMU Log Message: dd dm driver to XEN configs because they do not have modules working yet. This will enable using LVM by default on XEN DOM0 hostings running NetBSD. Change suggested by Sam Fourman. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/amd64/conf/XEN3_DOM0 cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/conf/XEN3_DOMU cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/conf/XEN3_DOM0 cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/conf/XEN3_DOMU Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/XEN3_DOM0 diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.56 src/sys/arch/amd64/conf/XEN3_DOM0:1.57 --- src/sys/arch/amd64/conf/XEN3_DOM0:1.56 Tue Jul 6 15:00:09 2010 +++ src/sys/arch/amd64/conf/XEN3_DOM0 Thu Aug 12 20:16:27 2010 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOM0,v 1.56 2010/07/06 15:00:09 cherry Exp $ +# $NetBSD: XEN3_DOM0,v 1.57 2010/08/12 20:16:27 haad Exp $ include "arch/amd64/conf/std.xen" @@ -786,6 +786,7 @@ pseudo-device md 1 # memory disk device (ramdisk) pseudo-device vnd # disk-like interface to files pseudo-device putter # for puffs and pud +pseudo-device dm # device-mapper driver for LVM # network pseudo-devices pseudo-device bpfilter # Berkeley packet filter Index: src/sys/arch/amd64/conf/XEN3_DOMU diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.24 src/sys/arch/amd64/conf/XEN3_DOMU:1.25 --- src/sys/arch/amd64/conf/XEN3_DOMU:1.24 Tue Jul 6 15:00:09 2010 +++ src/sys/arch/amd64/conf/XEN3_DOMU Thu Aug 12 20:16:28 2010 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOMU,v 1.24 2010/07/06 15:00:09 cherry Exp $ +# $NetBSD: XEN3_DOMU,v 1.25 2010/08/12 20:16:28 haad Exp $ include "arch/amd64/conf/std.xen" @@ -195,6 +195,7 @@ pseudo-device md 1 # memory disk device (ramdisk) pseudo-device vnd # disk-like interface to files +pseudo-device dm # device-mapper driver for LVM # network pseudo-devices pseudo-device bpfilter # Berkeley packet filter Index: src/sys/arch/i386/conf/XEN3_DOM0 diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.36 src/sys/arch/i386/conf/XEN3_DOM0:1.37 --- src/sys/arch/i386/conf/XEN3_DOM0:1.36 Tue Jul 6 15:00:09 2010 +++ src/sys/arch/i386/conf/XEN3_DOM0 Thu Aug 12 20:16:27 2010 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOM0,v 1.36 2010/07/06 15:00:09 cherry Exp $ +# $NetBSD: XEN3_DOM0,v 1.37 2010/08/12 20:16:27 haad Exp $ # # XEN3_0: Xen 3.0 domain0 kernel @@ -762,6 +762,7 @@ pseudo-device md 1 # memory disk device (ramdisk) pseudo-device vnd # disk-like interface to files +pseudo-device dm # device-mapper driver for LVM # network pseudo-devices pseudo-device bpfilter # Berkeley packet filter Index: src/sys/arch/i386/conf/XEN3_DOMU diff -u src/sys/arch/i386/conf/XEN3_DOMU:1.25 src/sys/arch/i386/conf/XEN3_DOMU:1.26 --- src/sys/arch/i386/conf/XEN3_DOMU:1.25 Tue Jul 6 15:00:09 2010 +++ src/sys/arch/i386/conf/XEN3_DOMU Thu Aug 12 20:16:27 2010 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOMU,v 1.25 2010/07/06 15:00:09 cherry Exp $ +# $NetBSD: XEN3_DOMU,v 1.26 2010/08/12 20:16:27 haad Exp $ include "arch/xen/conf/std.xen" @@ -209,6 +209,7 @@ pseudo-device md 1 # memory disk device (ramdisk) pseudo-device vnd # disk-like interface to files +pseudo-device dm # device-mapper driver for LVM # network pseudo-devices pseudo-device bpfilter # Berkeley packet filter
CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: haad Date: Tue Mar 24 22:05:24 UTC 2009 Modified Files: src/sys/fs/ptyfs: ptyfs_subr.c Log Message: Destroy mutexes used to guard hash table during vfs_detach. Fixes LOCKDEBUG panic when ptyfs module is unloaded. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/fs/ptyfs/ptyfs_subr.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/fs/ptyfs/ptyfs_subr.c diff -u src/sys/fs/ptyfs/ptyfs_subr.c:1.17 src/sys/fs/ptyfs/ptyfs_subr.c:1.18 --- src/sys/fs/ptyfs/ptyfs_subr.c:1.17 Wed Dec 17 20:51:35 2008 +++ src/sys/fs/ptyfs/ptyfs_subr.c Tue Mar 24 22:05:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_subr.c,v 1.17 2008/12/17 20:51:35 cegger Exp $ */ +/* $NetBSD: ptyfs_subr.c,v 1.18 2009/03/24 22:05:24 haad Exp $ */ /* * Copyright (c) 1993 @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.17 2008/12/17 20:51:35 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.18 2009/03/24 22:05:24 haad Exp $"); #include #include @@ -313,7 +313,10 @@ void ptyfs_hashdone(void) { - + + mutex_destroy(&ptyfs_hashlock); + mutex_destroy(&ptyfs_used_slock); + mutex_destroy(&ptyfs_free_slock); hashdone(ptyfs_used_tbl, HASH_LIST, ptyfs_used_mask); hashdone(ptyfs_free_tbl, HASH_LIST, ptyfs_free_mask); }
CVS commit: src/common/lib/libprop
Module Name:src Committed By: haad Date: Mon Mar 30 07:42:52 UTC 2009 Modified Files: src/common/lib/libprop: prop_object.c Log Message: Fix crash where user was able to crash proplib with trying to internalize bad xml file with non-existing data type e.g. . Problem is that poi is not NULL even in case that we haven't find any match in data type name. We need to check if poi->poi_tag is not NULL before calling poi->poi_intern function which is non existing case NULL and will cause crash. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/common/lib/libprop/prop_object.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_object.c diff -u src/common/lib/libprop/prop_object.c:1.25 src/common/lib/libprop/prop_object.c:1.26 --- src/common/lib/libprop/prop_object.c:1.25 Sun Jan 25 14:22:52 2009 +++ src/common/lib/libprop/prop_object.c Mon Mar 30 07:42:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_object.c,v 1.25 2009/01/25 14:22:52 lukem Exp $ */ +/* $NetBSD: prop_object.c,v 1.26 2009/03/30 07:42:51 haad Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -627,7 +627,7 @@ poi->poi_taglen)) break; } - if (poi == NULL) { + if ((poi == NULL) || (poi->poi_tag == NULL)) { while (_prop_stack_pop(&stack, &obj, &iter, &data, NULL)) { iter_func = (prop_object_internalizer_continue_t)iter; (*iter_func)(&stack, &obj, ctx, data, NULL);
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Apr 6 22:48:26 UTC 2009 Modified Files: src/sys/dev/dm: dm_target_stripe.c Log Message: Fix build on amd64. Patch sent by dieter roelants. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm_target_stripe.c diff -u src/sys/dev/dm/dm_target_stripe.c:1.4 src/sys/dev/dm/dm_target_stripe.c:1.5 --- src/sys/dev/dm/dm_target_stripe.c:1.4 Sat Mar 7 22:17:18 2009 +++ src/sys/dev/dm/dm_target_stripe.c Mon Apr 6 22:48:26 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_target_stripe.c,v 1.4 2009/03/07 22:17:18 reinoud Exp $*/ +/*$NetBSD: dm_target_stripe.c,v 1.5 2009/04/06 22:48:26 haad Exp $*/ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -177,7 +177,8 @@ if ((params = kmem_alloc(tsc->params_len, KM_NOSLEEP)) == NULL) return NULL; - snprintf(params, tsc->params_len, "%d %lld %s %lld %s %lld", tsc->stripe_num, tsc->stripe_chunksize, + snprintf(params, tsc->params_len, "%d %"PRIu64" %s %"PRIu64" %s %"PRIu64, + tsc->stripe_num, tsc->stripe_chunksize, tsc->stripe_devs[0].pdev->name, tsc->stripe_devs[0].offset, tsc->stripe_devs[1].pdev->name, tsc->stripe_devs[1].offset);
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Apr 6 22:58:10 UTC 2009 Modified Files: src/sys/dev/dm: device-mapper.c dm_ioctl.c Log Message: Use functions from disk(9) framework. Initialize disk/disklabel during dm_device_create_ioctl, before calling dmgetdisklabel. Use disk_busy/disk_unbusy in dmstrategy to display LVM LV's in iostat output. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/device-mapper.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_ioctl.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/dev/dm/device-mapper.c diff -u src/sys/dev/dm/device-mapper.c:1.5 src/sys/dev/dm/device-mapper.c:1.6 --- src/sys/dev/dm/device-mapper.c:1.5 Thu Jan 22 04:56:06 2009 +++ src/sys/dev/dm/device-mapper.c Mon Apr 6 22:58:10 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: device-mapper.c,v 1.5 2009/01/22 04:56:06 agc Exp $ */ +/*$NetBSD: device-mapper.c,v 1.6 2009/04/06 22:58:10 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -55,7 +55,6 @@ static dev_type_write(dmwrite); static dev_type_ioctl(dmioctl); static dev_type_strategy(dmstrategy); -static dev_type_dump(dmdump); static dev_type_size(dmsize); /* attach and detach routines */ @@ -69,12 +68,31 @@ /* ***Variable-definitions*** */ const struct bdevsw dm_bdevsw = { - dmopen, dmclose, dmstrategy, dmioctl, dmdump, dmsize, D_DISK | D_MPSAFE + .d_open = dmopen, + .d_close = dmclose, + .d_strategy = dmstrategy, + .d_ioctl = dmioctl, + .d_dump = nodump, + .d_psize = dmsize, + .d_flag = D_DISK | D_MPSAFE }; const struct cdevsw dm_cdevsw = { - dmopen, dmclose, dmread, dmwrite, dmioctl, - nostop, notty, nopoll, nommap, nokqfilter, D_DISK | D_MPSAFE + .d_open = dmopen, + .d_close = dmclose, + .d_read = dmread, + .d_write = dmwrite, + .d_ioctl = dmioctl, + .d_stop = nostop, + .d_tty = notty, + .d_poll = nopoll, + .d_mmap = nommap, + .d_kqfilter = nokqfilter, + .d_flag = D_DISK | D_MPSAFE +}; + +const struct dkdriver dmdkdriver = { + .d_strategy = dmstrategy }; extern uint64_t dev_counter; @@ -89,21 +107,21 @@ * */ struct cmd_function cmd_fn[] = { - {"version", dm_get_version_ioctl}, - {"targets", dm_list_versions_ioctl}, - {"create", dm_dev_create_ioctl}, - {"info",dm_dev_status_ioctl}, - {"mknodes", dm_dev_status_ioctl}, - {"names", dm_dev_list_ioctl}, - {"suspend", dm_dev_suspend_ioctl}, - {"remove", dm_dev_remove_ioctl}, - {"rename", dm_dev_rename_ioctl}, - {"resume", dm_dev_resume_ioctl}, - {"clear", dm_table_clear_ioctl}, - {"deps",dm_table_deps_ioctl}, - {"reload", dm_table_load_ioctl}, - {"status", dm_table_status_ioctl}, - {"table", dm_table_status_ioctl}, + { .cmd = "version", .fn = dm_get_version_ioctl}, + { .cmd = "targets", .fn = dm_list_versions_ioctl}, + { .cmd = "create", .fn = dm_dev_create_ioctl}, + { .cmd = "info",.fn = dm_dev_status_ioctl}, + { .cmd = "mknodes", .fn = dm_dev_status_ioctl}, + { .cmd = "names", .fn = dm_dev_list_ioctl}, + { .cmd = "suspend", .fn = dm_dev_suspend_ioctl}, + { .cmd = "remove", .fn = dm_dev_remove_ioctl}, + { .cmd = "rename", .fn = dm_dev_rename_ioctl}, + { .cmd = "resume", .fn = dm_dev_resume_ioctl}, + { .cmd = "clear", .fn = dm_table_clear_ioctl}, + { .cmd = "deps",.fn = dm_table_deps_ioctl}, + { .cmd = "reload", .fn = dm_table_load_ioctl}, + { .cmd = "status", .fn = dm_table_status_ioctl}, + { .cmd = "table", .fn = dm_table_status_ioctl}, {NULL, NULL} }; @@ -383,6 +401,9 @@ biodone(bp); return; } + + /* FIXME: have to be called with IPL_BIO*/ + disk_busy(dmv->diskp); /* Select active table */ tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_ACTIVE); @@ -438,6 +459,9 @@ if (issued_len < buf_len) nestiobuf_done(bp, buf_len - issued_len, EINVAL); + /* FIXME have to be called with SPL_BIO*/ + disk_unbusy(dmv->diskp, buf_len, bp != NULL ? bp->b_flags & B_READ : 0); + dm_table_release(&dmv->table_head, DM_TABLE_ACTIVE); dm_dev_unbusy(dmv); @@ -458,12 +482,6 @@ } static int -dmdump(dev_t dev, daddr_t blkno, void *va, size_t size) -{ - return ENODEV; -} - -static int dmsize(dev_t dev) { dm_dev_t *dmv; Index: src/sys/dev/dm/dm_ioctl.c diff -u src/sys/dev/dm/dm_ioctl.c:1.9 src/sys/dev/dm/dm_ioctl.c:1.10 --- src/sys/dev/dm/dm_ioctl.c:1.9 Sun Mar 8 02:07:38 2009 +++ src/sys/dev/dm/dm_ioctl.c Mon Apr 6 22:58:10 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_ioctl.c,v 1.9 2009/03/08 02:07:38 agc Exp $ */ +/*$NetBSD: dm_ioctl.c,v 1.10 2009/04/06 22:58:10 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -93,6 +93,7 @@ #include "dm.h" static uint64_t sc_minor_num; +extern const struct dkdriver dmdkdriver; uint64_t dev_counter; #define DM_REMOVE_FLAG(flag, name) do { \ @@ -247,9 +248,12 @@ prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Apr 13 16:12:28 UTC 2009 Modified Files: src/sys/dev/dm: TODO Log Message: Update to reality. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/TODO Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/TODO diff -u src/sys/dev/dm/TODO:1.4 src/sys/dev/dm/TODO:1.5 --- src/sys/dev/dm/TODO:1.4 Fri Jan 2 01:13:49 2009 +++ src/sys/dev/dm/TODO Mon Apr 13 16:12:27 2009 @@ -2,7 +2,7 @@ * Implement dm_dev_event_ioctl and dm_target_msg_ioctl functions -* Write more targets mirror, stripe. +* Write more targets mirror. * Snapshot target, there is some code in repository already @@ -12,6 +12,8 @@ * Integrate LVM with the sysinst, so we can configure LVM during installation +* Parse whole config line for every target in NetBSD libdevmapper and do not + work with strings in the kernel. Pain in the sky tasks
CVS commit: src/etc/rc.d
Module Name:src Committed By: haad Date: Mon Apr 13 18:48:15 UTC 2009 Modified Files: src/etc/rc.d: lvm Log Message: We need writable /dev to get lvm working otherwise lvm devices can't be created. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/lvm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/lvm diff -u src/etc/rc.d/lvm:1.3 src/etc/rc.d/lvm:1.4 --- src/etc/rc.d/lvm:1.3 Thu Mar 5 10:35:43 2009 +++ src/etc/rc.d/lvm Mon Apr 13 18:48:14 2009 @@ -1,9 +1,10 @@ #!/bin/sh # -# $NetBSD: lvm,v 1.3 2009/03/05 10:35:43 haad Exp $ +# $NetBSD: lvm,v 1.4 2009/04/13 18:48:14 haad Exp $ # # PROVIDE: disks +# REQUIRE: root $_rc_subr_loaded . /etc/rc.subr
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Mon Apr 13 18:51:54 UTC 2009 Modified Files: src/sys/dev/dm: dm_dev.c dm_ioctl.c Log Message: Destroy locks in dm_dev_free, do not allocate struct disk twice. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/dm_dev.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_ioctl.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/dev/dm/dm_dev.c diff -u src/sys/dev/dm/dm_dev.c:1.4 src/sys/dev/dm/dm_dev.c:1.5 --- src/sys/dev/dm/dm_dev.c:1.4 Wed Mar 18 10:22:39 2009 +++ src/sys/dev/dm/dm_dev.c Mon Apr 13 18:51:54 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_dev.c,v 1.4 2009/03/18 10:22:39 cegger Exp $ */ +/*$NetBSD: dm_dev.c,v 1.5 2009/04/13 18:51:54 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -320,6 +320,9 @@ { KASSERT(dmv != NULL); + mutex_destroy(&dmv->dev_mtx); + cv_destroy(&dmv->dev_cv); + if(dmv->diskp != NULL) (void)kmem_free(dmv->diskp, sizeof(struct disk)); Index: src/sys/dev/dm/dm_ioctl.c diff -u src/sys/dev/dm/dm_ioctl.c:1.10 src/sys/dev/dm/dm_ioctl.c:1.11 --- src/sys/dev/dm/dm_ioctl.c:1.10 Mon Apr 6 22:58:10 2009 +++ src/sys/dev/dm/dm_ioctl.c Mon Apr 13 18:51:54 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_ioctl.c,v 1.10 2009/04/06 22:58:10 haad Exp $ */ +/*$NetBSD: dm_ioctl.c,v 1.11 2009/04/13 18:51:54 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -219,10 +219,7 @@ if ((dmv = dm_dev_alloc()) == NULL) return ENOMEM; - - if ((dmv->diskp = kmem_alloc(sizeof(struct disk), KM_NOSLEEP)) == NULL) - return ENOMEM; - + if (uuid) strncpy(dmv->uuid, uuid, DM_UUID_LEN); else @@ -251,11 +248,8 @@ disk_init(dmv->diskp, dmv->name, &dmdkdriver); disk_attach(dmv->diskp); - if ((r = dm_dev_insert(dmv)) != 0){ - mutex_destroy(&dmv->dev_mtx); - cv_destroy(&dmv->dev_cv); + if ((r = dm_dev_insert(dmv)) != 0) dm_dev_free(dmv); - } DM_ADD_FLAG(flags, DM_EXISTS_FLAG); DM_REMOVE_FLAG(flags, DM_INACTIVE_PRESENT_FLAG); @@ -400,9 +394,6 @@ dm_table_head_destroy(&dmv->table_head); - mutex_destroy(&dmv->dev_mtx); - cv_destroy(&dmv->dev_cv); - /* Destroy disk device structure */ disk_detach(dmv->diskp); disk_destroy(dmv->diskp);
CVS commit: src/common/lib/libprop
Module Name:src Committed By: haad Date: Tue Apr 14 02:53:41 UTC 2009 Modified Files: src/common/lib/libprop: prop_dictionary.c Log Message: Check if pd is not NULL before we try to lock rw lock associated with it. This fixes proplib crash when NULL is passed to prop_dictionary_get as a dictionary. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/common/lib/libprop/prop_dictionary.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libprop/prop_dictionary.c diff -u src/common/lib/libprop/prop_dictionary.c:1.34 src/common/lib/libprop/prop_dictionary.c:1.35 --- src/common/lib/libprop/prop_dictionary.c:1.34 Sat Jan 3 18:31:33 2009 +++ src/common/lib/libprop/prop_dictionary.c Tue Apr 14 02:53:41 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: prop_dictionary.c,v 1.34 2009/01/03 18:31:33 pooka Exp $ */ +/* $NetBSD: prop_dictionary.c,v 1.35 2009/04/14 02:53:41 haad Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -936,7 +936,10 @@ prop_object_t prop_dictionary_get(prop_dictionary_t pd, const char *key) { - prop_object_t po; + prop_object_t po = NULL; + + if (! prop_object_is_dictionary(pd)) + return (NULL); _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); po = _prop_dictionary_get(pd, key, true);
CVS commit: src/sys
Module Name:src Committed By: haad Date: Fri Jun 5 19:21:03 UTC 2009 Modified Files: src/sys/dev: ccd.c cgd.c Added Files: src/sys/modules/ccd: Makefile src/sys/modules/cgd: Makefile Log Message: Add work in support for compiling ccd and cgd drivers as a modules. I forgot to committ when I have written device module autoloading stuff. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ccd.c cvs rdiff -u -r1.57 -r1.58 src/sys/dev/cgd.c cvs rdiff -u -r0 -r1.1 src/sys/modules/ccd/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/cgd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ccd.c diff -u src/sys/dev/ccd.c:1.133 src/sys/dev/ccd.c:1.134 --- src/sys/dev/ccd.c:1.133 Sat Apr 4 08:29:39 2009 +++ src/sys/dev/ccd.c Fri Jun 5 19:21:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ccd.c,v 1.133 2009/04/04 08:29:39 ad Exp $ */ +/* $NetBSD: ccd.c,v 1.134 2009/06/05 19:21:02 haad Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. @@ -127,7 +127,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.133 2009/04/04 08:29:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.134 2009/06/05 19:21:02 haad Exp $"); #include #include @@ -1563,3 +1563,38 @@ } } #endif + +#ifdef _MODULE + +#include + +MODULE(MODULE_CLASS_DRIVER, ccd, NULL); + +static int +ccd_modcmd(modcmd_t cmd, void *arg) +{ + int bmajor = -1, cmajor = -1, error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: + ccdattach(4); + + return devsw_attach("ccd", &ccd_bdevsw, &bmajor, + &ccd_cdevsw, &cmajor); + break; + + case MODULE_CMD_FINI: + return devsw_detach(&ccd_bdevsw, &ccd_cdevsw); + break; + + case MODULE_CMD_STAT: + return ENOTTY; + + default: + return ENOTTY; + } + + return error; +} + +#endif Index: src/sys/dev/cgd.c diff -u src/sys/dev/cgd.c:1.57 src/sys/dev/cgd.c:1.58 --- src/sys/dev/cgd.c:1.57 Sat Mar 14 17:56:47 2009 +++ src/sys/dev/cgd.c Fri Jun 5 19:21:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.57 2009/03/14 17:56:47 apb Exp $ */ +/* $NetBSD: cgd.c,v 1.58 2009/06/05 19:21:02 haad Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.57 2009/03/14 17:56:47 apb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.58 2009/06/05 19:21:02 haad Exp $"); #include #include @@ -845,3 +845,38 @@ printf("%02x", (unsigned char) *c++); } #endif + +#ifdef _MODULE + +#include + +MODULE(MODULE_CLASS_DRIVER, cgd, NULL); + +static int +cgd_modcmd(modcmd_t cmd, void *arg) +{ + int bmajor = -1, cmajor = -1, error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: + cgdattach(4); + + return devsw_attach("cgd", &cgd_bdevsw, &bmajor, + &cgd_cdevsw, &cmajor); + break; + + case MODULE_CMD_FINI: + return devsw_detach(&cgd_bdevsw, &cgd_cdevsw); + break; + + case MODULE_CMD_STAT: + return ENOTTY; + + default: + return ENOTTY; + } + + return error; +} + +#endif Added files: Index: src/sys/modules/ccd/Makefile diff -u /dev/null src/sys/modules/ccd/Makefile:1.1 --- /dev/null Fri Jun 5 19:21:03 2009 +++ src/sys/modules/ccd/Makefile Fri Jun 5 19:21:03 2009 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2009/06/05 19:21:03 haad Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/dev + +KMOD= ccd +SRCS= ccd.c + +.include Index: src/sys/modules/cgd/Makefile diff -u /dev/null src/sys/modules/cgd/Makefile:1.1 --- /dev/null Fri Jun 5 19:21:03 2009 +++ src/sys/modules/cgd/Makefile Fri Jun 5 19:21:03 2009 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2009/06/05 19:21:03 haad Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/dev + +KMOD= cgd +SRCS= cgd.c cgd_crypto.c + +.include
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Fri Jun 5 19:56:40 UTC 2009 Modified Files: src/sys/dev/dm: dm.h dm_ioctl.c dm_target_error.c dm_target_linear.c dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c netbsd-dm.h Log Message: Parse dm param string in libdevmapper and not in a dm target init function. Create proplib param dictionary entry in libdevmapper and pass it to dm in dm_ioctl dict. Param target is then passed to target init function, where is parse. I like this aproach much better than passing char **argv and trusting to user input. I have bumped minor lib/driver version. XXX. Add more sanity checks in kernel. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_ioctl.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/dm_target_error.c \ src/sys/dev/dm/dm_target_zero.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/dm_target_linear.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dm/dm_target_mirror.c \ src/sys/dev/dm/dm_target_stripe.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/dm_target_snapshot.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dm/netbsd-dm.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/dev/dm/dm.h diff -u src/sys/dev/dm/dm.h:1.12 src/sys/dev/dm/dm.h:1.13 --- src/sys/dev/dm/dm.h:1.12 Wed Mar 25 23:35:54 2009 +++ src/sys/dev/dm/dm.h Fri Jun 5 19:56:40 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: dm.h,v 1.12 2009/03/25 23:35:54 dyoung Exp $ */ +/*$NetBSD: dm.h,v 1.13 2009/06/05 19:56:40 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ #define DM_NAME_LEN 128 #define DM_UUID_LEN 129 -#define DM_VERSION_MAJOR 4 +#define DM_VERSION_MAJOR 5 #define DM_VERSION_MINOR 13 #define DM_VERSION_PATCHLEVEL 0 @@ -209,7 +209,7 @@ typedef struct dm_target { char name[DM_MAX_TYPE_NAME]; /* Initialize target_config area */ - int (*init)(dm_dev_t *, void **, char *); + int (*init)(dm_dev_t *, void **, prop_dictionary_t); /* Destroy target_config area */ int (*destroy)(dm_table_entry_t *); @@ -278,8 +278,10 @@ /* XXX temporally add */ int dm_target_init(void); +#define DM_MAX_PARAMS_SIZE 1024 + /* dm_target_zero.c */ -int dm_target_zero_init(dm_dev_t *, void**, char *); +int dm_target_zero_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_zero_status(void *); int dm_target_zero_strategy(dm_table_entry_t *, struct buf *); int dm_target_zero_destroy(dm_table_entry_t *); @@ -287,7 +289,7 @@ int dm_target_zero_upcall(dm_table_entry_t *, struct buf *); /* dm_target_error.c */ -int dm_target_error_init(dm_dev_t *, void**, char *); +int dm_target_error_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_error_status(void *); int dm_target_error_strategy(dm_table_entry_t *, struct buf *); int dm_target_error_deps(dm_table_entry_t *, prop_array_t); @@ -295,7 +297,7 @@ int dm_target_error_upcall(dm_table_entry_t *, struct buf *); /* dm_target_linear.c */ -int dm_target_linear_init(dm_dev_t *, void**, char *); +int dm_target_linear_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_linear_status(void *); int dm_target_linear_strategy(dm_table_entry_t *, struct buf *); int dm_target_linear_deps(dm_table_entry_t *, prop_array_t); @@ -306,7 +308,7 @@ uint64_t atoi(const char *); /* dm_target_mirror.c */ -int dm_target_mirror_init(dm_dev_t *, void**, char *); +int dm_target_mirror_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_mirror_status(void *); int dm_target_mirror_strategy(dm_table_entry_t *, struct buf *); int dm_target_mirror_deps(dm_table_entry_t *, prop_array_t); @@ -314,7 +316,7 @@ int dm_target_mirror_upcall(dm_table_entry_t *, struct buf *); /* dm_target_stripe.c */ -int dm_target_stripe_init(dm_dev_t *, void**, char *); +int dm_target_stripe_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_stripe_status(void *); int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *); int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t); @@ -322,7 +324,7 @@ int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *); /* dm_target_snapshot.c */ -int dm_target_snapshot_init(dm_dev_t *, void**, char *); +int dm_target_snapshot_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_snapshot_status(void *); int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *); int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t); @@ -330,7 +332,7 @@ int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *); /* dm snapshot origin driver */ -int dm_target_snapshot_orig_init(dm_dev_t *, void**, char *); +int dm_target_snapshot_orig_init(dm_dev_t *, void**, prop_dictionary_t); char * dm_target_snapshot_orig_status(void *); int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf
CVS commit: src/external/gpl2/lvm2/dist/libdm/ioctl
Module Name:src Committed By: haad Date: Fri Jun 5 19:57:25 UTC 2009 Modified Files: src/external/gpl2/lvm2/dist/libdm/ioctl: libdm-nbsd-iface.c libdm_netbsd.c Log Message: Parse dm param string in libdevmapper and not in a dm target init function. Create proplib param dictionary entry in libdevmapper and pass it to dm in dm_ioctl dict. Param target is then passed to target init function, where is parse. I like this aproach much better than passing char **argv and trusting to user input. XXX. Add more sanity checks in kernel. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.1 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.2 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.1 Mon Dec 22 00:56:59 2008 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Fri Jun 5 19:57:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm-nbsd-iface.c,v 1.1 2008/12/22 00:56:59 haad Exp $*/ +/* $NetBSD: libdm-nbsd-iface.c,v 1.2 2009/06/05 19:57:25 haad Exp $*/ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. @@ -595,6 +595,7 @@ { prop_array_t cmd_array; prop_dictionary_t target_spec; + prop_dictionary_t target_param; struct target *t; @@ -619,7 +620,10 @@ strlcpy(type,t->type,DM_MAX_TYPE_NAME); prop_dictionary_set_cstring(target_spec,DM_TABLE_TYPE,type); - prop_dictionary_set_cstring(target_spec,DM_TABLE_PARAMS,t->params); + + target_param = nbsd_dm_parse_param(type, t->params); + prop_dictionary_set(target_spec, DM_TABLE_PARAMS, target_param); + prop_object_release(target_param); prop_array_set(cmd_array,count,target_spec); Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.1 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.2 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.1 Mon Dec 22 00:56:59 2008 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c Fri Jun 5 19:57:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm_netbsd.c,v 1.1 2008/12/22 00:56:59 haad Exp $*/ +/* $NetBSD: libdm_netbsd.c,v 1.2 2009/06/05 19:57:25 haad Exp $*/ /* * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -47,6 +48,11 @@ #include "lib.h" +struct nbsd_dm_target_param { + char *name; + prop_dictionary_t (*parse)(char *); +}; + #define DMI_SIZE 16 * 1024 static int dm_list_versions(prop_dictionary_t, struct dm_ioctl *); @@ -54,6 +60,199 @@ static int dm_dev_deps(prop_dictionary_t, struct dm_ioctl *); static int dm_table_status(prop_dictionary_t, struct dm_ioctl *); +static prop_dictionary_t dm_parse_linear(char *); +static prop_dictionary_t dm_parse_stripe(char *); +static prop_dictionary_t dm_parse_mirror(char *); +static prop_dictionary_t dm_parse_snapshot(char *); +static prop_dictionary_t dm_parse_snapshot_origin(char *); + +static struct nbsd_dm_target_param dmt_parse[] = { + {"linear", dm_parse_linear}, + {"striped", dm_parse_stripe}, + {"mirror", dm_parse_mirror}, + {"snapshot", dm_parse_snapshot}, + {"snapshot-origin", dm_parse_snapshot_origin}, + {NULL, NULL}, +}; + +/* + * Parse params string to target specific proplib dictionary. + * + * params + * + * device + * + * + * device + * /dev/wd1a + * offset + * 0x384 + * + * + * + * + * + */ +prop_dictionary_t +nbsd_dm_parse_param(const char *target, const char *params) +{ + int i; + size_t slen, dlen; + prop_dictionary_t dict; + char *param; + + dict = NULL; + slen = strlen(target); + + printf("Parsing target %s, string %s\n", target, params); + + /* copy parameter string to new buffer */ + param = dm_malloc(strlen(params) * sizeof(char)); + strlcpy(param, params, strlen(params)+1); + +for(i = 0; dmt_parse[i].name != NULL; i++) { + dlen = strlen(dmt_parse[i].name); + + if (slen != dlen) + continue; + + if (strncmp(target, dmt_parse[i].name, slen) == 0) + break; + } + +if (dmt_parse[i].name == NULL) +return NULL; + + printf("target found %s, params %s\n", dmt_parse[i].name, params); + + dict = dmt_parse[i].parse(param); + + dm_free(param); + + return dict; +} + +/* + * Example line sent to dm from lvm tools when using linear target. + * start length linear device1 offset1 + * 0 65536 linear /d
CVS commit: src/external/gpl2/lvm2/lib/libdevmapper
Module Name:src Committed By: haad Date: Fri Jun 5 20:03:59 UTC 2009 Modified Files: src/external/gpl2/lvm2/lib/libdevmapper: netbsd-dm.h Log Message: Parse dm param string in libdevmapper and not in a dm target init function. Create proplib param dictionary entry in libdevmapper and pass it to dm in dm_ioctl dict. Param target is then passed to target init function, where is parse. I like this aproach much better than passing char **argv and trusting to user input. XXX. Add more sanity checks in kernel. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h diff -u src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.1 src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.2 --- src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.1 Mon Dec 22 01:48:10 2008 +++ src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h Fri Jun 5 20:03:58 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: netbsd-dm.h,v 1.1 2008/12/22 01:48:10 haad Exp $ */ +/*$NetBSD: netbsd-dm.h,v 1.2 2009/06/05 20:03:58 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -208,6 +208,17 @@ #define DM_TABLE_STAT "status" #define DM_TABLE_LENGTH "length" #define DM_TABLE_PARAMS "params" + +#define DM_TARGET_LINEAR_DEVICE "device" +#define DM_TARGET_LINEAR_OFFSET "offset" + +#define DM_TARGET_STRIPE_DEVARRAY "device_array" +#define DM_TARGET_STRIPE_DEVICE"device" +#define DM_TARGET_STRIPE_OFFSET"offset" +#define DM_TARGET_STRIPE_STRIPES "stripes" +#define DM_TARGET_STRIPE_CHUNKSIZE "chunk_size" + + //#ifndef __LIB_DEVMAPPER__ //#define DM_TABLE_DEPS "deps" //#endif @@ -266,7 +277,7 @@ /* Types for nbsd_get_dm_major */ #define DM_CHAR_MAJOR 1 -#define DM_BLOCK_MAJOR 2 +#define DM_BLOCK_MAJOR 2 /* libdm_netbsd.c */ int nbsd_get_dm_major(uint32_t *, int); /* Get dm device major numbers */ @@ -276,6 +287,8 @@ int nbsd_dm_add_uint(const char *, uint64_t, prop_dictionary_t); int nbsd_dm_add_str(const char *, char *, prop_dictionary_t ); +prop_dictionary_t nbsd_dm_parse_param(const char *, char *); + struct dm_ioctl* nbsd_dm_dict_to_dmi(prop_dictionary_t, const int); #endif /* __LIB_DEVMAPPER__ */
CVS commit: src/external/gpl2/lvm2/dist/include
Module Name:src Committed By: haad Date: Fri Jun 5 20:11:21 UTC 2009 Modified Files: src/external/gpl2/lvm2/dist/include: dm-ioctl.h Log Message: Bump libdevmapper minor number, because of ioctl protocol change. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/lvm2/dist/include/dm-ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/dist/include/dm-ioctl.h diff -u src/external/gpl2/lvm2/dist/include/dm-ioctl.h:1.1.1.1 src/external/gpl2/lvm2/dist/include/dm-ioctl.h:1.2 --- src/external/gpl2/lvm2/dist/include/dm-ioctl.h:1.1.1.1 Mon Dec 22 00:18:43 2008 +++ src/external/gpl2/lvm2/dist/include/dm-ioctl.h Fri Jun 5 20:11:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dm-ioctl.h,v 1.1.1.1 2008/12/22 00:18:43 haad Exp $ */ +/* $NetBSD: dm-ioctl.h,v 1.2 2009/06/05 20:11:21 haad Exp $ */ /* * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. @@ -260,7 +260,7 @@ #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 -#define DM_VERSION_MINOR 14 +#define DM_VERSION_MINOR 15 #define DM_VERSION_PATCHLEVEL 0 #define DM_VERSION_EXTRA "-ioctl (2008-04-23)"
CVS commit: src
Module Name:src Committed By: haad Date: Fri Jun 5 21:52:32 UTC 2009 Modified Files: src/sbin/fsck: Makefile partutil.c src/sbin/fsck_ffs: Makefile src/sbin/newfs: Makefile src/sbin/newfs_ext2fs: Makefile src/sbin/newfs_lfs: Makefile src/sbin/newfs_msdos: Makefile src/sbin/resize_lfs: Makefile src/sys/dev/dm: device-mapper.c dm.h dm_ioctl.c src/sys/dev/isa: fd.c src/sys/dev/raidframe: rf_netbsdkintf.c src/sys/dev/scsipi: cd.c sd.c Log Message: Add support for DIOCGDISKINFO to disk like device drivers. Change partutil.c::getdiskinfo to use it to get disk geometry info. Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk driver doesn't support it use old DIOCGDINFO. This patch adds support for wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and other tools. No objections on tech-userle...@. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sbin/fsck/Makefile cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck/partutil.c cvs rdiff -u -r1.39 -r1.40 src/sbin/fsck_ffs/Makefile cvs rdiff -u -r1.32 -r1.33 src/sbin/newfs/Makefile cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_ext2fs/Makefile cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_lfs/Makefile cvs rdiff -u -r1.4 -r1.5 src/sbin/newfs_msdos/Makefile cvs rdiff -u -r1.4 -r1.5 src/sbin/resize_lfs/Makefile cvs rdiff -u -r1.6 -r1.7 src/sys/dev/dm/device-mapper.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm.h cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_ioctl.c cvs rdiff -u -r1.92 -r1.93 src/sys/dev/isa/fd.c cvs rdiff -u -r1.262 -r1.263 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.292 -r1.293 src/sys/dev/scsipi/cd.c cvs rdiff -u -r1.286 -r1.287 src/sys/dev/scsipi/sd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/Makefile diff -u src/sbin/fsck/Makefile:1.17 src/sbin/fsck/Makefile:1.18 --- src/sbin/fsck/Makefile:1.17 Sat Aug 26 18:14:28 2006 +++ src/sbin/fsck/Makefile Fri Jun 5 21:52:31 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2006/08/26 18:14:28 christos Exp $ +# $NetBSD: Makefile,v 1.18 2009/06/05 21:52:31 haad Exp $ PROG= fsck SRCS= fsck.c fsutil.c preen.c @@ -7,4 +7,7 @@ LDADD+=-lutil DPADD+=${LIBUTIL} +LDADD+=-lprop +DPADD+=${LIBPROP} + .include Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.4 src/sbin/fsck/partutil.c:1.5 --- src/sbin/fsck/partutil.c:1.4 Sat Apr 11 06:48:36 2009 +++ src/sbin/fsck/partutil.c Fri Jun 5 21:52:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.4 2009/04/11 06:48:36 lukem Exp $ */ +/* $NetBSD: partutil.c,v 1.5 2009/06/05 21:52:31 haad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: partutil.c,v 1.4 2009/04/11 06:48:36 lukem Exp $"); +__RCSID("$NetBSD: partutil.c,v 1.5 2009/06/05 21:52:31 haad Exp $"); #include #include @@ -38,31 +38,36 @@ #include #include + #include +#include +#include #include #include #include -#include +#include #include -#include + +#include #include "partutil.h" + +/* + * Set what we need to know about disk geometry. + */ static void -label2geom(struct disk_geom *geo, const struct disklabel *lp) +dict2geom(struct disk_geom *geo, prop_dictionary_t dict) { - geo->dg_secperunit = lp->d_secperunit; - geo->dg_secsize = lp->d_secsize; - geo->dg_nsectors = lp->d_nsectors; - geo->dg_ntracks = lp->d_ntracks; - geo->dg_ncylinders = lp->d_ncylinders; - geo->dg_secpercyl = lp->d_secpercyl; - geo->dg_pcylinders = lp->d_ncylinders; - geo->dg_sparespertrack = lp->d_sparespertrack; - geo->dg_sparespercyl = lp->d_sparespercyl; - geo->dg_acylinders = lp->d_acylinders; + memset(geo, 0, sizeof(struct disk_geom)); + prop_dictionary_get_int64(dict, "sectors-per-unit", &geo->dg_secperunit); + prop_dictionary_get_uint32(dict, "sector-size", &geo->dg_secsize); + prop_dictionary_get_uint32(dict, "sectors-per-track", &geo->dg_nsectors); + prop_dictionary_get_uint32(dict, "tracks-per-cylinder", &geo->dg_ntracks); + prop_dictionary_get_uint32(dict, "cylinders-per-unit", &geo->dg_ncylinders); } + static void part2wedge(struct dkwedge_info *dkw, const struct disklabel *lp, const char *s) { @@ -132,45 +137,32 @@ { struct disklabel lab; struct disklabel *lp = &lab; - char parent[1024]; + prop_dictionary_t disk_dict, geom_dict; if (dt) { lp = getdiskbyname(dt); if (lp == NULL) errx(1, "%s: unknown disk type", dt); - goto part; } - if (ioctl(fd, DIOCGDINFO, lp) == -1) { - if (errno == ENOTTY) { - int pfd; - if (ioctl(fd, DIOCGWEDGEINFO, dkw) == -1) { -warn("ioctl (DIOCGWEDGEINFO)"); -goto bad; - } - pfd = opendisk(dkw->dkw_parent, O_RDONLY, - parent, sizeof(parent), 0); - if (pfd == -1) { -warn("Cannot open `%s'", dkw->dkw_parent); -goto bad; - } - if (ioctl(pfd, DIOCGDINFO, lp
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: haad Date: Sat Jun 6 08:10:06 UTC 2009 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix my previous commit. To generate a diff of this commit: cvs rdiff -u -r1.263 -r1.264 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.263 src/sys/dev/raidframe/rf_netbsdkintf.c:1.264 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.263 Fri Jun 5 21:52:32 2009 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jun 6 08:10:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.263 2009/06/05 21:52:32 haad Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.264 2009/06/06 08:10:06 haad Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -139,7 +139,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.263 2009/06/05 21:52:32 haad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.264 2009/06/06 08:10:06 haad Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1732,7 +1732,7 @@ * Add support for "regular" device ioctls here. */ - error = disk_ioctl(&rs->sc_dkdev, cmd, addr, flag, l); + error = disk_ioctl(&rs->sc_dkdev, cmd, data, flag, l); if (error != EPASSTHROUGH) return (error);
CVS commit: src/sbin/fsdb
Module Name:src Committed By: haad Date: Sat Jun 6 08:22:24 UTC 2009 Modified Files: src/sbin/fsdb: Makefile Log Message: Add proplib to list of libraries, ifx fsdb build after my getdiskinfo change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sbin/fsdb/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsdb/Makefile diff -u src/sbin/fsdb/Makefile:1.25 src/sbin/fsdb/Makefile:1.26 --- src/sbin/fsdb/Makefile:1.25 Sat Apr 11 07:58:12 2009 +++ src/sbin/fsdb/Makefile Sat Jun 6 08:22:24 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.25 2009/04/11 07:58:12 lukem Exp $ +# $NetBSD: Makefile,v 1.26 2009/06/06 08:22:24 haad Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 WARNS?= 3 # XXX: sign-compare issues in ../fsck_ffs @@ -22,9 +22,9 @@ .PATH: ${NETBSDSRCDIR}/sys/kern CPPFLAGS+=-DWAPBL_DEBUG_PRINT=0 -LDADD+= -lutil -ledit -ltermcap +LDADD+= -lutil -ledit -ltermcap -lprop .ifndef HOSTPROG -DPADD+= ${LIBUTIL} ${LIBEDIT} ${LIBTERMCAP} +DPADD+= ${LIBUTIL} ${LIBEDIT} ${LIBTERMCAP} ${LIBPROP} .endif .if (defined(HAVE_GCC) && ${HAVE_GCC} == 4) || defined(HAVE_PCC)
CVS commit: src/sbin/newfs
Module Name:src Committed By: haad Date: Sat Jun 6 11:09:16 UTC 2009 Modified Files: src/sbin/newfs: Makefile Log Message: Remove debuging CFLAGS. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sbin/newfs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/newfs/Makefile diff -u src/sbin/newfs/Makefile:1.33 src/sbin/newfs/Makefile:1.34 --- src/sbin/newfs/Makefile:1.33 Fri Jun 5 21:52:31 2009 +++ src/sbin/newfs/Makefile Sat Jun 6 11:09:16 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.33 2009/06/05 21:52:31 haad Exp $ +# $NetBSD: Makefile,v 1.34 2009/06/06 11:09:16 haad Exp $ # @(#)Makefile 8.2 (Berkeley) 3/27/94 .include @@ -11,8 +11,6 @@ FSCK=${NETBSDSRCDIR}/sbin/fsck CPPFLAGS+=-DMFS -I${.CURDIR} -I${DISKLABEL} -I${FSCK} -CFLAGS+= -g -O0 - DPADD+= ${LIBUTIL} LDADD+= -lutil
CVS commit: src/sbin/fsck
Module Name:src Committed By: haad Date: Sat Jun 6 17:47:51 UTC 2009 Modified Files: src/sbin/fsck: partutil.c Log Message: Remove debug printfs. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/fsck/partutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.5 src/sbin/fsck/partutil.c:1.6 --- src/sbin/fsck/partutil.c:1.5 Fri Jun 5 21:52:31 2009 +++ src/sbin/fsck/partutil.c Sat Jun 6 17:47:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.5 2009/06/05 21:52:31 haad Exp $ */ +/* $NetBSD: partutil.c,v 1.6 2009/06/06 17:47:50 haad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: partutil.c,v 1.5 2009/06/05 21:52:31 haad Exp $"); +__RCSID("$NetBSD: partutil.c,v 1.6 2009/06/06 17:47:50 haad Exp $"); #include #include @@ -156,8 +156,6 @@ /* Get info about partition/wedge */ if (ioctl(fd, DIOCGWEDGEINFO, dkw) == -1) { - warn("ioctl (DIOCGWEDGEINFO)"); - printf("Using old disklabel method\n"); if (ioctl(fd, DIOCGDINFO, lp) == -1) errx(errno, "Please implement DIOCGWEDGEINFO or DIOCGDINFO for disk device %s\n", s);
CVS commit: src/sbin/fsck
Module Name:src Committed By: haad Date: Sat Jun 6 18:31:29 UTC 2009 Modified Files: src/sbin/fsck: partutil.c Log Message: Add support for devices which do not support DIOCGDISKINFO ioctl yet. This change will restore fsck/newfs on vnd device. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck/partutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.6 src/sbin/fsck/partutil.c:1.7 --- src/sbin/fsck/partutil.c:1.6 Sat Jun 6 17:47:50 2009 +++ src/sbin/fsck/partutil.c Sat Jun 6 18:31:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.6 2009/06/06 17:47:50 haad Exp $ */ +/* $NetBSD: partutil.c,v 1.7 2009/06/06 18:31:29 haad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: partutil.c,v 1.6 2009/06/06 17:47:50 haad Exp $"); +__RCSID("$NetBSD: partutil.c,v 1.7 2009/06/06 18:31:29 haad Exp $"); #include #include @@ -52,6 +52,23 @@ #include "partutil.h" +/* + * Convert disklabel geometry info to disk_geom. + */ +static void +label2geom(struct disk_geom *geo, const struct disklabel *lp) +{ + geo->dg_secperunit = lp->d_secperunit; + geo->dg_secsize = lp->d_secsize; + geo->dg_nsectors = lp->d_nsectors; + geo->dg_ntracks = lp->d_ntracks; + geo->dg_ncylinders = lp->d_ncylinders; + geo->dg_secpercyl = lp->d_secpercyl; + geo->dg_pcylinders = lp->d_ncylinders; + geo->dg_sparespertrack = lp->d_sparespertrack; + geo->dg_sparespercyl = lp->d_sparespercyl; + geo->dg_acylinders = lp->d_acylinders; +} /* * Set what we need to know about disk geometry. @@ -138,7 +155,10 @@ struct disklabel lab; struct disklabel *lp = &lab; prop_dictionary_t disk_dict, geom_dict; + int error; + error = 0; + if (dt) { lp = getdiskbyname(dt); if (lp == NULL) @@ -146,18 +166,30 @@ } /* Get disk description dictionary */ - if (prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, &disk_dict) != 0) { - warn("Please implement DIOCGDISKINFO for %s\n disk driver\n", s); - return (errno); + if ((error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, + &disk_dict)) != 0) { + warn("Please implement DIOCGDISKINFO for %s disk driver\n", s); + + /* + * Ask for disklabel if DIOCGDISKINFO failed. This is + * compatibility call and can be removed when all devices + * will support DIOCGDISKINFO. + */ + if ((error = ioctl(fd, DIOCGDINFO, lp)) == -1) { + printf("DIOCGDINFO on %s failed\n", s); + return (errno); + } + label2geom(geo, lp); + } else { + geom_dict = prop_dictionary_get(disk_dict, "geometry"); + dict2geom(geo, geom_dict); } - geom_dict = prop_dictionary_get(disk_dict, "geometry"); - dict2geom(geo, geom_dict); - /* Get info about partition/wedge */ if (ioctl(fd, DIOCGWEDGEINFO, dkw) == -1) { if (ioctl(fd, DIOCGDINFO, lp) == -1) - errx(errno, "Please implement DIOCGWEDGEINFO or DIOCGDINFO for disk device %s\n", s); + errx(errno, "Please implement DIOCGWEDGEINFO or " + "DIOCGDINFO for disk device %s\n", s); part2wedge(dkw, lp, s); }
CVS commit: src/external/gpl2/lvm2/lib/libdevmapper
Module Name:src Committed By: haad Date: Tue Jun 9 18:24:02 UTC 2009 Modified Files: src/external/gpl2/lvm2/lib/libdevmapper: netbsd-dm.h Log Message: Add const to second argument of nbsd_dm_parse_param, too. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h diff -u src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.2 src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.3 --- src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h:1.2 Fri Jun 5 20:03:58 2009 +++ src/external/gpl2/lvm2/lib/libdevmapper/netbsd-dm.h Tue Jun 9 18:24:02 2009 @@ -1,4 +1,4 @@ -/*$NetBSD: netbsd-dm.h,v 1.2 2009/06/05 20:03:58 haad Exp $ */ +/*$NetBSD: netbsd-dm.h,v 1.3 2009/06/09 18:24:02 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -287,7 +287,7 @@ int nbsd_dm_add_uint(const char *, uint64_t, prop_dictionary_t); int nbsd_dm_add_str(const char *, char *, prop_dictionary_t ); -prop_dictionary_t nbsd_dm_parse_param(const char *, char *); +prop_dictionary_t nbsd_dm_parse_param(const char *, const char *); struct dm_ioctl* nbsd_dm_dict_to_dmi(prop_dictionary_t, const int);
CVS commit: src/external/gpl2/lvm2/dist/libdm/ioctl
Module Name:src Committed By: haad Date: Tue Jun 9 18:29:09 UTC 2009 Modified Files: src/external/gpl2/lvm2/dist/libdm/ioctl: libdm_netbsd.c Log Message: Create default target_params parse routine which is called when we doesn't find name of a target in known target list. This routine will pass whole param string in a dictionary with key called params. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.2 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.3 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.2 Fri Jun 5 19:57:25 2009 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c Tue Jun 9 18:29:09 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm_netbsd.c,v 1.2 2009/06/05 19:57:25 haad Exp $*/ +/* $NetBSD: libdm_netbsd.c,v 1.3 2009/06/09 18:29:09 haad Exp $*/ /* * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ static prop_dictionary_t dm_parse_mirror(char *); static prop_dictionary_t dm_parse_snapshot(char *); static prop_dictionary_t dm_parse_snapshot_origin(char *); +static prop_dictionary_t dm_parse_default(char *); static struct nbsd_dm_target_param dmt_parse[] = { {"linear", dm_parse_linear}, @@ -104,8 +105,6 @@ dict = NULL; slen = strlen(target); - printf("Parsing target %s, string %s\n", target, params); - /* copy parameter string to new buffer */ param = dm_malloc(strlen(params) * sizeof(char)); strlcpy(param, params, strlen(params)+1); @@ -119,11 +118,10 @@ if (strncmp(target, dmt_parse[i].name, slen) == 0) break; } - -if (dmt_parse[i].name == NULL) -return NULL; - printf("target found %s, params %s\n", dmt_parse[i].name, params); + /* Create default dictionary with key params and with string as a value */ +if (dmt_parse[i].name == NULL) + dm_parse_default(param); dict = dmt_parse[i].parse(param); @@ -157,9 +155,7 @@ if (**ap != '\0') ap++; } - printf("Linear target params parsing routine called %s -- %d \n", - argv[1], strtol(argv[1], (char **)NULL, 10)); - + prop_dictionary_set_cstring(dict, DM_TARGET_LINEAR_DEVICE, argv[0]); prop_dictionary_set_uint64(dict, DM_TARGET_LINEAR_OFFSET, strtoll(argv[1], (char **)NULL, 10)); @@ -192,7 +188,6 @@ if (**ap != '\0') ap++; } - printf("Stripe target params parsing routine called\n"); prop_dictionary_set_uint64(dict, DM_TARGET_STRIPE_STRIPES, strtol(argv[0], (char **)NULL, 10)); @@ -253,6 +248,18 @@ return dict; } +static prop_dictionary_t +dm_parse_default(char *params) +{ + prop_dictionary_t dict; + + dict = prop_dictionary_create(); + + prop_dictionary_set_cstring(dict, DM_TABLE_PARAMS, params); + + return dict; +} + int nbsd_get_dm_major(uint32_t *major, int type) {
CVS commit: src/sbin/fsck
Module Name:src Committed By: haad Date: Sun Jun 14 21:06:19 UTC 2009 Modified Files: src/sbin/fsck: partutil.c Log Message: Remove bogus warn, which was printed when DIOCGDISKINFO failed. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/fsck/partutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.7 src/sbin/fsck/partutil.c:1.8 --- src/sbin/fsck/partutil.c:1.7 Sat Jun 6 18:31:29 2009 +++ src/sbin/fsck/partutil.c Sun Jun 14 21:06:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.7 2009/06/06 18:31:29 haad Exp $ */ +/* $NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: partutil.c,v 1.7 2009/06/06 18:31:29 haad Exp $"); +__RCSID("$NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $"); #include #include @@ -168,12 +168,11 @@ /* Get disk description dictionary */ if ((error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, &disk_dict)) != 0) { - warn("Please implement DIOCGDISKINFO for %s disk driver\n", s); - /* * Ask for disklabel if DIOCGDISKINFO failed. This is * compatibility call and can be removed when all devices * will support DIOCGDISKINFO. + * cgd, ccd pseudo disk drives doesn't support DIOCGDDISKINFO */ if ((error = ioctl(fd, DIOCGDINFO, lp)) == -1) { printf("DIOCGDINFO on %s failed\n", s);
CVS commit: src/sys/dev/dm
Module Name:src Committed By: haad Date: Sun Jun 28 22:05:07 UTC 2009 Modified Files: src/sys/dev/dm: files.dm Log Message: Remove unneeded targets from build. Should fix brekage of ALL kernel build found by ceg...@. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dm/files.dm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dm/files.dm diff -u src/sys/dev/dm/files.dm:1.4 src/sys/dev/dm/files.dm:1.5 --- src/sys/dev/dm/files.dm:1.4 Fri Jan 2 11:03:24 2009 +++ src/sys/dev/dm/files.dm Sun Jun 28 22:05:07 2009 @@ -5,9 +5,5 @@ filedev/dm/dm_pdev.cdm filedev/dm/dm_table.c dm filedev/dm/dm_target.c dm -filedev/dm/dm_target_error.cdm filedev/dm/dm_target_linear.c dm -filedev/dm/dm_target_mirror.c dm -filedev/dm/dm_target_zero.c dm -file dev/dm/dm_target_snapshot.c dm file dev/dm/dm_target_stripe.c dm
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: haad Date: Thu Aug 6 16:00:49 UTC 2009 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Add support for DIOCGDISKINFO for wedges. This fixes regression after my DIOCGDISKINFO commit to fsck/partutil.c. Tested by me and adegr...@. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/dkwedge/dk.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/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.47 src/sys/dev/dkwedge/dk.c:1.48 --- src/sys/dev/dkwedge/dk.c:1.47 Tue Jul 21 19:41:00 2009 +++ src/sys/dev/dkwedge/dk.c Thu Aug 6 16:00:49 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.47 2009/07/21 19:41:00 dyoung Exp $ */ +/* $NetBSD: dk.c,v 1.48 2009/08/06 16:00:49 haad Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.47 2009/07/21 19:41:00 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.48 2009/08/06 16:00:49 haad Exp $"); #include "opt_dkwedge.h" @@ -221,6 +221,39 @@ free(oldarray, M_DKWEDGE); } +static void +dkgetproperties(struct disk *disk, struct dkwedge_info *dkw) +{ + prop_dictionary_t disk_info, odisk_info, geom; + + disk_info = prop_dictionary_create(); + + prop_dictionary_set_cstring_nocopy(disk_info, "type", "ESDI"); + + geom = prop_dictionary_create(); + + prop_dictionary_set_uint64(geom, "sectors-per-unit", dkw->dkw_size); + + prop_dictionary_set_uint32(geom, "sector-size", + DEV_BSIZE /* XXX 512? */); + + prop_dictionary_set_uint32(geom, "sectors-per-track", 32); + + prop_dictionary_set_uint32(geom, "tracks-per-cylinder", 64); + + prop_dictionary_set_uint32(geom, "cylinders-per-unit", dkw->dkw_size / 2048); + + prop_dictionary_set(disk_info, "geometry", geom); + prop_object_release(geom); + + odisk_info = disk->dk_info; + + disk->dk_info = disk_info; + + if (odisk_info != NULL) + prop_object_release(odisk_info); +} + /* * dkwedge_add: [exported function] * @@ -396,6 +429,7 @@ */ disk_init(&sc->sc_dk, device_xname(sc->sc_dev), NULL); + dkgetproperties(&sc->sc_dk, dkw); disk_attach(&sc->sc_dk); /* Disk wedge is ready for use! */ @@ -1265,6 +1299,12 @@ if (sc->sc_state != DKW_STATE_RUNNING) return (ENXIO); + error = disk_ioctl(&sc->sc_dk, cmd, data, flag, l); + if (error != EPASSTHROUGH) + return (error); + + error = 0; + switch (cmd) { case DIOCCACHESYNC: /* @@ -1280,7 +1320,7 @@ break; case DIOCGWEDGEINFO: { - struct dkwedge_info *dkw = (void *) data; + struct dkwedge_info *dkw = (void *) data; strlcpy(dkw->dkw_devname, device_xname(sc->sc_dev), sizeof(dkw->dkw_devname));
CVS commit: src/external/cddl/osnet
Module Name:src Committed By: haad Date: Fri Aug 7 18:34:48 UTC 2009 Update of /cvsroot/src/external/cddl/osnet In directory ivanova.netbsd.org:/tmp/cvs-serv16692 Log Message: Import Opensolaris source code used with zfs port. Zfs code si from date 200811. Status: Vendor Tag: sun Release Tags: osnet-20081117 N src/external/cddl/osnet/dist/onet-src.tar.bz2 N src/external/cddl/osnet/dist/cmd/zdb/zdb.c N src/external/cddl/osnet/dist/cmd/zdb/zdb_il.c N src/external/cddl/osnet/dist/cmd/zfs/zfs_iter.c N src/external/cddl/osnet/dist/cmd/zfs/zfs_iter.h N src/external/cddl/osnet/dist/cmd/zfs/zfs_main.c N src/external/cddl/osnet/dist/cmd/zfs/zfs_util.h N src/external/cddl/osnet/dist/cmd/zpool/zpool_iter.c N src/external/cddl/osnet/dist/cmd/zpool/zpool_main.c N src/external/cddl/osnet/dist/cmd/zpool/zpool_util.c N src/external/cddl/osnet/dist/cmd/zpool/zpool_util.h N src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c N src/external/cddl/osnet/dist/cmd/ztest/ztest.c N src/external/cddl/osnet/dist/common/acl/acl_common.c N src/external/cddl/osnet/dist/common/acl/acl_common.h N src/external/cddl/osnet/dist/common/avl/avl.c N src/external/cddl/osnet/dist/common/nvpair/nvpair.c N src/external/cddl/osnet/dist/common/nvpair/nvpair_alloc_fixed.c N src/external/cddl/osnet/dist/common/unicode/u8_textprep.c N src/external/cddl/osnet/dist/common/zfs/zfs_comutil.c N src/external/cddl/osnet/dist/common/zfs/zfs_comutil.h N src/external/cddl/osnet/dist/common/zfs/zfs_deleg.c N src/external/cddl/osnet/dist/common/zfs/zfs_deleg.h N src/external/cddl/osnet/dist/common/zfs/zfs_namecheck.c N src/external/cddl/osnet/dist/common/zfs/zfs_namecheck.h N src/external/cddl/osnet/dist/common/zfs/zfs_prop.c N src/external/cddl/osnet/dist/common/zfs/zfs_prop.h N src/external/cddl/osnet/dist/common/zfs/zpool_prop.c N src/external/cddl/osnet/dist/common/zfs/zprop_common.c N src/external/cddl/osnet/dist/head/ucred.h N src/external/cddl/osnet/dist/lib/libefi/common/crc32_efi.c N src/external/cddl/osnet/dist/lib/libnvpair/libnvpair.c N src/external/cddl/osnet/dist/lib/libnvpair/libnvpair.h N src/external/cddl/osnet/dist/lib/libnvpair/nvpair_alloc_system.c N src/external/cddl/osnet/dist/lib/libshare/common/libshare.h N src/external/cddl/osnet/dist/lib/libuutil/common/libuutil_common.h N src/external/cddl/osnet/dist/lib/libuutil/common/libuutil.h N src/external/cddl/osnet/dist/lib/libuutil/common/libuutil_impl.h N src/external/cddl/osnet/dist/lib/libuutil/common/uu_alloc.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_avl.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_dprintf.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_ident.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_list.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_misc.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_pname.c N src/external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_changelist.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_config.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs.h N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_graph.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_impl.h N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_status.c N src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c N src/external/cddl/osnet/dist/lib/libzpool/common/taskq.c N src/external/cddl/osnet/dist/lib/libzpool/common/util.c N src/external/cddl/osnet/dist/uts/common/fs/gfs.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_traverse.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_object.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/bplist.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/txg.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_objset.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_send.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_zfetch.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/metaslab.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_deleg.c N src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c N src/external/cddl/osnet/dist/uts/comm
CVS commit: src/external/cddl/osnet/dist
Module Name:src Committed By: haad Date: Fri Aug 7 18:48:49 UTC 2009 Removed Files: src/external/cddl/osnet/dist: onet-src.tar.bz2 Log Message: Remove accidentally commited tar.bz2 file. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r0 src/external/cddl/osnet/dist/onet-src.tar.bz2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Fri Aug 7 22:46:04 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_dir.c Log Message: Fix bogus comment, and remove superfluous parenthesis. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c Fri Aug 7 22:46:04 2009 @@ -213,7 +213,7 @@ * prevent us deadlocking trying to grab the same wide lock * twice if the two names happen to be case-insensitive * matches. - * + */ if (flag & ZRENAMING) cmpflags = 0; else @@ -236,9 +236,8 @@ } for (dl = dzp->z_dirlocks; dl != NULL; dl = dl->dl_next) { if ((u8_strcmp(name, dl->dl_name, 0, cmpflags, -U8_UNICODE_LATEST, &error) == 0) || error != 0){ +U8_UNICODE_LATEST, &error) == 0) || error != 0) break; - } } if (error != 0) { mutex_exit(&dzp->z_lock);
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Fri Aug 7 22:47:19 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ioctl.c Log Message: Enable zfs module only for machine with at least 512Mb ram. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 7 22:47:19 2009 @@ -3139,8 +3139,7 @@ extern uint_t rrw_tsd_key; /* ZFS must be used on machines with at least 512Mb. */ -/*#define ZFS_MIN_MEGS 512 */ -#define ZFS_MIN_MEGS 128 /*XXX Use 128Mb for testing only.*/ +#define ZFS_MIN_MEGS 512 static int zfs_modcmd(modcmd_t cmd, void *arg)
CVS commit: src/doc
Module Name:src Committed By: haad Date: Sun Aug 9 10:00:35 UTC 2009 Modified Files: src/doc: CHANGES Log Message: Mention first round of zfs import. To generate a diff of this commit: cvs rdiff -u -r1.1271 -r1.1272 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1271 src/doc/CHANGES:1.1272 --- src/doc/CHANGES:1.1271 Sun Aug 9 08:53:58 2009 +++ src/doc/CHANGES Sun Aug 9 10:00:34 2009 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1271 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1272 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -357,5 +357,7 @@ openssl: Import SNAP-20090805 to fix the namespace issues (BLOCK, CSTRING, etc) [christos 20090805] tcx(8): support wsdisplay and acceleration [macallan 20090806] + zfs: Import OpenSolaris zfs source code to NetBSD, add NetBSD + patches. [haad 20090808] gpioiic(4): New driver to create an I2C bus using GPIO pins in bit-banging mode. [mbalmer 20090809]
CVS commit: src/sys/dev
Module Name:src Committed By: haad Date: Sun Aug 9 14:32:08 UTC 2009 Modified Files: src/sys/dev: DEVNAMES Log Message: Add device-mapper driver which I forgot to add in haad-dm branch. To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 src/sys/dev/DEVNAMES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/DEVNAMES diff -u src/sys/dev/DEVNAMES:1.250 src/sys/dev/DEVNAMES:1.251 --- src/sys/dev/DEVNAMES:1.250 Sun Aug 9 14:18:46 2009 +++ src/sys/dev/DEVNAMES Sun Aug 9 14:32:07 2009 @@ -1,4 +1,4 @@ -# $NetBSD: DEVNAMES,v 1.250 2009/08/09 14:18:46 mbalmer Exp $ +# $NetBSD: DEVNAMES,v 1.251 2009/08/09 14:32:07 haad Exp $ # # This file contains all used device names and defined attributes in # alphabetical order. New devices added to the system somewhere should first @@ -322,6 +322,7 @@ dhu MI dio hp300 dl MI +dm MI dma MI dma sun3 dmac newsmips
CVS commit: src/sys
Module Name:src Committed By: haad Date: Sun Aug 9 22:49:01 UTC 2009 Modified Files: src/sys/compat/common: vfs_syscalls_50.c src/sys/compat/darwin: darwin_stat.c src/sys/compat/ibcs2: ibcs2_misc.c src/sys/compat/linux/common: linux_file.c src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_netbsd.c src/sys/compat/osf1: osf1_file.c src/sys/compat/svr4: svr4_misc.c src/sys/kern: vfs_syscalls.c src/sys/sys: vfs_syscalls.h Log Message: Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions can be called from kernel, too. Change needed for zfs device node creation, until we have propoer devfs. Oked by a...@. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/vfs_syscalls_50.c cvs rdiff -u -r1.15 -r1.16 src/sys/compat/darwin/darwin_stat.c cvs rdiff -u -r1.107 -r1.108 src/sys/compat/ibcs2/ibcs2_misc.c cvs rdiff -u -r1.97 -r1.98 src/sys/compat/linux/common/linux_file.c cvs rdiff -u -r1.4 -r1.5 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.157 -r1.158 src/sys/compat/netbsd32/netbsd32_netbsd.c cvs rdiff -u -r1.36 -r1.37 src/sys/compat/osf1/osf1_file.c cvs rdiff -u -r1.145 -r1.146 src/sys/compat/svr4/svr4_misc.c cvs rdiff -u -r1.398 -r1.399 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.12 -r1.13 src/sys/sys/vfs_syscalls.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/compat/common/vfs_syscalls_50.c diff -u src/sys/compat/common/vfs_syscalls_50.c:1.4 src/sys/compat/common/vfs_syscalls_50.c:1.5 --- src/sys/compat/common/vfs_syscalls_50.c:1.4 Mon Jan 26 13:00:04 2009 +++ src/sys/compat/common/vfs_syscalls_50.c Sun Aug 9 22:49:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_50.c,v 1.4 2009/01/26 13:00:04 njoly Exp $ */ +/* $NetBSD: vfs_syscalls_50.c,v 1.5 2009/08/09 22:49:00 haad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.4 2009/01/26 13:00:04 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.5 2009/08/09 22:49:00 haad Exp $"); #include #include @@ -309,5 +309,5 @@ syscallarg(uint32_t) dev; } */ return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode), - SCARG(uap, dev), retval); + SCARG(uap, dev), retval, UIO_USERSPACE); } Index: src/sys/compat/darwin/darwin_stat.c diff -u src/sys/compat/darwin/darwin_stat.c:1.15 src/sys/compat/darwin/darwin_stat.c:1.16 --- src/sys/compat/darwin/darwin_stat.c:1.15 Sun Jan 11 02:45:47 2009 +++ src/sys/compat/darwin/darwin_stat.c Sun Aug 9 22:49:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: darwin_stat.c,v 1.15 2009/01/11 02:45:47 christos Exp $ */ +/* $NetBSD: darwin_stat.c,v 1.16 2009/08/09 22:49:00 haad Exp $ */ /*- * Copyright (c) 2003, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: darwin_stat.c,v 1.15 2009/01/11 02:45:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: darwin_stat.c,v 1.16 2009/08/09 22:49:00 haad Exp $"); #include #include @@ -131,5 +131,5 @@ } */ return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode), - darwin_to_native_dev(SCARG(uap, dev)), retval); + darwin_to_native_dev(SCARG(uap, dev)), retval, UIO_USERSPACE); } Index: src/sys/compat/ibcs2/ibcs2_misc.c diff -u src/sys/compat/ibcs2/ibcs2_misc.c:1.107 src/sys/compat/ibcs2/ibcs2_misc.c:1.108 --- src/sys/compat/ibcs2/ibcs2_misc.c:1.107 Fri May 15 16:59:07 2009 +++ src/sys/compat/ibcs2/ibcs2_misc.c Sun Aug 9 22:49:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_misc.c,v 1.107 2009/05/15 16:59:07 pooka Exp $ */ +/* $NetBSD: ibcs2_misc.c,v 1.108 2009/08/09 22:49:00 haad Exp $ */ /* * Copyright (c) 1992, 1993 @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.107 2009/05/15 16:59:07 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.108 2009/08/09 22:49:00 haad Exp $"); #include #include @@ -634,7 +634,7 @@ return sys_mkfifo(l, &ap, retval); } else { return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode), - SCARG(uap, dev), retval); + SCARG(uap, dev), retval, UIO_USERSPACE); } } Index: src/sys/compat/linux/common/linux_file.c diff -u src/sys/compat/linux/common/linux_file.c:1.97 src/sys/compat/linux/common/linux_file.c:1.98 --- src/sys/compat/linux/common/linux_file.c:1.97 Sun Jan 11 02:45:48 2009 +++ src/sys/compat/linux/common/linux_file.c Sun Aug 9 22:49:01 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file.c,v 1.97 2009/01/11 02:45:48 christos Exp $ */ +/* $NetBSD: linux_file.c,v 1.98 2009/08/09 22:49:01 haad Exp $ */ /*- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.97 2009/01/11 02:45:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBS
CVS commit: src/sys/modules
Module Name:src Committed By: haad Date: Mon Aug 10 07:16:06 UTC 2009 Added Files: src/sys/modules/solaris: Makefile src/sys/modules/zfs: Makefile Log Message: Add solaris and zfs kernel modules build directories. These modules will not be built during release build until we import other kernel patches needed. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/modules/solaris/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/zfs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/modules/solaris/Makefile diff -u /dev/null src/sys/modules/solaris/Makefile:1.1 --- /dev/null Mon Aug 10 07:16:06 2009 +++ src/sys/modules/solaris/Makefile Mon Aug 10 07:16:06 2009 @@ -0,0 +1,96 @@ +# $NetBSD: Makefile,v 1.1 2009/08/10 07:16:06 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 + +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${.CURDIR}/../.. +CPPFLAGS+= -I${.CURDIR}/../../../../include +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 Index: src/sys/modules/zfs/Makefile diff -u /dev/null src/sys/modules/zfs/Makefile:1.1 --- /dev/null Mon Aug 10 07:16:06 2009 +++ src/sys/modules/zfs/Makefile Mon Aug 10 07:16:06 2009 @@ -0,0 +1,134 @@ +# $NetBSD: Makefile,v 1.1 2009/08/10 07:16:06 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_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+= 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+= fletcher.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 + +.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-prot
CVS commit: src/sys/modules/raidframe
Module Name:src Committed By: haad Date: Mon Aug 10 07:19:11 UTC 2009 Added Files: src/sys/modules/raidframe: Makefile Log Message: Add raidframe module dir. Rf needs some fixes before it can be used as a kernel module. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/modules/raidframe/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/modules/raidframe/Makefile diff -u /dev/null src/sys/modules/raidframe/Makefile:1.1 --- /dev/null Mon Aug 10 07:19:11 2009 +++ src/sys/modules/raidframe/Makefile Mon Aug 10 07:19:11 2009 @@ -0,0 +1,20 @@ +# $NetBSD: Makefile,v 1.1 2009/08/10 07:19:11 haad Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/dev/raidframe + +KMOD= raidframe +SRCS= rf_dagffwr.c rf_dagfuncs.c rf_dagutils.c rf_debugMem.c rf_debugprint.c \ + rf_decluster.c rf_declusterPQ.c rf_diskqueue.c rf_disks.c rf_driver.c \ + rf_engine.c rf_evenodd.c rf_evenodd_dagfuncs.c rf_evenodd_dags.c \ + rf_fifo.c rf_interdecluster.c rf_invertq.c rf_layout.c rf_map.c \ + rf_mcpair.c rf_netbsdkintf.c rf_nwayxor.c rf_options.c rf_paritylog.c \ + rf_paritylogDiskMgr.c rf_paritylogging.c rf_parityloggingdags.c \ + rf_parityscan.c rf_pq.c rf_pqdeg.c rf_pqdegdags.c rf_psstatus.c \ + rf_raid0.c rf_raid1.c rf_raid4.c rf_raid5.c rf_raid5_rotatedspare.c \ + rf_reconbuffer.c rf_reconmap.c rf_reconstruct.c rf_reconutil.c \ + rf_revent.c rf_shutdown.c rf_sstf.c rf_states.c rf_stripelocks.c \ + rf_strutils.c rf_utils.c + +.include
CVS commit: src/sys/sys
Module Name:src Committed By: haad Date: Mon Aug 10 22:29:30 UTC 2009 Modified Files: src/sys/sys: unistd.h Log Message: Add _PC_ACL_EXTENDED and _PC_MIN_HOLE_SIZE which are needed by zfs. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/sys/unistd.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/sys/unistd.h diff -u src/sys/sys/unistd.h:1.48 src/sys/sys/unistd.h:1.49 --- src/sys/sys/unistd.h:1.48 Sat Aug 8 22:53:16 2009 +++ src/sys/sys/unistd.h Mon Aug 10 22:29:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.48 2009/08/08 22:53:16 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.49 2009/08/10 22:29:29 haad Exp $ */ /* * Copyright (c) 1989, 1993 @@ -162,6 +162,10 @@ #define _PC_FILESIZEBITS 11 #define _PC_SYMLINK_MAX 12 #define _PC_2_SYMLINKS 13 +#define _PC_ACL_EXTENDED14 + +/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ +#define _PC_MIN_HOLE_SIZE 15 /* configurable system variables; use as argument to sysconf(3) */ /*
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Mon Aug 10 22:38:02 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c dmu.c spa_history.c zfs_dir.c zfs_vfsops.c src/external/cddl/osnet/dist/uts/common/fs/zfs/sys: vdev_disk.h zfs_znode.h zvol.h Log Message: Add some NetBSD fixes which I have forgot to commit during first round. With these patches I can build solaris and zfs module again. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c \ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c cvs rdiff -u -r1.3 -r1.4 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zvol.h cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Mon Aug 10 22:38:02 2009 @@ -133,6 +133,42 @@ #include #include +#ifdef __NetBSD__ +#include +#define btop(x) ((x) / PAGE_SIZE) +#define needfree (uvmexp.free < uvmexp.freetarg ? uvmexp.freetarg : 0) +#define buf_init arc_buf_init +#define freemem uvmexp.free +#define minfree uvmexp.freemin +#define desfree uvmexp.freetarg +#define lotsfree (desfree * 2) +#define availrmem desfree +#define swapfs_minfree 0 +#define swapfs_reserve 0 +#undef curproc +#define curproc curlwp +#define proc_pageout uvm.pagedaemon_lwp + +#define heap_arena kernel_map +#define VMEM_ALLOC 1 +#define VMEM_FREE 2 +static inline size_t +vmem_size(struct vm_map *map, int flag) +{ + switch (flag) { + case VMEM_ALLOC: + return map->size; + case VMEM_FREE: + return vm_map_max(map) - vm_map_min(map) - map->size; + case VMEM_FREE|VMEM_ALLOC: + return vm_map_max(map) - vm_map_min(map); + default: + panic("vmem_size"); + } +} +static void *zio_arena; +#endif /* __NetBSD__ */ + static kmutex_t arc_reclaim_thr_lock; static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ static uint8_t arc_thread_exit; @@ -3233,10 +3269,8 @@ static uint64_t page_load = 0; static uint64_t last_txg = 0; -#if defined(__i386) available_memory = MIN(available_memory, vmem_size(heap_arena, VMEM_FREE)); -#endif if (available_memory >= zfs_write_limit_max) return (0); Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.3 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.2 Fri Aug 7 20:16:45 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 10 22:38:02 2009 @@ -35,7 +35,6 @@ #include #include #include -#include "fs/fs_subr.h" #include #include #include @@ -51,11 +50,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.2 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.1.1.1 Fri Aug 7 18:32:54 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c Mon Aug 10 22:38:02 2009 @@ -751,6 +751,7 @@ return (err); } +#ifndef __NetBSD__ int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, page_t *pp, dmu_tx_t *tx) @@ -808,6 +809,7 @@ dmu_buf_rele_array(dbp, numbufs, FTAG); return (err); } +#endif /* __NetBSD__ */ #endif typedef struct { Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c:1.2 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c:1.1.1.1 Fri Aug 7 18:33:07 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c Mon Aug 10 22:38:02 2009 @@ -178,7 +178,7 @@ static char * spa_history_zone() { -#ifdef _KERNEL +#if defined(_KERNEL) && !defined(__NetBSD__) return (curproc->p_zone->zone_name); #else return ("global"); Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/
CVS commit: src/sys/modules/solaris
Module Name:src Committed By: haad Date: Mon Aug 10 22:38:59 UTC 2009 Modified Files: src/sys/modules/solaris: Makefile Log Message: Remove strange looking -I entries. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/solaris/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/solaris/Makefile diff -u src/sys/modules/solaris/Makefile:1.1 src/sys/modules/solaris/Makefile:1.2 --- src/sys/modules/solaris/Makefile:1.1 Mon Aug 10 07:16:06 2009 +++ src/sys/modules/solaris/Makefile Mon Aug 10 22:38:59 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2009/08/10 07:16:06 haad Exp $ +# $NetBSD: Makefile,v 1.2 2009/08/10 22:38:59 haad Exp $ .include "../Makefile.inc" @@ -62,7 +62,7 @@ SRCS+= ddi.c SRCS+= mod.c SRCS+= printf.c -SRCS+= taskq.c +#SRCS+= taskq.c SRCS+= vfs.c WARNS= 0 @@ -79,8 +79,6 @@ CWARNFLAGS+= -Wno-missing-prototypes CWARNFLAGS+= -Wno-format -CPPFLAGS+= -I${.CURDIR}/../.. -CPPFLAGS+= -I${.CURDIR}/../../../../include CPPFLAGS+= -I${ZFSDIR}/sys CPPFLAGS+= -I${ZFSDIR}/dist/common/acl CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zmod
CVS commit: src/sys/modules/zfs
Module Name:src Committed By: haad Date: Mon Aug 10 22:39:38 UTC 2009 Modified Files: src/sys/modules/zfs: Makefile Log Message: Remove strange looking -I entries. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/zfs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/zfs/Makefile diff -u src/sys/modules/zfs/Makefile:1.1 src/sys/modules/zfs/Makefile:1.2 --- src/sys/modules/zfs/Makefile:1.1 Mon Aug 10 07:16:06 2009 +++ src/sys/modules/zfs/Makefile Mon Aug 10 22:39:38 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2009/08/10 07:16:06 haad Exp $ +# $NetBSD: Makefile,v 1.2 2009/08/10 22:39:38 haad Exp $ .include "../Makefile.inc" @@ -112,8 +112,6 @@ CWARNFLAGS+= -Wno-missing-prototypes CWARNFLAGS+= -Wno-format -CPPFLAGS+= -I${.CURDIR}/../.. -CPPFLAGS+= -I${.CURDIR}/../../../../include CPPFLAGS+= -I${ZFSDIR}/sys CPPFLAGS+= -I${ZFSDIR}/dist/common/acl CPPFLAGS+= -I${ZFSDIR}/dist/common/zfs @@ -123,7 +121,7 @@ CPPFLAGS+= -I${ZFSDIR}/dist/uts/common/zfs CPPFLAGS+= -I${ZFSDIR}/dist/uts/common -CPPFLAGS+= -Dcaddr_t=__caddr_t "-D__va_list=va_list" +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
CVS commit: src/external/cddl/osnet/sys/kern
Module Name:src Committed By: haad Date: Mon Aug 10 22:41:51 UTC 2009 Modified Files: src/external/cddl/osnet/sys/kern: ddi.c Log Message: Fix number of arguments passed to do_sys_mkdir. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/kern/ddi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/kern/ddi.c diff -u src/external/cddl/osnet/sys/kern/ddi.c:1.1 src/external/cddl/osnet/sys/kern/ddi.c:1.2 --- src/external/cddl/osnet/sys/kern/ddi.c:1.1 Fri Aug 7 20:57:57 2009 +++ src/external/cddl/osnet/sys/kern/ddi.c Mon Aug 10 22:41:51 2009 @@ -105,7 +105,7 @@ break; strlcpy(here, path, e - path + 1); - error = do_sys_mkdir(l, (const char *)here, mode, &ret, UIO_SYSSPACE); + error = do_sys_mkdir((const char *)here, mode, UIO_SYSSPACE); } PNBUF_PUT(here);
CVS commit: src/external/cddl/osnet/lib/libzfs
Module Name:src Committed By: haad Date: Mon Aug 10 22:44:41 UTC 2009 Modified Files: src/external/cddl/osnet/lib/libzfs: fsshare.c Log Message: Rename getline to zgetline to avoid clashes with NetBSD getline. Problem found by za...@. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/lib/libzfs/fsshare.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libzfs/fsshare.c diff -u src/external/cddl/osnet/lib/libzfs/fsshare.c:1.1 src/external/cddl/osnet/lib/libzfs/fsshare.c:1.2 --- src/external/cddl/osnet/lib/libzfs/fsshare.c:1.1 Fri Aug 7 20:57:56 2009 +++ src/external/cddl/osnet/lib/libzfs/fsshare.c Mon Aug 10 22:44:41 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fsshare.c,v 1.1 2009/08/07 20:57:56 haad Exp $ */ +/* $NetBSD: fsshare.c,v 1.2 2009/08/10 22:44:41 haad Exp $ */ /*- * Copyright (c) 2007 Pawel Jakub Dawidek @@ -28,7 +28,7 @@ #include /* __FBSDID("$FreeBSD: src/compat/opensolaris/misc/fsshare.c,v 1.2 2007/04/21 13:17:23 pjd Exp $"); */ -__RCSID("$NetBSD: fsshare.c,v 1.1 2009/08/07 20:57:56 haad Exp $"); +__RCSID("$NetBSD: fsshare.c,v 1.2 2009/08/10 22:44:41 haad Exp $"); #include #include @@ -65,7 +65,7 @@ * mountpoint specified in the 'skip' argument. */ static char * -getline(FILE *fd, const char *skip) +zgetline(FILE *fd, const char *skip) { static char line[MAXLINESIZE]; size_t len, skiplen; @@ -196,7 +196,7 @@ /* Place big, fat warning at the begining of the file. */ fprintf(newfd, "%s", FILE_HEADER); - while (oldfd != NULL && (line = getline(oldfd, mountpoint)) != NULL) + while (oldfd != NULL && (line = zgetline(oldfd, mountpoint)) != NULL) fprintf(newfd, "%s\n", line); if (oldfd != NULL && ferror(oldfd) != 0) { error = ferror(oldfd);
CVS commit: src/external/cddl/osnet/dist/uts/common/sys
Module Name:src Committed By: haad Date: Mon Aug 10 22:47:09 UTC 2009 Added Files: src/external/cddl/osnet/dist/uts/common/sys: priv_names.h Log Message: Add missing header file. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 \ src/external/cddl/osnet/dist/uts/common/sys/priv_names.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/external/cddl/osnet/dist/uts/common/sys/priv_names.h diff -u /dev/null src/external/cddl/osnet/dist/uts/common/sys/priv_names.h:1.1 --- /dev/null Mon Aug 10 22:47:09 2009 +++ src/external/cddl/osnet/dist/uts/common/sys/priv_names.h Mon Aug 10 22:47:09 2009 @@ -0,0 +1,681 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Privilege constant definitions. Privileges and privilege sets + * are only known by name and should be mapped at runtime. + * + * THIS FILE WAS GENERATED; DO NOT EDIT + */ + + +#ifndef _SYS_PRIV_NAMES_H +#define _SYS_PRIV_NAMES_H + + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __PRIV_CONST_IMPL +/* + * Privilege names + */ +/* + * Allows a process to request critical events without limitation. + * Allows a process to request reliable delivery of all events on + * any event queue. + */ +#define PRIV_CONTRACT_EVENT ((const char *)"contract_event") + +/* + * Allows a process to set the service FMRI value of a process + * contract template. + */ +#define PRIV_CONTRACT_IDENTITY ((const char *)"contract_identity") + +/* + * Allows a process to observe contract events generated by + * contracts created and owned by users other than the process's + * effective user ID. + * Allows a process to open contract event endpoints belonging to + * contracts created and owned by users other than the process's + * effective user ID. + */ +#define PRIV_CONTRACT_OBSERVER ((const char *)"contract_observer") + +/* + * Allow a process to access per-CPU hardware performance counters. + */ +#define PRIV_CPC_CPU ((const char *)"cpc_cpu") + +/* + * Allows DTrace kernel-level tracing. + */ +#define PRIV_DTRACE_KERNEL ((const char *)"dtrace_kernel") + +/* + * Allows DTrace process-level tracing. + * Allows process-level tracing probes to be placed and enabled in + * processes to which the user has permissions. + */ +#define PRIV_DTRACE_PROC ((const char *)"dtrace_proc") + +/* + * Allows DTrace user-level tracing. + * Allows use of the syscall and profile DTrace providers to + * examine processes to which the user has permissions. + */ +#define PRIV_DTRACE_USER ((const char *)"dtrace_user") + +/* + * Allows a process to change a file's owner user ID. + * Allows a process to change a file's group ID to one other than + * the process' effective group ID or one of the process' + * supplemental group IDs. + */ +#define PRIV_FILE_CHOWN ((const char *)"file_chown") + +/* + * Allows a process to give away its files; a process with this + * privilege will run as if {_POSIX_CHOWN_RESTRICTED} is not + * in effect. + */ +#define PRIV_FILE_CHOWN_SELF ((const char *)"file_chown_self") + +/* + * Allows a process to execute an executable file whose permission + * bits or ACL do not allow the process execute permission. + */ +#define PRIV_FILE_DAC_EXECUTE ((const char *)"file_dac_execute") + +/* + * Allows a process to read a file or directory whose permission + * bits or ACL do not allow the process read permission. + */ +#define PRIV_FILE_DAC_READ ((const char *)"file_dac_read") + +/* + * Allows a process to search a directory whose permission bits or + * ACL do not allow the process search permission. + */ +#define PRIV_FILE_DAC_SEARCH ((const char *)"file_dac_search") + +/* + * Allows a process to write a file or directory whose permission + * bits or ACL do not allow the process write permission. + * In order to write files owned by uid 0 in the absence of an + * effective uid of 0 ALL privileges are required. + */ +#define PRIV_FILE_DAC_WRITE ((const char *)"file_dac_write") + +/* + * Allows a process to set the sensitivity label of a file or + * directory to a sensitivit
CVS commit: src/sys/modules/solaris
Module Name:src Committed By: haad Date: Mon Aug 10 22:55:08 UTC 2009 Modified Files: src/sys/modules/solaris: Makefile Log Message: Enable taskq which was disabled during testing. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/modules/solaris/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/solaris/Makefile diff -u src/sys/modules/solaris/Makefile:1.2 src/sys/modules/solaris/Makefile:1.3 --- src/sys/modules/solaris/Makefile:1.2 Mon Aug 10 22:38:59 2009 +++ src/sys/modules/solaris/Makefile Mon Aug 10 22:55:08 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2009/08/10 22:38:59 haad Exp $ +# $NetBSD: Makefile,v 1.3 2009/08/10 22:55:08 haad Exp $ .include "../Makefile.inc" @@ -62,7 +62,7 @@ SRCS+= ddi.c SRCS+= mod.c SRCS+= printf.c -#SRCS+= taskq.c +SRCS+= taskq.c SRCS+= vfs.c WARNS= 0
CVS commit: src/sys/uvm
Module Name:src Committed By: haad Date: Mon Aug 10 23:17:29 UTC 2009 Modified Files: src/sys/uvm: uvm_extern.h uvm_page.c uvm_pdaemon.c Log Message: Add uvm_reclaim_hooks support for reclaiming kernel KVA space and memory. This is used only by zfs where uvm_reclaim hook is added from arc cache. Oked a...@. To generate a diff of this commit: cvs rdiff -u -r1.157 -r1.158 src/sys/uvm/uvm_extern.h cvs rdiff -u -r1.145 -r1.146 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.97 -r1.98 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_extern.h diff -u src/sys/uvm/uvm_extern.h:1.157 src/sys/uvm/uvm_extern.h:1.158 --- src/sys/uvm/uvm_extern.h:1.157 Wed Aug 5 14:11:32 2009 +++ src/sys/uvm/uvm_extern.h Mon Aug 10 23:17:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_extern.h,v 1.157 2009/08/05 14:11:32 pooka Exp $ */ +/* $NetBSD: uvm_extern.h,v 1.158 2009/08/10 23:17:29 haad Exp $ */ /* * @@ -534,6 +534,19 @@ #define UVM_COREDUMP_STACK 0x01 /* region is user stack */ /* + * Structure containig uvm reclaim hooks, uvm_reclaim_list is guarded by + * uvm_reclaim_lock. + */ +struct uvm_reclaim_hook { + void (*uvm_reclaim_hook)(void); + SLIST_ENTRY(uvm_reclaim_hook) uvm_reclaim_next; +}; + +voiduvm_reclaim_init(void); +void uvm_reclaim_hook_add(struct uvm_reclaim_hook *); +voiduvm_reclaim_hook_del(struct uvm_reclaim_hook *); + +/* * the various kernel maps, owned by MD code */ extern struct vm_map *kernel_map; Index: src/sys/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.145 src/sys/uvm/uvm_page.c:1.146 --- src/sys/uvm/uvm_page.c:1.145 Thu Mar 12 12:55:16 2009 +++ src/sys/uvm/uvm_page.c Mon Aug 10 23:17:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.145 2009/03/12 12:55:16 abs Exp $ */ +/* $NetBSD: uvm_page.c,v 1.146 2009/08/10 23:17:29 haad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.145 2009/03/12 12:55:16 abs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.146 2009/08/10 23:17:29 haad Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -116,6 +116,9 @@ */ int vm_page_reserve_kernel = 5; +/* Physical memory size */ +uintptr_t physmem; + /* * local variables */ @@ -349,6 +352,7 @@ */ curcpu()->ci_data.cpu_uvm = &uvm.cpus[0]; + uvm_reclaim_init(); uvmpdpol_init(); mutex_init(&uvm_pageqlock, MUTEX_DRIVER, IPL_NONE); mutex_init(&uvm_fpageqlock, MUTEX_DRIVER, IPL_VM); Index: src/sys/uvm/uvm_pdaemon.c diff -u src/sys/uvm/uvm_pdaemon.c:1.97 src/sys/uvm/uvm_pdaemon.c:1.98 --- src/sys/uvm/uvm_pdaemon.c:1.97 Sat Dec 13 11:26:57 2008 +++ src/sys/uvm/uvm_pdaemon.c Mon Aug 10 23:17:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pdaemon.c,v 1.97 2008/12/13 11:26:57 ad Exp $ */ +/* $NetBSD: uvm_pdaemon.c,v 1.98 2009/08/10 23:17:29 haad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.97 2008/12/13 11:26:57 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.98 2009/08/10 23:17:29 haad Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -114,6 +114,11 @@ */ u_int uvm_extrapages; +static kmutex_t uvm_reclaim_lock; + +SLIST_HEAD(uvm_reclaim_hooks, uvm_reclaim_hook) uvm_reclaim_list; + + /* * uvm_wait: wait (sleep) for the page daemon to free some pages * @@ -233,6 +238,8 @@ int extrapages = 0; struct pool *pp; uint64_t where; + struct uvm_reclaim_hook *hook; + UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist); UVMHIST_LOG(pdhist,"", 0, 0, 0, 0); @@ -340,6 +347,13 @@ buf_drain(bufcnt << PAGE_SHIFT); mutex_exit(&bufcache_lock); + mutex_enter(&uvm_reclaim_lock); + SLIST_FOREACH(hook, &uvm_reclaim_list, uvm_reclaim_next) { + (*hook->uvm_reclaim_hook)(); + } + mutex_exit(&uvm_reclaim_lock); + + /* * complete draining the pools. */ @@ -1039,3 +1053,45 @@ uvmpdpol_estimatepageable(active, inactive); } + +void +uvm_reclaim_init(void) +{ + + /* Initialize UVM reclaim hooks. */ + mutex_init(&uvm_reclaim_lock, MUTEX_DEFAULT, IPL_NONE); + SLIST_INIT(&uvm_reclaim_list); + +} + +void +uvm_reclaim_hook_add(struct uvm_reclaim_hook *hook) +{ + + KASSERT(hook != NULL); + + mutex_enter(&uvm_reclaim_lock); + SLIST_INSERT_HEAD(&uvm_reclaim_list, hook, uvm_reclaim_next); + mutex_exit(&uvm_reclaim_lock); +} + +void +uvm_reclaim_hook_del(struct uvm_reclaim_hook *hook_entry) +{ + struct uvm_reclaim_hook *hook; + + KASSERT(hook_entry != NULL); + + mutex_enter(&uvm_reclaim_lock); + SLIST_FOREACH(hook, &uvm_reclaim_list, uvm_reclaim_next) { + if (hook != hook_entry) { + continue; + } + + SLIST_REMOVE(&uvm_reclaim_list, hook, uvm_reclaim_hook, + uvm_reclaim_next); + break; + } + + mutex_exit(&uvm_reclaim_lock); +}
CVS commit: src/sys/uvm
Module Name:src Committed By: haad Date: Tue Aug 11 09:16:53 UTC 2009 Modified Files: src/sys/uvm: uvm_page.c Log Message: Remove physmem definition to uintptr_t from another patch. To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/uvm/uvm_page.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/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.146 src/sys/uvm/uvm_page.c:1.147 --- src/sys/uvm/uvm_page.c:1.146 Mon Aug 10 23:17:29 2009 +++ src/sys/uvm/uvm_page.c Tue Aug 11 09:16:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.146 2009/08/10 23:17:29 haad Exp $ */ +/* $NetBSD: uvm_page.c,v 1.147 2009/08/11 09:16:53 haad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.146 2009/08/10 23:17:29 haad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.147 2009/08/11 09:16:53 haad Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -116,9 +116,6 @@ */ int vm_page_reserve_kernel = 5; -/* Physical memory size */ -uintptr_t physmem; - /* * local variables */
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Wed Aug 12 21:52:41 UTC 2009 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c Log Message: Register callbacks for reclaiming kvm kernel space to arc. Unregister both kvm address space and memory callbacks from kernel during arc_fini call. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.4 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.3 Mon Aug 10 22:38:02 2009 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Wed Aug 12 21:52:41 2009 @@ -167,6 +167,12 @@ } } static void *zio_arena; + +#include +/* Structures used for memory and kva space reclaim. */ +static struct callback_entry arc_kva_reclaim_entry; +static struct uvm_reclaim_hook arc_hook; + #endif /* __NetBSD__ */ static kmutex_t arc_reclaim_thr_lock; @@ -3380,6 +3386,19 @@ } } +static int +arc_kva_reclaim_callback(struct callback_entry *ce, void *obj, void *arg) +{ + + + if (mutex_tryenter(&arc_reclaim_thr_lock)) { + cv_broadcast(&arc_reclaim_thr_cv); + mutex_exit(&arc_reclaim_thr_lock); + } + + return CALLBACK_CHAIN_CONTINUE; +} + #endif /* __NetBSD__ */ void @@ -3495,11 +3514,12 @@ TS_RUN, maxclsyspri); #if defined(__NetBSD__) && defined(_KERNEL) - static struct uvm_reclaim_hook hook; + arc_hook.uvm_reclaim_hook = &arc_uvm_reclaim_hook; - hook.uvm_reclaim_hook = &arc_uvm_reclaim_hook; + uvm_reclaim_hook_add(&arc_hook); + callback_register(&vm_map_to_kernel(kernel_map)->vmk_reclaim_callback, + &arc_kva_reclaim_entry, NULL, arc_kva_reclaim_callback); - uvm_reclaim_hook_add(&hook); #endif arc_dead = FALSE; @@ -3552,6 +3572,12 @@ mutex_destroy(&zfs_write_limit_lock); +#if defined(__NetBSD__) && defined(_KERNEL) + uvm_reclaim_hook_del(&arc_hook); + callback_unregister(&vm_map_to_kernel(kernel_map)->vmk_reclaim_callback, + &arc_kva_reclaim_entry); +#endif + buf_fini(); }
CVS commit: src/external/cddl/osnet/lib/libzpool
Module Name:src Committed By: haad Date: Sun May 2 23:50:34 UTC 2010 Modified Files: src/external/cddl/osnet/lib/libzpool: kernel.c Log Message: Initialize system_taskq during taskq init. This fixes ztest crash in taskq_dispatch. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/lib/libzpool/kernel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libzpool/kernel.c diff -u src/external/cddl/osnet/lib/libzpool/kernel.c:1.3 src/external/cddl/osnet/lib/libzpool/kernel.c:1.4 --- src/external/cddl/osnet/lib/libzpool/kernel.c:1.3 Mon Mar 1 21:13:10 2010 +++ src/external/cddl/osnet/lib/libzpool/kernel.c Sun May 2 23:50:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.c,v 1.3 2010/03/01 21:13:10 haad Exp $ */ +/* $NetBSD: kernel.c,v 1.4 2010/05/02 23:50:34 haad Exp $ */ /* * CDDL HEADER START @@ -29,7 +29,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include -__RCSID("$NetBSD: kernel.c,v 1.3 2010/03/01 21:13:10 haad Exp $"); +__RCSID("$NetBSD: kernel.c,v 1.4 2010/05/02 23:50:34 haad Exp $"); #include #include @@ -597,6 +597,8 @@ snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid()); + system_taskq_init(); + spa_init(mode); }
CVS commit: src/external/cddl/osnet/lib/libumem
Module Name:src Committed By: haad Date: Sun May 2 23:59:54 UTC 2010 Modified Files: src/external/cddl/osnet/lib/libumem: umem.c Log Message: In NetBSD pool cache constructor/destructor routines has inverted arguments. C To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/lib/libumem/umem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libumem/umem.c diff -u src/external/cddl/osnet/lib/libumem/umem.c:1.1 src/external/cddl/osnet/lib/libumem/umem.c:1.2 --- src/external/cddl/osnet/lib/libumem/umem.c:1.1 Fri Aug 7 20:57:56 2009 +++ src/external/cddl/osnet/lib/libumem/umem.c Sun May 2 23:59:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: umem.c,v 1.1 2009/08/07 20:57:56 haad Exp $ */ +/* $NetBSD: umem.c,v 1.2 2010/05/02 23:59:54 haad Exp $ */ /* * CDDL HEADER START @@ -135,7 +135,8 @@ } if(cache->constructor != NULL) { - if(cache->constructor(buf, cache->callback_data, flags) != 0) { + /* XXX NetBSD pool cache costructor has switched arguments. */ + if(cache->constructor(cache->callback_data, buf, flags) != 0) { free(buf); if(!(flags & UMEM_NOFAIL)) return NULL; @@ -155,7 +156,8 @@ void umem_cache_free(umem_cache_t *cache, void *buffer) { if(cache->destructor != NULL) - cache->destructor(buffer, cache->callback_data); + /* XXX NetBSD pool cache costructor has switched arguments. */ + cache->destructor(cache->callback_data, buffer); free(buffer); }
CVS commit: src/external/cddl/osnet/include
Module Name:src Committed By: haad Date: Mon May 3 00:31:32 UTC 2010 Modified Files: src/external/cddl/osnet/include: thread.h Log Message: Add _mutex_held routine to test if mutex_t * is held. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/include/thread.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/include/thread.h diff -u src/external/cddl/osnet/include/thread.h:1.1 src/external/cddl/osnet/include/thread.h:1.2 --- src/external/cddl/osnet/include/thread.h:1.1 Fri Aug 7 20:57:55 2009 +++ src/external/cddl/osnet/include/thread.h Mon May 3 00:31:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: thread.h,v 1.1 2009/08/07 20:57:55 haad Exp $ */ +/* $NetBSD: thread.h,v 1.2 2010/05/03 00:31:32 haad Exp $ */ /* * CDDL HEADER START @@ -52,6 +52,7 @@ #define thr_main() (1) #define _mutex_init(l,f,a) pthread_mutex_init(l,NULL) #define _mutex_destroy(l) pthread_mutex_destroy(l) +#define _mutex_held(l) pthread_mutex_held_np(l) #define mutex_lock(l) pthread_mutex_lock(l) #define mutex_trylock(l) pthread_mutex_trylock(l) #define mutex_unlock(l) pthread_mutex_unlock(l)
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Thu May 6 22:26:55 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: dnode_sync.c Log Message: Fix zfs version 22 merge error. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c:1.4 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c:1.3 Sat Feb 27 23:43:53 2010 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c Thu May 6 22:26:55 2010 @@ -437,11 +437,6 @@ ASSERT(db->db_blkid == DB_BONUS_BLKID || dr->dt.dl.dr_data == db->db_buf); dbuf_unoverride(dr); - mutex_exit(&db->db_mtx); - } else { - mutex_exit(&db->db_mtx); - mutex_destroy(&dr->dt.di.dr_mtx); - dnode_undirty_dbufs(&dr->dt.di.dr_children); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg);
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Thu May 6 22:31:46 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c Log Message: Fix difference btween solaris cv_timedwait and NetBSD one. NetBSD takes offset from current time and solaris exact time from unix born. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.8 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.7 Sat Apr 3 19:01:15 2010 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Thu May 6 22:31:46 2010 @@ -4487,7 +4487,7 @@ (void) cv_timedwait(&l2arc_feed_thr_cv, &l2arc_feed_thr_lock, (hz * l2arc_feed_secs)); CALLB_CPR_SAFE_END(&cpr, &l2arc_feed_thr_lock); - next = ddi_get_lbolt() + hz; + next = ddi_get_lbolt(); /* * Quick check for L2ARC devices.
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Thu May 6 22:35:37 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c Log Message: Disable uvm_reclaim_hook for userland builds. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.8 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.9 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.8 Thu May 6 22:31:46 2010 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Thu May 6 22:35:37 2010 @@ -174,7 +174,10 @@ #include /* Structures used for memory and kva space reclaim. */ static struct callback_entry arc_kva_reclaim_entry; + +#ifdef _KERNEL static struct uvm_reclaim_hook arc_hook; +#endif #endif /* __NetBSD__ */
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Mon May 10 06:10:59 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_znode.c Log Message: Get new vnode when creating zfs share dir for it's znode. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.7 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.6 Sat Feb 27 23:43:53 2010 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c Mon May 10 06:10:59 2010 @@ -484,7 +484,8 @@ sharezp->z_zfsvfs = zfsvfs; vp = ZTOV(sharezp); - vn_reinit(vp); + error = getnewvnode(VT_ZFS, zfsvfs->z_parent->z_vfs, + zfs_vnodeop_p, &zp->z_vnode); vp->v_type = VDIR; VERIFY(0 == zfs_acl_ids_create(sharezp, IS_ROOT_NODE, &vattr,
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: haad Date: Mon May 10 06:15:28 UTC 2010 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: spa.c Log Message: Fix spa_thread to compile under the NetBSD. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.4 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c:1.3 Sat Feb 27 23:43:53 2010 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c Mon May 10 06:15:28 2010 @@ -1,3 +1,4 @@ + /* * CDDL HEADER START * @@ -671,13 +672,14 @@ callb_cpr_t cprinfo; spa_t *spa = arg; -#ifdef PORT_SOLARIS - user_t *pu = PTOU(curproc); CALLB_CPR_INIT(&cprinfo, &spa->spa_proc_lock, callb_generic_cpr, spa->spa_name); ASSERT(curproc != &p0); +#ifdef PORT_SOLARIS + user_t *pu = PTOU(curproc); + (void) snprintf(pu->u_psargs, sizeof (pu->u_psargs), "zpool-%s", spa->spa_name); (void) strlcpy(pu->u_comm, pu->u_psargs, sizeof (pu->u_comm)); @@ -753,7 +755,7 @@ ASSERT(spa->spa_proc_state == SPA_PROC_NONE); ASSERT(spa->spa_proc == &p0); spa->spa_did = 0; - +#if 0 /* Only create a process if we're going to be around a while. */ if (spa_create_process && strcmp(spa->spa_name, TRYIMPORT_NAME) != 0) { if (newproc(spa_thread, (caddr_t)spa, syscid, maxclsyspri, @@ -773,7 +775,8 @@ spa->spa_name); #endif } - } + } +#endif mutex_exit(&spa->spa_proc_lock); /* If we didn't create a process, we need to create our taskqs. */
CVS commit: src/external/cddl/osnet/include
Module Name:src Committed By: haad Date: Mon May 10 06:26:11 UTC 2010 Modified Files: src/external/cddl/osnet/include: thread.h Log Message: If thread_create was called with thread_id = NULL use our local thread id as replacement otherwise we will crash. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/include/thread.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/include/thread.h diff -u src/external/cddl/osnet/include/thread.h:1.2 src/external/cddl/osnet/include/thread.h:1.3 --- src/external/cddl/osnet/include/thread.h:1.2 Mon May 3 00:31:32 2010 +++ src/external/cddl/osnet/include/thread.h Mon May 10 06:26:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: thread.h,v 1.2 2010/05/03 00:31:32 haad Exp $ */ +/* $NetBSD: thread.h,v 1.3 2010/05/10 06:26:11 haad Exp $ */ /* * CDDL HEADER START @@ -91,9 +91,16 @@ if(flags & THR_DETACHED) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + thread_t th_id; + thread_t *t_id; + if(new_thread_ID != NULL) + t_id = new_thread_ID; + else + t_id = &th_id; + /* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */ - ret = pthread_create(new_thread_ID, &attr, start_func, arg); + ret = pthread_create(t_id, &attr, start_func, arg); pthread_attr_destroy(&attr);
CVS commit: src/external/cddl/osnet/lib/libumem
Module Name:src Committed By: haad Date: Mon May 10 06:27:57 UTC 2010 Modified Files: src/external/cddl/osnet/lib/libumem: Makefile Log Message: Disable building of stub_stand.c we build all locking primitives in libzpool. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/lib/libumem/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libumem/Makefile diff -u src/external/cddl/osnet/lib/libumem/Makefile:1.4 src/external/cddl/osnet/lib/libumem/Makefile:1.5 --- src/external/cddl/osnet/lib/libumem/Makefile:1.4 Sun Feb 28 22:45:45 2010 +++ src/external/cddl/osnet/lib/libumem/Makefile Mon May 10 06:27:57 2010 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.4 2010/02/28 22:45:45 haad Exp $ +# $NetBSD: Makefile,v 1.5 2010/05/10 06:27:57 haad Exp $ LIB= umem -SRCS= umem.c stub_stand.c +SRCS= umem.c .include "../../Makefile.zfs" .include
CVS commit: src/external/cddl/osnet/lib/libzpool
Module Name:src Committed By: haad Date: Tue May 11 22:18:10 UTC 2010 Modified Files: src/external/cddl/osnet/lib/libzpool: kernel2.c Log Message: Fix userspace cv_timedwait implementation to work on NetBSD. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/lib/libzpool/kernel2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/lib/libzpool/kernel2.c diff -u src/external/cddl/osnet/lib/libzpool/kernel2.c:1.1 src/external/cddl/osnet/lib/libzpool/kernel2.c:1.2 --- src/external/cddl/osnet/lib/libzpool/kernel2.c:1.1 Fri Aug 7 20:57:56 2009 +++ src/external/cddl/osnet/lib/libzpool/kernel2.c Tue May 11 22:18:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel2.c,v 1.1 2009/08/07 20:57:56 haad Exp $ */ +/* $NetBSD: kernel2.c,v 1.2 2010/05/11 22:18:10 haad Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: kernel2.c,v 1.1 2009/08/07 20:57:56 haad Exp $"); +__RCSID("$NetBSD: kernel2.c,v 1.2 2010/05/11 22:18:10 haad Exp $"); #include @@ -239,6 +239,7 @@ clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime) { + struct timespec nowts; struct timespec ts; uint64_t when; int error; @@ -247,10 +248,14 @@ cv_init(cv, NULL, 0, NULL); } + clock_gettime(CLOCK_REALTIME, &nowts); + /* convert back from 119hz to nanoseconds. */ - when = abstime << 23; + when = (uint64_t)abstime << 23; ts.tv_sec = (long)(abstime / 10); ts.tv_nsec = (long)(abstime % 10); + + timespecadd(&ts, &nowts, &ts); do { error = pthread_cond_timedwait(GET(cv), GET(mp), &ts);
CVS commit: src/sys
Module Name:src Committed By: haad Date: Tue May 11 22:26:00 UTC 2010 Modified Files: src/sys/kern: kern_kthread.c src/sys/sys: kthread.h Log Message: Add support for kthread_join in our kernel thread implementation. This is used by zfs but I think that it can be generaly usefull. Thread need to be created with KTHREAD_JOINABLE flag and can be joined only once. When joinable thread was created it will not e automatically reaped from system and kthread_join must be called on it to reap it. Ok by a...@. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/kern/kern_kthread.c cvs rdiff -u -r1.8 -r1.9 src/sys/sys/kthread.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/kern/kern_kthread.c diff -u src/sys/kern/kern_kthread.c:1.27 src/sys/kern/kern_kthread.c:1.28 --- src/sys/kern/kern_kthread.c:1.27 Wed Oct 21 21:12:06 2009 +++ src/sys/kern/kern_kthread.c Tue May 11 22:26:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_kthread.c,v 1.27 2009/10/21 21:12:06 rmind Exp $ */ +/* $NetBSD: kern_kthread.c,v 1.28 2010/05/11 22:26:00 haad Exp $ */ /*- * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.27 2009/10/21 21:12:06 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.28 2010/05/11 22:26:00 haad Exp $"); #include #include @@ -52,6 +52,12 @@ /* * Fork a kernel thread. Any process can request this to be done. + * + * With joinable kthreads KTHREAD_JOINABLE flag this should be known. + * 1. If you specify KTHREAD_JOINABLE, you must call kthread_join() to reap the thread. + *It will not be automatically reaped by the system. + * 2. For any given call to kthread_create(KTHREAD_JOINABLE), you may call kthread_join() + *only once on the returned lwp_t *. */ int kthread_create(pri_t pri, int flag, struct cpu_info *ci, @@ -60,10 +66,11 @@ { lwp_t *l; vaddr_t uaddr; - int error; + int error, lc, lwp_flags; va_list ap; - int lc; + lwp_flags = LWP_DETACHED; + uaddr = uvm_uarea_alloc(); if (uaddr == 0) { return ENOMEM; @@ -73,7 +80,12 @@ } else { lc = SCHED_RR; } - error = lwp_create(&lwp0, &proc0, uaddr, LWP_DETACHED, NULL, + + if ((flag & KTHREAD_JOINABLE) != 0) { + lwp_flags &= ~LWP_DETACHED; + } + + error = lwp_create(&lwp0, &proc0, uaddr, lwp_flags, NULL, 0, func, arg, &l, lc); if (error) { uvm_uarea_free(uaddr); @@ -82,7 +94,7 @@ if (fmt != NULL) { l->l_name = kmem_alloc(MAXCOMLEN, KM_SLEEP); if (l->l_name == NULL) { - lwp_exit(l); + kthread_destroy(l); return ENOMEM; } va_start(ap, fmt); @@ -97,6 +109,11 @@ KASSERT((flag & KTHREAD_MPSAFE) != 0); } + /* Joinable kthread can't be NULL. */ + if ((flag & KTHREAD_JOINABLE) != 0) { + KASSERT(l != NULL); + } + if (pri == PRI_NONE) { if ((flag & KTHREAD_TS) != 0) { /* Maximum user priority level. */ @@ -182,9 +199,39 @@ void kthread_destroy(lwp_t *l) { - + proc_t *p; + KASSERT((l->l_flag & LW_SYSTEM) != 0); KASSERT(l->l_stat == LSIDL); + p = l->l_proc; + + /* Add LRP_DETACHED flag because we can have joinable kthread now. */ + mutex_enter(p->p_lock); + l->l_prflag |= LPR_DETACHED; + mutex_exit(p->p_lock); + lwp_exit(l); } + +/* + * Wait for a kthread to exit, as pthread_join(). + */ +int +kthread_join(lwp_t *l) +{ + lwpid_t departed; + proc_t *p; + int error; + + KASSERT((l->l_flag & LW_SYSTEM) != 0); + KASSERT((l->l_prflag & LPR_DETACHED) == 0); + + p = l->l_proc; + + mutex_enter(p->p_lock); + error = lwp_wait1(curlwp, l->l_lid, &departed, LWPWAIT_EXITCONTROL); + mutex_exit(p->p_lock); + + return error; +} Index: src/sys/sys/kthread.h diff -u src/sys/sys/kthread.h:1.8 src/sys/sys/kthread.h:1.9 --- src/sys/sys/kthread.h:1.8 Thu Jan 29 22:00:26 2009 +++ src/sys/sys/kthread.h Tue May 11 22:26:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kthread.h,v 1.8 2009/01/29 22:00:26 ad Exp $ */ +/* $NetBSD: kthread.h,v 1.9 2010/05/11 22:26:00 haad Exp $ */ /*- * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc. @@ -44,6 +44,7 @@ #define KTHREAD_MPSAFE 0x02 /* does not need kernel_lock */ #define KTHREAD_INTR 0x04 /* interrupt handler */ #define KTHREAD_TS 0x08 /* timeshared */ +#define KTHREAD_JOINABLE 0x10 /* joinable thread */ int kthread_create(pri_t, int, struct cpu_info *, void (*)(void *), void *, @@ -51,6 +52,7 @@ __attribute__((__format__(__printf__,7,8))); void kthread_exit(int) __dead; void kthread_destroy(lwp_t *); +int kthread_join(lwp_t *); #endif /* _KERNEL */ #endif /* _SYS_KTHREAD_H_ */
CVS commit: src/sys/kern
Module Name:src Committed By: haad Date: Wed May 12 15:53:20 UTC 2010 Modified Files: src/sys/kern: kern_kthread.c Log Message: Fix bogus KASSERT, typo and KNFize my previous patch. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/kern/kern_kthread.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/kern/kern_kthread.c diff -u src/sys/kern/kern_kthread.c:1.28 src/sys/kern/kern_kthread.c:1.29 --- src/sys/kern/kern_kthread.c:1.28 Tue May 11 22:26:00 2010 +++ src/sys/kern/kern_kthread.c Wed May 12 15:53:20 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_kthread.c,v 1.28 2010/05/11 22:26:00 haad Exp $ */ +/* $NetBSD: kern_kthread.c,v 1.29 2010/05/12 15:53:20 haad Exp $ */ /*- * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.28 2010/05/11 22:26:00 haad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.29 2010/05/12 15:53:20 haad Exp $"); #include #include @@ -54,10 +54,10 @@ * Fork a kernel thread. Any process can request this to be done. * * With joinable kthreads KTHREAD_JOINABLE flag this should be known. - * 1. If you specify KTHREAD_JOINABLE, you must call kthread_join() to reap the thread. - *It will not be automatically reaped by the system. - * 2. For any given call to kthread_create(KTHREAD_JOINABLE), you may call kthread_join() - *only once on the returned lwp_t *. + * 1. If you specify KTHREAD_JOINABLE, you must call kthread_join() to reap + *the thread. It will not be automatically reaped by the system. + * 2. For any given call to kthread_create(KTHREAD_JOINABLE), you may call + *kthread_join() only once on the returned lwp_t *. */ int kthread_create(pri_t pri, int flag, struct cpu_info *ci,
CVS commit: src/share/man/man9
Module Name:src Committed By: haad Date: Wed May 12 15:54:47 UTC 2010 Modified Files: src/share/man/man9: kthread.9 Log Message: Document kthread_join in kthread(9). To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/share/man/man9/kthread.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/kthread.9 diff -u src/share/man/man9/kthread.9:1.20 src/share/man/man9/kthread.9:1.21 --- src/share/man/man9/kthread.9:1.20 Mon Aug 3 23:29:19 2009 +++ src/share/man/man9/kthread.9 Wed May 12 15:54:47 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: kthread.9,v 1.20 2009/08/03 23:29:19 rmind Exp $ +.\" $NetBSD: kthread.9,v 1.21 2010/05/12 15:54:47 haad Exp $ .\" .\" Copyright (c) 2000, 2007, 2008 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,6 +34,7 @@ .Nm kthread_create , .Nm kthread_destroy , .Nm kthread_exit +.Nm kthread_join .Nd kernel threads .Sh SYNOPSIS .In sys/kthread.h @@ -108,6 +109,8 @@ .Fa ci , meaning that it will only ever execute on that CPU. By default, the threads are free to execute on any CPU in the system. +.Dv KTHREAD_JOINABLE +Request creation of joinable kthread. .It Fa func A function to be called when the thread begins executing. This function must not return. @@ -139,6 +142,8 @@ .It Fn kthread_exit "ecode" Exit from a kernel thread. Must only be called by a kernel thread. +.It Fn kthread_join "l" +Suspend execution of running LWP untils the target kthread terminates. .El .Sh RETURN VALUES Upon successful completion,