From nobody@FreeBSD.org  Sun Aug  1 12:01:19 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92D65106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Aug 2010 12:01:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 807BD8FC2F
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Aug 2010 12:01:19 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o71C1JqP026008
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 1 Aug 2010 12:01:19 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o71C1JfK026007;
	Sun, 1 Aug 2010 12:01:19 GMT
	(envelope-from nobody)
Message-Id: <201008011201.o71C1JfK026007@www.freebsd.org>
Date: Sun, 1 Aug 2010 12:01:19 GMT
From: Robert Millan <rmh@gnu.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] [zfs] make OpenSolaris <sys/nvpair.h> installable
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         149173
>Category:       kern
>Synopsis:       [patch] [zfs] make OpenSolaris <sys/nvpair.h> installable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 01 12:10:03 UTC 2010
>Closed-Date:    
>Last-Modified:  Thu Sep  6 13:30:02 UTC 2012
>Originator:     Robert Millan
>Release:        
>Organization:
>Environment:
>Description:
This patch makes OpenSolaris <sys/nvpair.h> buildable outside the compatibility environment, so that it can be installed system-wide, along with <libnvpair.h>, making it easier for third party apps to link with libnvpair.

It's been forwarded to OpenSolaris BTS already:
- https://defect.opensolaris.org/bz/show_bug.cgi?id=16697#c0

See also the discussion on GRUB list [1] about this problem:
- http://osdir.com/ml/grub-devel-gnu/2010-07/msg00263.html

[1] I'm in the process of adding support to GRUB for booting from ZFS

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- sys/nvpair.h.old	2010-07-31 12:03:02.038737593 -0400
+++ sys/nvpair.h	2010-07-31 12:03:08.926873793 -0400
@@ -32,6 +32,18 @@
 #include <sys/time.h>
 #include <sys/errno.h>
 
+/* for non-OpenSolaris systems */
+#if !defined(_KERNEL) && !defined(_BOOT)
+#include <stdint.h>	/* uintxx_t */
+#include <stdarg.h>	/* va_list */
+typedef unsigned int			uint_t;
+typedef unsigned char			uchar_t;
+typedef enum { B_FALSE, B_TRUE }	boolean_t;
+typedef long long			hrtime_t;
+#else
+typedef __va_list va_list;
+#endif
+
 #if defined(_KERNEL) && !defined(_BOOT)
 #include <sys/kmem.h>
 #endif
@@ -133,7 +145,7 @@
 } nv_alloc_t;
 
 struct nv_alloc_ops {
-	int (*nv_ao_init)(nv_alloc_t *, __va_list);
+	int (*nv_ao_init)(nv_alloc_t *, va_list);
 	void (*nv_ao_fini)(nv_alloc_t *);
 	void *(*nv_ao_alloc)(nv_alloc_t *, size_t);
 	void (*nv_ao_free)(nv_alloc_t *, void *, size_t);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Aug 1 16:41:53 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=149173 

From: Martin Matuska <mm@FreeBSD.org>
To: bug-followup@FreeBSD.org, rmh@gnu.org
Cc:  
Subject: Re: kern/149173: [patch] [zfs] make OpenSolaris &lt;sys/nvpair.h&gt;
 installable
Date: Thu, 06 Sep 2012 15:27:34 +0200

 If this wasn't imported into OpenSolaris I suggest a illumos issue gets
 filled.
 https://www.illumos.org/issues
 
 -- 
 Martin Matuska
 FreeBSD committer
 http://blog.vx.sk
 
>Unformatted:
