Bug 165559 - [ufs] [patch] ufsmount.h uses the 'export' keyword as a structure member name
Summary: [ufs] [patch] ufsmount.h uses the 'export' keyword as a structure member name
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2012-02-29 17:50 UTC by Jim Carroll
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:

file.diff (366 bytes, patch)
2012-02-29 17:50 UTC, Jim Carroll
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 2012-02-29 20:36:32 UTC
Responsible Changed
From-To: freebsd-fs->kib


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 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