From alex@fump.kawo2.rwth-aachen.de  Wed Sep 25 13:58:34 2002
Return-Path: <alex@fump.kawo2.rwth-aachen.de>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DD44D37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Sep 2002 13:58:34 -0700 (PDT)
Received: from fump.kawo2.rwth-aachen.de (fump.kawo2.RWTH-Aachen.DE [134.130.181.148])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 14A0E43E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Sep 2002 13:58:34 -0700 (PDT)
	(envelope-from alex@fump.kawo2.rwth-aachen.de)
Received: from fump.kawo2.rwth-aachen.de (localhost [127.0.0.1])
	by fump.kawo2.rwth-aachen.de (8.12.5/8.12.5) with ESMTP id g8PKxku6042715
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Sep 2002 22:59:46 +0200 (CEST)
	(envelope-from alex@fump.kawo2.rwth-aachen.de)
Received: (from alex@localhost)
	by fump.kawo2.rwth-aachen.de (8.12.5/8.12.5/Submit) id g8PKxjMs042714;
	Wed, 25 Sep 2002 22:59:45 +0200 (CEST)
Message-Id: <200209252059.g8PKxjMs042714@fump.kawo2.rwth-aachen.de>
Date: Wed, 25 Sep 2002 22:59:45 +0200 (CEST)
From: Alexander Langer <alex@big.endian.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Broken struct ufs_args in ufsmount.h
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43372
>Category:       bin
>Synopsis:       Broken struct ufs_args in ufsmount.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 25 14:00:08 PDT 2002
>Closed-Date:    Sat Jun 03 05:01:29 GMT 2006
>Last-Modified:  Sat Jun 03 05:01:29 GMT 2006
>Originator:     Alexander Langer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
none
>Environment:

FreeBSD FreeBSD 5.0-CURRENT #11: Wed Sep 11 16:45:23 CEST 2002 i386

>Description:

ufsmount.h is broken for C++.  It uses a reserved keyword "export"
for a member of the struct ufs_args:
struct ufs_args {
        char    *fspec;                 /* block special device to mount */
        struct  export_args export;     /* network export information */
};

alex@zerogravity ~ $ cat ufsmount.cc 
extern "C" {
#include <sys/param.h>
#include <sys/mount.h>
#include <ufs/ufs/ufsmount.h>
}
alex@zerogravity ~ $ c++ --version
c++ (GCC) 3.2.1 [FreeBSD] 20020901 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

alex@zerogravity ~ $ cc -c ufsmount.cc 
In file included from ufsmount.cc:4:
/usr/include/ufs/ufs/ufsmount.h:45: syntax error before `export'

>How-To-Repeat:

see above

>Fix:

As a workaround, you can #define export _export before you include
ufsmount.h, and undefine it later.  This is an ugly hack, but working
for certain uses.

A real fix is to proberly name the member of the struct.
>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@lcs.mit.edu>
To: Alexander Langer <alex@big.endian.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: bin/43372: Broken struct ufs_args in ufsmount.h
Date: Wed, 25 Sep 2002 19:02:58 -0400 (EDT)

 <<On Wed, 25 Sep 2002 22:59:45 +0200 (CEST), Alexander Langer <alex@big.endian.de> said:
 
 > A real fix is to proberly name the member of the struct.
 
 A better fix is to only use C headers in C programs.
 
 -GAWollman
 

From: Alexander Langer <alex@big.endian.de>
To: Garrett Wollman <wollman@lcs.mit.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/43372: Broken struct ufs_args in ufsmount.h
Date: Thu, 26 Sep 2002 02:37:58 +0200

 Thus spake Garrett Wollman (wollman@lcs.mit.edu):
 
 > > A real fix is to proberly name the member of the struct.
 > A better fix is to only use C headers in C programs.
 
 That's not always possible, e.g. we are needing the mount stuff for
 libh, which is written in C++.
 
 Alex

From: Garrett Wollman <wollman@lcs.mit.edu>
To: Alexander Langer <alex@big.endian.de>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/43372: Broken struct ufs_args in ufsmount.h
Date: Wed, 25 Sep 2002 21:34:26 -0400 (EDT)

 <<On Thu, 26 Sep 2002 02:37:58 +0200, Alexander Langer <alex@big.endian.de> said:
 
 > That's not always possible, e.g. we are needing the mount stuff for
 > libh, which is written in C++.
 
 Certainly it is: you can link your C++ program with a module written
 in C that does what you want.
 
 Although this particular interface has very few clients, we shouldn't
 make a precedent that our C API has to change every time C++
 introduces a new incompatibility.
 
 -GAWollman
 
State-Changed-From-To: open->closed 
State-Changed-By: rodrigc 
State-Changed-When: Sat Jun 3 04:59:43 UTC 2006 
State-Changed-Why:  
In CURRENT and RELENG_6, the new nmount() API should 
be used for mounting UFS partitions.  It does not take 
a struct ufs_args as a parameter, so any problems with 
struct ufs_args will not be encountered, i.e. in C++ programs. 

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