From nobody@FreeBSD.org  Wed Feb 29 17:46:38 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 33B5B106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Feb 2012 17:46:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 22F6F8FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Feb 2012 17:46:38 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q1THkb9u044908
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Feb 2012 17:46:37 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q1THkbc6044907;
	Wed, 29 Feb 2012 17:46:37 GMT
	(envelope-from nobody)
Message-Id: <201202291746.q1THkbc6044907@red.freebsd.org>
Date: Wed, 29 Feb 2012 17:46:37 GMT
From: "Jim C." <jim@carroll.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ufsmount.h uses the 'export' keyword as a structure member name
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         165559
>Category:       kern
>Synopsis:       [ufs] [patch] ufsmount.h uses the 'export' keyword as a structure member name
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 29 17:50:11 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon May 07 11:50:10 UTC 2012
>Originator:     Jim C.
>Release:        8.2-RELEASE-p4
>Organization:
Carroll-Net, Inc.
>Environment:
FreeBSD bv601.hck.carroll.com 8.2-RELEASE-p4 FreeBSD 8.2-RELEASE-p4 #0: Fri Nov 18 15:50:11 EST 2011


>Description:
While compiling some GNU C++ code against the include file /usr/include/ufs/ufs/ufsmount.h, we discovered the ufs_args structure has a member variable named 'export'. G++ chokes with the following error:

/usr/include/ufs/ufs/ufsmount.h:43: error: expected unqualified-id before 'export'

The reason is that the term 'export' is a reserved, but presently unused keyword in the C++ language.

To solve our problem, we've copied the header locally to our project folder, and renamed the reference. But if possible, I was hoping this could be folded back into the main tree.

I recognize this could present a breaking change for any projects that link against libufs -- but sooner or later this change will need to be accepted or someone is going to have to convince the folks at GNU/C++ to add a compiler directive to ignore the 'export' keyword (fyi -- I checked, but so far this looks like a no go).

FYI -- the folks at the openssl project encountered had a similar problem and eventually they were forced to just rename the member variable.
>How-To-Repeat:
Create my.cpp, paste in

    #include <sys/param.h>
    #include <sys/mount.h>
    #include <ufs/ufs/ufsmount.h>
    #include <ufs/ufs/dinode.h>
    #include <ufs/ffs/fs.h>
    #include <libufs.h>

g++ -c my.cpp
~
~

