| Summary: | Broken struct ufs_args in ufsmount.h | ||
|---|---|---|---|
| Product: | Base System | Reporter: | alex <alex> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 5.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
<<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 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 <<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 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. |
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' 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. How-To-Repeat: see above