Bug 165559

Summary: [ufs] [patch] ufsmount.h uses the 'export' keyword as a structure member name
Product: Base System Reporter: Jim Carroll <jim>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 8.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jim Carroll 2012-02-29 17:50:11 UTC
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
~
~
Comment 1 Jim Carroll 2012-02-29 18:07:44 UTC
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

 
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2012-02-29 18:08:22 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 3 Konstantin Belousov freebsd_committer freebsd_triage 2012-02-29 20:36:32 UTC
Responsible Changed
From-To: freebsd-fs->kib

Grab. 

The supplied patch is obviously wrong, or rather incomplete. 
The in-kernel uses of the export member must be corrected.
Comment 4 Konstantin Belousov freebsd_committer freebsd_triage 2012-05-07 12:49:50 UTC
Responsible Changed
From-To: kib->freebsd-bugs

Release the PR.
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:33 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:39:08 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>