<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>;B.I.T:B.U.C.K.E.T;   </title>
    <link>http://www.olix0r.net/bitbucket/index.cgi</link>
    <description>bits + bites</description>
    <language>en</language>

  <item>
    <title>Compilation!</title>
    <link>http://www.olix0r.net/bitbucket/index.cgi/2007/08/14#compilation</link>
    <description>&lt;p&gt;
  The following files now compile:
  &lt;pre style=&quot;padding-left:20px;&quot;&gt;
sys/compat/opensolaris/kern/opensolaris_kmem.c
sys/compat/opensolaris/kern/opensolaris_kobj.c
sys/compat/opensolaris/kern/opensolaris_kstat.c
sys/compat/opensolaris/kern/opensolaris_misc.c
sys/compat/opensolaris/kern/opensolaris_policy.c
sys/compat/opensolaris/kern/opensolaris_string.c
sys/contrib/opensolaris/common/acl/acl_common.c
sys/contrib/opensolaris/common/avl/avl.c
sys/contrib/opensolaris/common/nvpair/nvpair.c
sys/contrib/opensolaris/common/zfs/zfs_namecheck.c
sys/contrib/opensolaris/common/zfs/zfs_prop.c
sys/contrib/opensolaris/uts/common/fs/zfs/arc.c
sys/contrib/opensolaris/uts/common/fs/zfs/bplist.c
sys/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
sys/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c
sys/contrib/opensolaris/uts/common/fs/zfs/dnode.c
sys/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
sys/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
sys/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
sys/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
sys/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
sys/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
sys/contrib/opensolaris/uts/common/fs/zfs/fletcher.c
sys/contrib/opensolaris/uts/common/fs/zfs/gzip.c
sys/contrib/opensolaris/uts/common/fs/zfs/lzjb.c
sys/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
sys/contrib/opensolaris/uts/common/fs/zfs/refcount.c
sys/contrib/opensolaris/uts/common/fs/zfs/sha256.c
sys/contrib/opensolaris/uts/common/fs/zfs/spa.c
sys/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
sys/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c
sys/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
sys/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
sys/contrib/opensolaris/uts/common/fs/zfs/space_map.c
sys/contrib/opensolaris/uts/common/fs/zfs/txg.c
sys/contrib/opensolaris/uts/common/fs/zfs/uberblock.c
sys/contrib/opensolaris/uts/common/fs/zfs/unique.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
sys/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c
sys/contrib/opensolaris/uts/common/fs/zfs/zap.c
sys/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c
sys/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
sys/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c
sys/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c
sys/contrib/opensolaris/uts/common/fs/zfs/zil.c
sys/contrib/opensolaris/uts/common/fs/zfs/zio.c
sys/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
sys/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c
sys/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c
sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c
sys/contrib/opensolaris/uts/common/zmod/adler32.c
sys/contrib/opensolaris/uts/common/zmod/crc32.c
sys/contrib/opensolaris/uts/common/zmod/deflate.c
sys/contrib/opensolaris/uts/common/zmod/inffast.c
sys/contrib/opensolaris/uts/common/zmod/inflate.c
sys/contrib/opensolaris/uts/common/zmod/inftrees.c
sys/contrib/opensolaris/uts/common/zmod/trees.c
sys/contrib/opensolaris/uts/common/zmod/zmod.c
sys/contrib/opensolaris/uts/common/zmod/zmod_subr.c
sys/contrib/opensolaris/uts/common/zmod/zutil.c
  &lt;/pre&gt;
  Admittedly, there are some pending issues that have been &lt;tt&gt;#ifndef&lt;/tt&gt;ed
  out to get this point.  Here is a summary of notable changes that have been
  made, and issues that still need to be addressed.  Let's take a look through
  the set of patches that will be committed shortly.  (These patches have been
  trimmed manually for legibility, so there should be no expectation for these
  to work.  Use CVS.)
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;h4&gt;Makefile&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 Makefile.files
--- contrib/opensolaris/uts/common/Makefile.files	28 Jun 2007 21:51:56 -0000	1.1
+++ contrib/opensolaris/uts/common/Makefile.files	11 Aug 2007 22:49:02 -0000
 
+# XXX Edited for ZVOL
  
-	opensolaris_atomic.o	\
-	opensolaris_zfs.o	\
-	opensolaris_zone.o	\
-	zfs_znode.o		\
-	zfs_acl.o		\
-	zfs_ctldir.o		\
-	zfs_dir.o		\
-	zfs_ioctl.o		\
-	zfs_log.o		\
-	zfs_replay.o		\
-	zfs_rlock.o		\
-	zfs_vfsops.o		\
-	zfs_vnops.o		\
    &lt;/pre&gt;
    I am not yet concerned with the ZFS filesystem-- merely storage pool
    volumes.
  &lt;/p&gt;

 &lt;li&gt;&lt;h4&gt;Atomic Ops&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 atomic.h
--- compat/opensolaris/sys/atomic.h	28 Jun 2007 21:51:42 -0000	1.1
+++ compat/opensolaris/sys/atomic.h	11 Aug 2007 22:49:00 -0000
@@ -1,7 +1,12 @@
+/*	$NetBSD: atomic.h,v 1.1.2.2 2007/04/13 04:09:43 thorpej Exp $	*/
+
 /*-
- * Copyright (c) 2007 Pawel Jakub Dawidek &lt;pjd@FreeBSD.org&gt;
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
    &lt;/pre&gt;
    I am using the headers from the &lt;tt&gt;netbsd-thorpej-atomic&lt;/tt&gt; branch.  I
    haven't been able to find the implementation, so I'm guessing it doesn't
    exist yet.  Though the code compiles, we will certainly hit errors when
    trying to link (if we're not able to determine that sort of thing LKMs, I'll
    probably configure another Makefile for static compilation.
    
  &lt;/p&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
retrieving revision 1.1
diff -b -d -u -r1.1 Makefile
--- Makefile	30 Jul 2007 15:21:45 -0000	1.1
+++ Makefile	11 Aug 2007 22:48:59 -0000
@@ -80,6 +80,9 @@
 
+# XXX FIXME arc.c needs atomic_add_64()
+CFLAGS+=-D__HAVE_ATOMIC64_OPS
    &lt;/pre&gt;
    I don't know what's going to happen if we don't have 64b atomic ops.  Arc.c
    has several calls to &lt;tt&gt;atomic_*_64()&lt;/tt&gt;.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Kmem Compatibility&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.2 opensolaris_kmem.c
--- compat/opensolaris/kern/opensolaris_kmem.c	30 Jul 2007 15:21:46 -0000	1.2
+++ compat/opensolaris/kern/opensolaris_kmem.c	11 Aug 2007 22:48:59 -0000
@@ -112,8 +112,11 @@
 kmem_size(void)
 {
 
+#ifndef __NETBSD__
 	return ((u_long)vm_kmem_size);
+#else	/* FIXME */
+	return 0;
+#endif
 }
    &lt;/pre&gt;
    I was hoping tha &lt;/tt&gt;kmem_map-&amp;gt;size&lt;/tt&gt; would implement
    &lt;tt&gt;kmem_size()&lt;/tt&gt;, but &lt;tt&gt;kmem_used()&lt;/tt&gt; returns that value.  How
    does one determine the &lt;i&gt;capacity&lt;/i&gt; of kmem?
  &lt;/p&gt;

  &lt;li&lt;h4&gt;Kobj Combatibility&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -u -d -r1.2 opensolaris_kobj.c
--- opensolaris_kobj.c	30 Jul 2007 15:21:46 -0000	1.2
+++ opensolaris_kobj.c	14 Aug 2007 03:40:48 -0000
@@ -65,23 +68,21 @@
 static void *
 kobj_open_file_vnode(const char *file)
 {
-	struct thread *td = curthread;
+	struct lwp *l = curlwp;
 	struct nameidata nd;
-	int error, flags;
+	int error;
 
-	if (td-&amp;gt;td_proc-&amp;gt;p_fd-&amp;gt;fd_rdir == NULL)
-		td-&amp;gt;td_proc-&amp;gt;p_fd-&amp;gt;fd_rdir = rootvnode;
-	if (td-&amp;gt;td_proc-&amp;gt;p_fd-&amp;gt;fd_cdir == NULL)
-		td-&amp;gt;td_proc-&amp;gt;p_fd-&amp;gt;fd_cdir = rootvnode;
+	if (l-&amp;gt;l_proc-&amp;gt;p_cwdi-&amp;gt;cwdi_rdir == NULL)
+		l-&amp;gt;l_proc-&amp;gt;p_cwdi-&amp;gt;cwdi_rdir = rootvnode;
+	if (l-&amp;gt;l_proc-&amp;gt;p_cwdi-&amp;gt;cwdi_cdir == NULL)
+		l-&amp;gt;l_proc-&amp;gt;p_cwdi-&amp;gt;cwdi_cdir = rootvnode;
 
-	flags = FREAD;
-	NDINIT(&amp;amp;nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td);
-	error = vn_open_cred(&amp;amp;nd, &amp;amp;flags, 0, td-&amp;gt;td_ucred, NULL);
-	NDFREE(&amp;amp;nd, NDF_ONLY_PNBUF);
+	NDINIT(&amp;amp;nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, l);
+	error = _vn_open(&amp;amp;nd, FREAD, 0);
 	if (error != 0)
 		return (NULL);
 	/* We just unlock so we hold a reference. */
-	VOP_UNLOCK(nd.ni_vp, 0, td);
+	VOP_UNLOCK(nd.ni_vp, 0);
 	return (nd.ni_vp);
 }
   &lt;/pre&gt;
   Porting vnode operations is a very large part of this project.  While not
   all vnode-related code will assuredly work at this point, the above code is a
   good example of the type of changes that have to occur.
   &lt;pre class=code&gt;
@@ -89,7 +90,11 @@
 kobj_open_file_loader(const char *file)
 {
 
+#ifndef __NetBSD__
	return (preload_search_by_name(file));
+#else	/* FIXME */
+	return (NULL);
+#endif
 }
   &lt;/pre&gt;
   This is a FreeBSDism that shows up only in kobj compatibility.  It comes from
   their &lt;tt&gt;&amp;lt;sys/linker.h&amp;gt;&lt;/tt&gt;
   &lt;pre class=code&gt;
@@ -156,7 +165,7 @@
 kobj_read_file_vnode(struct _buf *file, char *buf, unsigned size, unsigned off)
 {
 	struct vnode *vp = file-&amp;gt;ptr;
-	struct thread *td = curthread;
+	struct lwp *l = curlwp;
 	struct uio auio;
 	struct iovec aiov;
 	int error;
@@ -169,15 +178,19 @@
 
 	auio.uio_iov = &amp;amp;aiov;
 	auio.uio_offset = (off_t)off;
+#ifndef __NetBSD__
 	auio.uio_segflg = UIO_SYSSPACE;
+#endif
 	auio.uio_rw = UIO_READ;
 	auio.uio_iovcnt = 1;
 	auio.uio_resid = size;
+#ifndef __NetBSD__
 	auio.uio_td = td;
+#endif
 
-	vn_lock(vp, LK_SHARED | LK_RETRY, td);
-	error = VOP_READ(vp, &amp;amp;auio, IO_UNIT | IO_SYNC, td-&amp;gt;td_ucred);
-	VOP_UNLOCK(vp, 0, td);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_READ(vp, &amp;amp;auio, IO_UNIT | IO_SYNC, l-&amp;gt;l_cred);
+	VOP_UNLOCK(vp, 0);
 	return (error != 0 ? -1 : size - auio.uio_resid);
 }
    &lt;/pre&gt;
    There are also some differences in the members of &lt;tt&gt;strcut uio&lt;/tt&gt;.  I
    have not determined how/if it is necessary to pass this information to
    &lt;tt&gt;VOP_READ&lt;/tt&gt; another way. 
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Security Policy Compatibility&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 opensolaris_policy.c
--- compat/opensolaris/kern/opensolaris_policy.c	28 Jun 2007 21:51:38 -0000	1.1
+++ compat/opensolaris/kern/opensolaris_policy.c	11 Aug 2007 22:48:59 -0000
@@ -38,41 +39,59 @@
+#ifdef __NETBSD__	/* FIXME */
+# define priv_check_cred(cred, cmd, num)	(0)
+
+static int
+groupmember(gid_t gid, kauth_cred_t cred)
+{
+       int error, result;
+
+       result = 0;
+       (void) kauth_cred_ismember_gid(cred, gid, &amp;amp;result);
+       return (result); 
+}
+#endif
+
    &lt;/pre&gt;
    &lt;pre class=code&gt;
 int
-secpolicy_fs_unmount(struct ucred *cred, struct mount *vfsp __unused)
+secpolicy_fs_unmount(kauth_cred_t cred, struct mount *vfsp)
 {
 
-	return (priv_check_cred(cred, PRIV_VFS_UNMOUNT, 0));
+	return (kauth_authorize_system(cred, KAUTH_SYSTEM_MOUNT,
+	    KAUTH_REQ_SYSTEM_MOUNT_UNMOUNT, vfsp, NULL, NULL));
 }
    &lt;/pre&gt;
    It was trivial to port the unmount request.  The others.. not so much.  For
    now they are all stubbed with &lt;tt&gt;priv_check_cred()&lt;/tt&gt;.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Vnode&lt;/h4&gt;
  &lt;p&gt;
    As I said earlier, porting vnode makes up a large part of this project (and
    likely, even a larger part in porting the rest of ZFS).  Luckily, most of
    this isn't critical for zpools, so just achieving compilation should be
    sufficient.
    &lt;pre class=code&gt;
diff -b -u -d -r1.2 vnode.h
--- vnode.h	30 Jul 2007 15:21:47 -0000	1.2
+++ vnode.h	14 Aug 2007 04:18:32 -0000
@@ -48,11 +48,8 @@
 
 #define	v_count	v_usecount
 
-static __inline int
-vn_is_readonly(vnode_t *vp)
-{
-	return (vp-&amp;gt;v_mount-&amp;gt;mnt_flag &amp; MNT_RDONLY);
-}
+#define vn_is_readonly(vp)	(vn_writechk((vp)) == ETEXTBSY)
+
 #define	vn_vfswlock(vp)		(0)
 #define	vn_vfsunlock(vp)	do { } while (0)
 #define	vn_ismntpt(vp)		((vp)-&amp;gt;v_type == VDIR &amp;&amp; (vp)-&amp;gt;v_mountedhere != NULL)
@@ -141,6 +138,13 @@
 		vap-&amp;gt;va_mask |= AT_MODE;
 }
 
+static __inline int
+nb_vn_open(struct nameidata *ndp, int filemode, int createmode)
+{
+
+	return (vn_open(ndp, filemode, createmode));
+}
+
    &lt;/pre&gt;
    Before papering over &lt;tt&gt;vn_open()&lt;/tt&gt;, it's copied into a safe namespace
    for access from compat modules.
    &lt;pre class=code&gt;
 #define	FCREAT	O_CREAT
 #define	FTRUNC	O_TRUNC
 #define	FSYNC	FFSYNC
@@ -216,16 +225,17 @@
 
 	ASSERT(flag == FSYNC);
 
-	/* XXX vfslocked = VFS_LOCK_GIANT(vp-&amp;gt;v_mount); */
-	/* FIXME */
    &lt;/pre&gt;
    We don't have a giant lock, right?  Might anything else need to happen here
    in terms of locks?
    &lt;pre class=code&gt;
+#ifndef __NetBSD__
 	if ((error = vn_start_write(vp, &amp;mp, V_WAIT | PCATCH)) != 0)
 		goto drop;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, l);
+#endif
    &lt;/pre&gt;
    I see that NetBSD &lt;i&gt;used to&lt;/i&gt; have &lt;tt&gt;vn_start_write()&lt;/tt&gt;.  I
    haven't tracked through commit logs yet, but I take its absence to
    indicate that this step is not necessary any longer.
    &lt;pre class=code&gt;
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_FSYNC(vp, cr, MNT_WAIT, /* FIXME offsets */ 0, 0, l);
-	VOP_UNLOCK(vp, 0, l);
+	VOP_UNLOCK(vp, 0);
+#ifndef __NetBSD__
 	vn_finished_write(mp);
+#endif
    &lt;/pre&gt;
    And similarly, above.
    &lt;pre class=code&gt;
@@ -249,7 +259,11 @@
 
 	ASSERT(seg == UIO_SYSSPACE);
 
+#ifndef __NetBSD__
 	return (kern_rename(curlwp, from, to, seg));
+#else	/* FIXME */
+	return (ENOTSUP);
+#endif
 }
@@ -260,7 +274,11 @@
 	ASSERT(seg == UIO_SYSSPACE);
 	ASSERT(dirflag == RMFILE);
 
+#ifndef __NetBSD__
 	return (kern_unlink(curlwp, fnamep, seg));
+#else	/* FIXME */
+	return (ENOTSUP);
+#endif
 }
 
 #endif	/* _OPENSOLARIS_SYS_VNODE_H_ */
    &lt;/pre&gt;
    Any pointers on replacements for &lt;tt&gt;kern_unlink()&lt;/tt&gt; and
    &lt;tt&gt;kern_rename()&lt;/tt&gt;?
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Zones compatibility&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 zone.h
--- compat/opensolaris/sys/zone.h	28 Jun 2007 21:51:52 -0000	1.1
+++ compat/opensolaris/sys/zone.h	11 Aug 2007 22:49:01 -0000
@@ -40,22 +38,9 @@
 /*
  * Is process in the global zone?
  */
-#define	INGLOBALZONE(p)	(!jailed((p)-&amp;gt;p_ucred))
-
-/*
- * Attach the given dataset to the given jail.
- */
-extern int zone_dataset_attach(struct ucred *, const char *, int);
-
-/*
- * Detach the given dataset to the given jail.
- */
-extern int zone_dataset_detach(struct ucred *, const char *, int);
+#define	INGLOBALZONE(p)	(p != NULL)
 
-/*
- * Returns true if the named pool/dataset is visible in the current zone.
- */
-extern int zone_dataset_visible(const char *, int *);
+#define zone_dataset_visible(s, n)	(1)
 
 #else	/* !_KERNEL */
    &lt;/pre&gt;
    Early on in the project, I tried to rip a lot of the zones stuff out.  It
    still creeps up in a few places, so I implemented the minimal set of stubs
    above.  I may add some more as I start to look at minimizing the size of my
    diffs.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Adaptive Resource Cache&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 arc.c
--- contrib/opensolaris/uts/common/fs/zfs/arc.c	28 Jun 2007 21:51:57 -0000	1.1
+++ contrib/opensolaris/uts/common/fs/zfs/arc.c	11 Aug 2007 22:49:03 -0000
@@ -148,3 +152,5 @@
+/*
+ * FIXME These tunables are for performance analysis.
 TUNABLE_ULONG(&quot;vfs.zfs.arc_max&quot;, &amp;amp;zfs_arc_max);
 TUNABLE_ULONG(&quot;vfs.zfs.arc_min&quot;, &amp;amp;zfs_arc_min);
 SYSCTL_DECL(_vfs_zfs);
@@ -159,6 +158,7 @@
     &quot;Maximum ARC size&quot;);
 SYSCTL_ULONG(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RD, &amp;amp;zfs_arc_min, 0,
     &quot;Minimum ARC size&quot;);
+ */
     &lt;/pre&gt;
     More sysctl FIXMEs...
     &lt;pre class=code&gt;
@@ -2792,10 +2796,12 @@
 	(void) thread_create(NULL, 0, arc_reclaim_thread, NULL, 0, &amp;amp;p0,
 	    TS_RUN, minclsyspri);
 
+#ifndef __NETBSD__	/* FIXME */
 #ifdef _KERNEL
 	arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL,
 	    EVENTHANDLER_PRI_FIRST);
 #endif
+#endif
 
 	arc_dead = FALSE;
    &lt;/pre&gt;
    FreeBSD uses their EVENTHANDLER framework to monitor a low-watermark in
    their VM system.  To the best that I can tell, this is equivalent to
    &lt;tt&gt;knote(9)&lt;/tt&gt;.  However, I have found no uvm-related knotes at this
    point.  Any pointers?
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;dmu_send&lt;/h4&gt;
  &lt;p&gt;
    I am replacing the FreeBSD &lt;tt&gt;dmu_send.c&lt;/tt&gt; with the original Solaris
    version, which compiles with one small modification:
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 dmu_send.c
--- onnv/uts/common/fs/zfs/dmu_send.c			08 Jun 2007 15:11:35 -0400
+++ contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	11 Aug 2007 23:44:13 -0400
@@ -160,8 +160,10 @@
        void *data = bc-&amp;gt;bc_data;
        int err = 0;
 	 
 +#ifndef __NETBSD__     /* FIXME */
         if (issig(JUSTLOOKING) &amp;amp;&amp;amp; issig(FORREAL))
                 return (EINTR);
 +#endif
 
          ASSERT(data || bp == NULL);
    &lt;/pre&gt;
    I do not know if there is an equivalent for this bit of code in NetBSD.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Sysctl&lt;/h4&gt;
  &lt;p&gt;
    Sysctl(9) is not been fully ported yet.  This is one (of many) examples:
    &lt;pre class=code&gt;
diff -b -d -u -r1.2 spa.c
--- contrib/opensolaris/uts/common/fs/zfs/spa.c	30 Jul 2007 15:15:32 -0000	1.2
+++ contrib/opensolaris/uts/common/fs/zfs/spa.c	11 Aug 2007 22:49:09 -0000
@@ -59,11 +59,13 @@
 #include &amp;lt;sys/fs/zfs.h&amp;gt;
 #include &amp;lt;sys/callb.h&amp;gt;
 #include &amp;lt;sys/sunddi.h&amp;gt;
+#include &amp;lt;sys/vnode.h&amp;gt;
 
-/* FIXME */
 int zio_taskq_threads = 0;
+#ifndef __NETBSD__	/* FIXME */
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_NODE(_vfs_zfs, OID_AUTO, zio, CTLFLAG_RW, 0, &quot;ZFS ZIO&quot;);
 TUNABLE_INT(&quot;vfs.zfs.zio.taskq_threads&quot;, &amp;amp;zio_taskq_threads);
 SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, taskq_threads, CTLFLAG_RW,
     &amp;amp;zio_taskq_threads, 0, &quot;Number of ZIO threads per ZIO type&quot;);
+#endif
    &lt;/pre&gt;
  &lt;/p&gt;
  &lt;p&gt;
    One notable use of sysctl (in the ARC) is the &lt;tt&gt;kstat&lt;/tt&gt; compability
    code.  The kstat compat code is intended to interface with sysctl through
    the following kstat calls:
    &lt;ul&gt;
      &lt;li&gt;&lt;tt&gt;kstat_create()&lt;/tt&gt;
      &lt;p&gt;
	Configures nodes in the sysctl tree in the form:
	&lt;pre class=code&gt;
	  kstat.&lt;i&gt;&amp;lt;module&amp;gt;&lt;/i&gt;.&lt;i&gt;&amp;lt;class&amp;gt;&lt;/i&gt;.&lt;i&gt;&amp;lt;name&amp;gt;&lt;/i&gt;
	&lt;/pre&gt;
	The &lt;i&gt;class&lt;/i&gt; sysctlnode is returned in &lt;tt&gt;ksp-&gt;ks_sysctl_root&lt;/t&gt;.
        &lt;pre class=code&gt;
diff -b -u -d -r1.1 opensolaris_kstat.c
--- opensolaris_kstat.c	28 Jun 2007 21:51:37 -0000	1.1
+++ opensolaris_kstat.c	14 Aug 2007 03:40:31 -0000
@@ -62,6 +75,7 @@
 	 *
 	 *	kstat.&lt;module&gt;.&lt;class&gt;.&lt;name&gt;.
 	 */
+#ifndef __NetBSD__
 	sysctl_ctx_init(&amp;amp;ksp-&amp;gt;ks_sysctl_ctx);
 	root = SYSCTL_ADD_NODE(&amp;amp;ksp-&amp;gt;ks_sysctl_ctx,
 	    SYSCTL_STATIC_CHILDREN(_kstat), OID_AUTO, module, CTLFLAG_RW, 0,
@@ -90,11 +104,41 @@
 		free(ksp, M_KSTAT);
 		return (NULL);
 	}
+#else	/* FIXME */
+	root = NULL;
+	if (sysctl_createv(NULL, 0, NULL, &amp;amp;root, 0, CTLTYPE_NODE, &quot;kstat&quot;,
+	    NULL, NULL, 0, NULL, 0, CTL_KERN, CTL_CREATE, CTL_EOL) != 0) {
+		printf(&quot;%s: Cannot create kstat tree!\n&quot;, __func__);
+		free(ksp, M_KSTAT);
+		return NULL;
+	}
+	if (sysctl_createv(NULL, 0, &amp;amp;root, &amp;amp;root, 0, CTLTYPE_NODE, module,
+	    NULL, NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0) {
+		printf(&quot;%s: Cannot create kstat.%s tree!\n&quot;, __func__, module);
+		free(ksp, M_KSTAT);
+		return NULL;
+	}
+	if (sysctl_createv(NULL, 0, &amp;amp;root, &amp;amp;root, 0, CTLTYPE_NODE, class,
+	    NULL, NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0) {
+		printf(&quot;%s: Cannot create kstat.%s.%s tree!\n&quot;, __func__,
+		    module, class);
+		free(ksp, M_KSTAT);
+		return NULL;
+	}
+	if (sysctl_createv(NULL, 0, &amp;amp;root, &amp;amp;root, 0, CTLTYPE_NODE, name,
+	    NULL, NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0) {
+		printf(&quot;%s: Cannot create kstat.%s.%s.%s tree!\n&quot;, __func__,
+		    module, class, name);
+		free(ksp, M_KSTAT);
+		return NULL;
+	}
+#endif
 	ksp-&amp;gt;ks_sysctl_root = root;
 
 	return (ksp);
 }
 
+#ifndef __NetBSD__
 static int
 kstat_sysctl(SYSCTL_HANDLER_ARGS)
 {
@@ -104,6 +148,29 @@
 	val = ksent-&amp;gt;value.ui64;
 	return sysctl_handle_quad(oidp, &amp;amp;val, 0, req);
 }
+#else
+static int
+kstat_sysctl(SYSCTLFN_ARGS)
+{
+	struct sysctlnode	 node;
+	uint64_t		 val;
+	kstat_named_t		*ksent;
+	int			 error;
+
+	node = *rnode;
+	ksent = newp;
+
+	node.sysctl_data = &amp;amp;val;
+
+	error = sysctl_lookup(SYSCTLFN_CALL(&amp;amp;node));
+	if (error || newp == NULL)
+		return (error);
+
+	val = ksent-&amp;gt;value.ui64;
+
+	return (0);
+}
+#endif
          &lt;/pre&gt;
        &lt;/p&gt;
      &lt;li&gt;&lt;tt&gt;kstat_install()&lt;/tt&gt;
      &lt;p&gt;
        Add a &lt;tt&gt;knode_named_t&lt;/tt&gt; into sysctl as &lt;tt&gt;*newp&lt;/tt&gt;.  (via
	&lt;tt&gt;kstat_sysctl()&lt;/tt&gt; (above).  The sysctl helper needs to be looked
	at to determine whether it will work at all as expected.
        &lt;pre class=code&gt;
 void
 kstat_install(kstat_t *ksp)
@@ -113,12 +180,18 @@
 
 	ksent = ksp-&amp;gt;ks_data;
 	for (i = 0; i &amp;lt; ksp-&amp;gt;ks_ndata; i++, ksent++) {
-		KASSERT(ksent-&amp;gt;data_type == KSTAT_DATA_UINT64,
-		    (&quot;data_type=%d&quot;, ksent-&amp;gt;data_type));
+		KASSERT(ksent-&amp;gt;data_type == KSTAT_DATA_UINT64);
+#ifndef __NetBSD__
 		SYSCTL_ADD_PROC(&amp;amp;ksp-&amp;gt;ks_sysctl_ctx,
 		    SYSCTL_CHILDREN(ksp-&amp;gt;ks_sysctl_root), OID_AUTO, ksent-&amp;gt;name,
 		    CTLTYPE_QUAD | CTLFLAG_RD, ksent, sizeof(*ksent),
 		    kstat_sysctl, &quot;QU&quot;, &quot;&quot;);
+#else
+		sysctl_createv(NULL, 0, &amp;amp;ksp-&amp;gt;ks_sysctl_root, NULL,
+		    CTLFLAG_READWRITE, CTLTYPE_QUAD,
+		    ksent-&amp;gt;name, NULL, kstat_sysctl, 0, ksent, sizeof(*ksent),
+		    CTL_CREATE, CTL_EOL);
+#endif
 	}
 }
        &lt;/pre&gt;
      &lt;/p&gt;
 
      &lt;li&gt;&lt;tt&gt;kstat_delete()&lt;/tt&gt;
      &lt;p&gt;
	Free the kstat data.  I don't know if we should teardown parts of the
	sysctl tree too.
        &lt;pre class=code&gt;
@@ -126,6 +199,8 @@
 kstat_delete(kstat_t *ksp)
 {
 
+#ifndef __NetBSD__
 	sysctl_ctx_free(&amp;amp;ksp-&amp;gt;ks_sysctl_ctx);
+#endif
 	free(ksp, M_KSTAT);
 }
        &lt;/pre&gt;
      &lt;/p&gt;
    &lt;/ul&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Also, I don't know if a SYSCTL_SETUP function is necessary-- I don't
    believe it is.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;mutex&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre&gt;
diff -b -u -d -r1.3 mutex.h
--- compat/opensolaris/sys/mutex.h      30 Jul 2007 15:21:46 -0000      1.3
+++ compat/opensolaris/sys/mutex.h      12 Aug 2007 06:16:41 -0000
@@ -53,6 +55,8 @@
 #define mutex_init(mtx, desc, type, arg)                               \
        zfs_mutex_init((mtx), (desc), (type), (arg))
 
+#define mutex_owner(mtx)       ((struct lwp *)(mtx)-&amp;gt;mtx_owner)
+
 #endif /* _KERNEL */
 
 #endif /* _OPENSOLARIS_SYS_MUTEX_H_ */
    &lt;/pre&gt;
    I was unsure how to mimick &lt;tt&gt;mutex_owner()&lt;/tt&gt;.  I finally found the
    following in &lt;tt&gt;%lt;sys/mutex%gt;&lt;/tt&gt;:
    &lt;pre class=code&gt;
(isla)$ nl -ba /usr/src/sys/sys/mutex.h | sed -n 54,60p
    54   *      struct mutex
    55   *              The actual mutex structure.  This structure is mostly
    56   *              opaque to machine-independent code; most access are done
    57   *              through macros.  However, machine-independent code must
    58   *              be able to access the following members:
    59   *
    60   *              uintptr_t               mtx_owner
    ..   .              ...			...
    &lt;/pre&gt;
  &lt;/p&gt;
  &lt;p&gt;
    However, we have to define &lt;tt&gt;__MUTEX_PRIVATE&lt;/tt&gt; to get this macro (in
    &lt;tt&gt;sys/arch/x86/include/mutex.h&lt;/tt&gt; by doing the following:
    &lt;pre class=code&gt;
@@ -34,7 +34,9 @@
 
 #ifdef _KERNEL
 
+#define __MUTEX_PRIVATE                /* We need mtx_owner */
 #include_next &lt;sys/mutex.h&gt;
+
 #include  &amp;lt;sys/param.h&amp;gt;
 /* XXX #include &amp;lt;sys/proc.h&amp;gt; */
 #include  &amp;lt;sys/lock.h&amp;gt;
    &lt;/pre&gt;
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Adaptive Replacement Cache&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
diff -b -d -u -r1.1 arc.h
--- contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	28 Jun 2007 21:52:19 -0000	1.1
+++ contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	11 Aug 2007 22:49:15 -0000
@@ -39,0 +40,4 @@
+#ifdef __NETBSD__	/* XXX Namespace clash with buf.h */
+# undef b_data
+# undef b_private
+#endif
    &lt;/pre&gt;
    A nasty, annoying namespace clash with &lt;tt&gt;&amp;lt;sys/buf.h&amp;gt;&lt;/tt&gt; forces me
    to undefine the above two macros (which are otherwise used to access data
    and private elements within a union).  I hope this doesn't cause a problem.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Asynchronous Read/Write calls&lt;/h4&gt;
  &lt;p&gt;
    &lt;pre class=code&gt;
--- contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h	28 Jun 2007 21:52:28 -0000	1.1
+++ contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h	11 Aug 2007 22:49:16 -0000
@@ -51,8 +51,10 @@
 extern int zvol_strategy(buf_t *bp);
 extern int zvol_read(dev_t dev, uio_t *uiop, cred_t *cr);
 extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr);
+# ifndef __NetBSD__
 extern int zvol_aread(dev_t dev, struct aio_req *aio, cred_t *cr);
 extern int zvol_awrite(dev_t dev, struct aio_req *aio, cred_t *cr);
+# endif
 #endif
 extern int zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr,
     int *rvalp);
    &lt;/pre&gt;
    Async-Read/Write is not implemented.
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Prototypes and Function Pointers&lt;/h4&gt;
  &lt;p&gt;
    While all of the Solaris code is generally lucid,
    &lt;tt&gt;&amp;lt;bsd.kmod.mk&amp;gt;&lt;/tt&gt; uses pretty strict warning flags (e.g.
    &lt;tt&gt;-Wstrict-prototypes -Wmissing-prototypes&lt;/tt&gt;).  Furthermore, the
    Solaris headers qualify prototypes with &lt;tt&gt;extern&lt;/tt&gt;.  I have added all
    missing prototypes to the beginning of each C file.  This can easily be
    reversed at some point, but it made my life a lot easier...
  &lt;/p&gt;
  &lt;p&gt;
    Similarly, this strictness affects function pointer declaration.  Therefore,
    the types of (missing) arguments were specified as in the followng example
    from &lt;tt&gt;sys/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h:236&lt;/tt&gt;:
    &lt;pre class=code&gt;
    &amp;lt; typedef int zil_replay_func_t();
    &amp;gt; typedef int zil_replay_func_t(void*,void*,boolean_t);
    &lt;/pre&gt;
  &lt;/p&gt;

  &lt;li&gt;&lt;h4&gt;Remaining compile errors&lt;/h4&gt;
  &lt;p&gt;
    Of course, there are still some compile errors left in
    &lt;tt&gt;sys/contrib/opensolaris/uts/common/os/&lt;/tt&gt;.  The one I'm currently at
    follows:
    &lt;pre class=code&gt;
#   compile  sys/taskq.o
cc -O2 -D_SOLARIS_C_SOURCE -D__HAVE_ATOMIC64_OPS
-I~/src/zfs/src/sys/compat/opensolaris
-I~/src/zfs/src/sys/contrib/opensolaris/uts/common/fs/zfs
-I~/src/zfs/src/sys/contrib/opensolaris/uts/common/zmod
-I~/src/zfs/src/sys/contrib/opensolaris/uts/common
-I~/src/zfs/src/sys/contrib/opensolaris/common/zfs
-I~/src/zfs/src/sys/contrib/opensolaris/common
-I~/src/zfs/src/sys/../include -I~/src/zfs/src/sys
-ffreestanding  -fno-strict-aliasing -Wno-pointer-sign -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wall
-Wno-unknown-pragmas -Wno-missing-braces -Wno-parentheses -Wno-uninitialized
-Wno-unused -Wno-switch -Werror   -nostdinc -I. -I~/src/zfs/src/sys
-isystem /usr/src/sys -isystem /usr/src/sys/arch -isystem
/usr/src/sys/../common/include -D_KERNEL -D_LKM  -c
~/src/zfs/src/sys/contrib/opensolaris/uts/common/os/taskq.c
In file included from /usr/src/sys/sys/device.h:80,
                 from ~/src/zfs/src/sys/x86/pic.h:6,
                 from ~/src/zfs/src/sys/machine/pic.h:3,
                 from ~/src/zfs/src/sys/x86/intr.h:45,
                 from ~/src/zfs/src/sys/machine/intr.h:3,
                 from /usr/src/sys/sys/mutex.h:187,
                 from ~/src/zfs/src/sys/compat/opensolaris/sys/mutex.h:38,
                 from ~/src/zfs/src/sys/compat/opensolaris/sys/taskq_impl.h:32,
                 from ~/src/zfs/src/sys/contrib/opensolaris/uts/common/os/taskq.c:374:
/usr/src/sys/sys/evcnt.h:85: error: expected specifier-qualifier-list before 'uint64_t'
    &lt;/pre&gt;
    Otherwise, in this directory, it's the pretty standard fare of prototype
    warnings and &lt;tt&gt;#ifndef&lt;/tt&gt;ing around &lt;tt&gt;SYSINIT(..)&lt;/tt&gt;.
  &lt;/p&gt;
  &lt;p&gt;
    And outside of these problems, we're at least compiling ;).  Next comes the
    fun task of (trying to) link zfs into the kernel, which almost has to be
    done statically, as I understand it, in order to get reasonable information. 
  &lt;/p&gt;
&lt;/ul&gt;</description>
  </item>
  <item>
    <title>Tricky Disks</title>
    <link>http://www.olix0r.net/bitbucket/index.cgi/2007/08/09#tricky_disks</link>
    <description>&lt;p&gt;
  Most of zvol &amp; vdev_disk is complete (though untested).  Here's a summary of
  notable aspects and pending issues related to these two interfaces:
&lt;/p&gt;
&lt;h4&gt;Pseudo disk structure&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;The ZVOL top-half presents a volume through a device node.
  &lt;li&gt;Calls go through the ZVOL device into the Intent Log (ZIL), through the
    I/O Pipeline (ZIO), where much of the ZFS magic occurs,
  &lt;li&gt;And then eventually the Virtual Devices (vdevs) interact with the
    underlying disk drivers.
&lt;/ul&gt;
&lt;p&gt;
  In order to configure the pseudo disk, we do the following:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
/*
 * Configure pseudo-disk interface
 */
zv-&amp;gt;zv_dk.dk_name = zv-&amp;gt;zv_name;
zv-&amp;gt;zv_dk.dk_driver = &amp;zvoldkdriver;
pseudo_disk_init(&amp;zv-&amp;gt;zv_dk);
zv-&amp;gt;zv_flags = DKF_INITED;

/*
 * XXX Is there a need to set a geometry.  It is very likely possible
 * that zv_volsize can handle everything.
 */

/* Attach ZVOL */
pseudo_disk_attach(&amp;zv-&amp;gt;zv_dk);

dkwedge_discover(&amp;zv-&amp;gt;zv_dk);
&lt;/pre&gt;
&lt;p&gt;
  At one point I was using the &lt;tt&gt;dk_softc&lt;/tt&gt; structure out of
  &lt;tt&gt;sys/dev/dkvar.h&lt;/tt&gt;, which, you may notice, has many of the same fields
  that are in the zvol's softc:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
struct zvol_softc {
	struct device	 zv_device;     	/* device softc for driver(9) */
	char		 zv_name[MAXPATHLEN];	/* pool/dd name */
	&lt;span class=emph&gt;uint64_t	 zv_volsize;&lt;/span&gt;		/* amount of space we advertise */
	&lt;span class=emph&gt;uint64_t	 zv_volblocksize;&lt;/span&gt;	/* volume block size */
&lt;/pre&gt;
&lt;p&gt;
  Note that there are sufficiently large types to hold these values.
  &lt;tt&gt;dk_softc.sc_size&lt;/tt&gt; is only a (4 byte) &lt;tt&gt;size_t&lt;/tt&gt;.
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
	minor_t		 zv_minor;      /* minor number */
	uint8_t		 zv_min_bs;     /* minimum addressable block shift */
	uint8_t		 zv_readonly;   /* hard readonly; like write-protect */
	objset_t	*zv_objset;     /* objset handle */
	uint32_t	 zv_mode;       /* DS_MODE_* flags at open time */
	uint32_t	 zv_total_opens; /* total open count */
	zilog_t		*zv_zilog;      /* ZIL handle */
	uint64_t	 zv_txg_assign; /* txg to assign during ZIL replay */
	znode_t		 zv_znode;      /* for range locking */
	&lt;span class=emph&gt;struct disk	 zv_dk;&lt;/span&gt;         /* disk interface */
	&lt;span class=emph&gt;uint32_t	 zv_flags;&lt;/span&gt;      /* DKF_* state flags */
};
&lt;/pre&gt;
&lt;h4&gt;IOCTLs&lt;/h4&gt;
&lt;ul&gt;

  &lt;li&gt;&lt;tt&gt;case DKIOCFLUSHWRITECACHE:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCCACHESYNC:&lt;/tt&gt;
  &lt;p&gt;
    I've think I've got this one figured out, actually.
  &lt;/p&gt;
  &lt;p&gt;
    I was forewarned about the cache-flushing ioctl being important to proper
    ZFS behavior.  Solaris's &lt;tt&gt;DKIOCFLUSHWRITECACHE&lt;/tt&gt; is, I believe,
    equivalent to NetBSD's &lt;tt&gt;DIOCCACHESYNC&lt;/tt&gt; (once the disk's write cache
    has been enabled with &lt;tt&gt;(DIOCSCACHE, DKCACHE_WRITE)&lt;/tt&gt;).  In the
    underlying vdevs, &lt;tt&gt;VOP_IOCTL(DIOCCACHESYNC)&lt;/tt&gt; is performed on the
    backing device node's vnode.
  &lt;/p&gt;
  &lt;p&gt;
    The vnode, in this case (or, at this point?), is that yielded from a
    &lt;tt&gt;lookup(9)&lt;/tt&gt; on the device node as specified to &lt;tt&gt;zpool(1)&lt;/tt&gt;.
  &lt;/p&gt;

  &lt;li&gt;&lt;tt&gt;case DIOCAWEDGE:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCDWEDGE:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCLWEDGES:&lt;/tt&gt;
    &lt;p&gt;
      These were trivial to import from pre-existing pseudo-disk drivers.
    &lt;/p&gt;

  &lt;li&gt;&lt;tt&gt;case DIOCGDINFO:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCWDINFO:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCSDINFO:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCGPART:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCWLABEL:&lt;/tt&gt;&lt;br&gt;
      &lt;tt&gt;case DIOCGDEFLABEL:&lt;/tt&gt;
    &lt;p&gt;
      These have not been absolutely trivial to import.  Can these IOCTLs be
      left unsupported?  As I understand it, we could simply require GPT labels
      to be written for ZVOL storage. 
    &lt;/p&gt;

&lt;/ul&gt;

&lt;h4&gt;Proplib&lt;/h4&gt;
&lt;p&gt;
  &lt;tt&gt;gpt(8)&lt;/tt&gt; uses drvctl to get sector and media size, so we need to update
  the &lt;tt&gt;prop_dictionary&lt;/tt&gt; in the &lt;tt&gt;zvol_softc&lt;/tt&gt; with accurate
  information.  &lt;tt&gt;sys/kern/kern_drvctl.c&lt;/tt&gt; uses the &lt;tt&gt;dv_properties&lt;/tt&gt;
  dictionary in &lt;tt&gt;struct device&lt;/tt&gt;.  However, &lt;tt&gt;ld(4)&lt;/tt&gt; uses the
  &lt;tt&gt;dk_info&lt;/tt&gt; in &lt;tt&gt;struct disk&lt;/tt&gt;.  I haven't resolved what needs to be
  done here.  Either way, I gather that (de)referencing will have to occur
  during disk attachment and detachment.
&lt;/p&gt;


&lt;h4&gt;Disk IDs&lt;/h4&gt;
&lt;p&gt;
  Also, Solaris and FreeBSD are able to keep track of a unique disk
  identifications, so that when a disk is reattached, e.g. on a different
  controller, it can be detected and correctly added to the proper zpool.
&lt;/p&gt;

&lt;p&gt;
  Stay tuned for the next half of this status update...
&lt;/p&gt;

&lt;!--
  vim: filetype=html colorscheme=zellner
  --&gt;</description>
  </item>
  <item>
    <title>ZVOL device drivers</title>
    <link>http://www.olix0r.net/bitbucket/index.cgi/2007/07/20#zvol_drivers</link>
    <description>Since dynamic device node creation is not currently possible (not
easily, at least) in NetBSD, zvol-attaching and mounting will be
handled much differently than in other implementations, at least
within the context of the summer.
&lt;p&gt;
ZVOLs are &amp;quot;created&amp;quot; through &lt;tt&gt;zvol_create_minor(name,
dev)&lt;/tt&gt; (by ioctls on &lt;tt&gt;/dev/zfs&lt;/tt&gt;, and therefore
&lt;tt&gt;zfs_ioctl.c&lt;/tt&gt;).  NetBSD's implementations uses
&lt;tt&gt;namei(9)&lt;/tt&gt; to find the vnode of the device node of the given
volume, and then the minor number is determined with
&lt;tt&gt;VOP_GETATTR(9)&lt;/tt&gt;.
&lt;p&gt;
	&lt;div style=&quot;margin:10px;padding:10px;font-style:italic;&quot;&gt;
	Actually, it comes as an afterthought that device node
	creation may be possible with &lt;tt&gt;VOP_MKNOD(9)&lt;/tt&gt;
	(basically, copying the &lt;tt&gt;mknod(2)&lt;/tt&gt; code).  Doing this
	is clearly not the first (or next) step, but it may be a
	workable interim solution (a la compat layer?).
	&lt;/div&gt;
&lt;p&gt;
Each ZVOL's soft state (&lt;tt&gt;struct zvol_softc&lt;/tt&gt;, which is based on
Solaris's &lt;tt&gt;struct zvol_state&lt;/tt&gt;) is stored in an array,
&lt;tt&gt;zvol_softcs&lt;/tt&gt;, of pointers.  Individual softcs are accessed and
manipulated, by minor number, through &lt;tt&gt;zvol_softc_get(minor)&lt;/tt&gt;,
&lt;tt&gt;zvol_softc_zalloc(minor)&lt;/tt&gt;, &lt;tt&gt;zvol_softc_free(minor)&lt;/tt&gt;.
This behaviour is largely based on that of &lt;tt&gt;cgd(4)&lt;/tt&gt;.
&lt;p&gt;
However, I have to say that I have not been able to fully make top and
bottom of how a disk driver like this should work.  Though, for
instance, &lt;tt&gt;cgd&lt;/tt&gt; and &lt;tt&gt;vnd&lt;/tt&gt; both provide virtual disk
drivers through pre-configured device nodes, they accomplish this
(seemingly) differently.  To wit, &lt;tt&gt;cgd&lt;/tt&gt; maintains an array of
softcs, as I currently do in zvol, and uses neither &lt;tt&gt;CFATTACH&lt;/tt&gt;
nor &lt;tt&gt;CFDRIVER_DECL&lt;/tt&gt; (as is the same for &lt;tt&gt;ccd&lt;/tt&gt;).  The
&lt;tt&gt;vnd&lt;/tt&gt; driver does, and it accesses each zvol with
&lt;tt&gt;driver_lookup()&lt;/tt&gt;.  Having to pick one approach, I'll go with c.?d(4)'s
(because I've already implemented that).  However, &lt;tt&gt;vnd&lt;/tt&gt; is the only one
loadable as an LKM.
&lt;p&gt;
A lot of other things have happened since I've last posted, which has
been a long time.  Rather than try to recap everything at once, I'd
prefer to focus on moving forward.</description>
  </item>
  <item>
    <title>Blog running again</title>
    <link>http://www.olix0r.net/bitbucket/index.cgi/2007/06/29#aydogan.net</link>
    <description>Thanks to &lt;a href=&quot;http://www.aydogan.net&quot;&gt;Zafer&lt;/a&gt;, I've been keeping
&lt;tt&gt;olix0r.net&lt;/tt&gt; despiste my incredible inability to reclaim (legitimate)
internet access at my new residence.  He's gone out of his way to give me CGI
functionality to run &lt;a href=&quot;http://www.blosxom.com&quot;&gt;Blosxom&lt;/a&gt;.
&lt;p&gt;
Aside from that, life has been exciting.  I took a &amp;quot;vacation&amp;quot; this
week to get some &lt;a href=&quot;/bitbucket/index.cgi/netbsd/zfs&quot;&gt;Real Work&lt;/a&gt; done,
but that is still an uphill battle.  (Updates in the near term).
&lt;p&gt;
Also, &lt;a href=&quot;http://www.hbo.com/johnfromcincinnati/&quot;&gt;John From Cincinatti&lt;/a&gt;
might be the best television show ever.</description>
  </item>
  <item>
    <title>Reactions to PJD's Usenix Article</title>
    <link>http://www.olix0r.net/bitbucket/index.cgi/2007/06/13#usenix_read</link>
    <description>I'm happy to say that I have read the &lt;a
href=&quot;/bitbucket/index.cgi/netbsd/zfs/2007/06/11/#usenix&quot;&gt;previously-mentioned&lt;/a&gt;
&lt;a href=&quot;http://www.usenix.org/publications/login/2007-06/pdfs/dawidek.pdf&quot;&gt;
&lt;i&gt;;login:&lt;/i&gt; article&lt;/a&gt;.
&lt;p&gt;
In summary, I think that Pawel and Marshall do a good job.  Their overview of
ZFS should be more than sufficient for anyone that reads &lt;i&gt;;login:&lt;/i&gt; but has
managed to keep bunkered under a rock for long enough not to have seen the
brochures.
&lt;p&gt;
On to the main course, though-- a summary of Pawel's work porting ZFS to
FreeBSD.  Reading it, I was surprised at how much I knew already.  That said, I
am surprised at how I did not put the clues together into a clearer plan for
this summer's project.  Specifically, I've known about (and read..  and
discussed) FreeBSD's OpenSolaris compat layer.  What I somehow did not
correlate, though, is that &lt;i&gt;most&lt;/i&gt; of the work I have slated for this summer
will be limited to this layer.  I anticipate that it will take me some time to
grok the individual interfaces properly, but &lt;i&gt;this&lt;/i&gt; is where my mentors are
really likely to lend a hand.
&lt;p&gt;
So today-- optimism.
&lt;p&gt;
I could try to blame other factors for clouding my mind, but I think ultimately
my project's &amp;quot;negative-slack&amp;quot; (a former professor's euphemism for
schedule-crunch) is due to a lack of intimacy with the code, an aversion to
premature assumptions, and, moreover, fear of failure.  Completing my initial
development plan, and getting some &lt;i&gt;code committed&lt;/i&gt; will, I'm sure, give me
some much-needed confidence and momentum.  It's always interesting to me, though
not surprising at all, how human factors manage to bleed into technical work.</description>
  </item>
  </channel>
</rss>