>Fix:
--- ufsmount.h	2012-02-29 12:33:04.000000000 -0500
+++ /usr/include/ufs/ufs/ufsmount.h	2012-02-29 12:32:28.000000000 -0500
@@ -40,7 +40,7 @@
  */
 struct ufs_args {
 	char	*fspec;			/* block special device to mount */
-	struct	oexport_args export_;	/* network export information */
+	struct	oexport_args export;	/* network export information */
 };
 
 #ifdef _KERNEL


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Feb 29 18:08:22 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: "Jim Carroll" <jim@carroll.com>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/165559: ufsmount.h uses the &#39;export&#39; keyword as a structure member name
Date: Wed, 29 Feb 2012 13:07:44 -0500

 This is a multipart message in MIME format.
 
 ------=_NextPart_000_0010_01CCF6E3.2168D7F0
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 WHOOPS - inverted the filenames for our patch. Here is the correct patch
 
  
 
  
 
 --- /usr/include/ufs/ufs/ufsmount.h   2012-02-29 12:32:28.000000000 -0500
 
 +++ ufsmount.h 2012-02-29 13:07:08.000000000 -0500
 
 @@ -40,7 +40,7 @@
 
   */
 
 struct ufs_args {
 
     char *fspec;            /* block special device to mount */
 
 -    struct    oexport_args export;    /* network export information */
 
 +    struct    oexport_args export_;   /* network export information */
 
 };
 
  #ifdef _KERNEL
 
  
 
 
 ------=_NextPart_000_0010_01CCF6E3.2168D7F0
 Content-Type: text/html;
 	charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 
 <html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
 xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
 xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
 xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
 xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
 http-equiv=3DContent-Type content=3D"text/html; =
 charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
 (filtered medium)"><style><!--
 /* Font Definitions */
 @font-face
 	{font-family:Calibri;
 	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 	{margin:0in;
 	margin-bottom:.0001pt;
 	font-size:11.0pt;
 	font-family:"Calibri","sans-serif";}
 a:link, span.MsoHyperlink
 	{mso-style-priority:99;
 	color:blue;
 	text-decoration:underline;}
 a:visited, span.MsoHyperlinkFollowed
 	{mso-style-priority:99;
 	color:purple;
 	text-decoration:underline;}
 p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
 	{mso-style-priority:99;
 	mso-style-link:"Plain Text Char";
 	margin:0in;
 	margin-bottom:.0001pt;
 	font-size:12.0pt;
 	font-family:"Courier New";}
 span.EmailStyle17
 	{mso-style-type:personal-compose;
 	font-family:"Courier New";
 	color:windowtext;}
 span.PlainTextChar
 	{mso-style-name:"Plain Text Char";
 	mso-style-priority:99;
 	mso-style-link:"Plain Text";
 	font-family:"Courier New";}
 .MsoChpDefault
 	{mso-style-type:export-only;
 	font-family:"Calibri","sans-serif";}
 @page WordSection1
 	{size:8.5in 11.0in;
 	margin:1.0in 1.0in 1.0in 1.0in;}
 div.WordSection1
 	{page:WordSection1;}
 --></style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
 </xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
 <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
 vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span =
 style=3D'font-family:"Courier New"'>WHOOPS &#8211; inverted the =
 filenames for our patch. Here is the correct =
 patch<o:p></o:p></span></p><p class=3DMsoNormal><span =
 style=3D'font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p =
 class=3DMsoNormal><span style=3D'font-family:"Courier =
 New"'><o:p>&nbsp;</o:p></span></p><p class=3DMsoPlainText>--- =
 /usr/include/ufs/ufs/ufsmount.h&nbsp;&nbsp; 2012-02-29 =
 12:32:28.000000000 -0500<o:p></o:p></p><p class=3DMsoPlainText>+++ =
 ufsmount.h 2012-02-29 13:07:08.000000000 -0500<o:p></o:p></p><p =
 class=3DMsoPlainText>@@ -40,7 +40,7 @@<o:p></o:p></p><p =
 class=3DMsoPlainText>&nbsp; */<o:p></o:p></p><p class=3DMsoPlainText> =
 struct ufs_args {<o:p></o:p></p><p class=3DMsoPlainText> =
 &nbsp;&nbsp;&nbsp; char =
 *fspec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
  /* block special device to mount */<o:p></o:p></p><p =
 class=3DMsoPlainText>-&nbsp;&nbsp;&nbsp; struct&nbsp;&nbsp;&nbsp; =
 oexport_args export;&nbsp;&nbsp;&nbsp; /* network export information =
 */<o:p></o:p></p><p class=3DMsoPlainText>+&nbsp;&nbsp;&nbsp; =
 struct&nbsp;&nbsp;&nbsp; oexport_args export_;&nbsp;&nbsp; /* network =
 export information */<o:p></o:p></p><p class=3DMsoPlainText> =
 };<o:p></o:p></p><p class=3DMsoPlainText> <o:p></o:p></p><p =
 class=3DMsoPlainText>&nbsp;#ifdef _KERNEL<o:p></o:p></p><p =
 class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></body></html>
 ------=_NextPart_000_0010_01CCF6E3.2168D7F0--
 
Responsible-Changed-From-To: freebsd-fs->kib 
Responsible-Changed-By: kib 
Responsible-Changed-When: Wed Feb 29 20:36:32 UTC 2012 
Responsible-Changed-Why:  
Grab. 

The supplied patch is obviously wrong, or rather incomplete. 
The in-kernel uses of the export member must be corrected. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165559 
Responsible-Changed-From-To: kib->freebsd-bugs 
Responsible-Changed-By: kib 
Responsible-Changed-When: Mon May 7 11:49:50 UTC 2012 
Responsible-Changed-Why:  
Release the PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165559 
>Unformatted:
