Coda File System

Re: RVM not compilable with iostream?

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Mon, 11 Nov 2002 12:45:14 -0500
On Sat, Nov 09, 2002 at 12:08:03PM -0500, Anthony Nicholson wrote:
> .. when I compile it together with the venus source, I get the following 
> compilation error:
> 
> --------------------------------
> /usr/include/g++-3/iostream.h:40: `ostream &flush (ostream &)' 
> redeclared as different kind of symbol
> /usr/local/include/rvm/rvm.h:84: previous declaration of `rvm_mode_t 
> flush'
> /usr/local/include/rvm/rvm.h:84: previous non-function declaration 
> `rvm_mode_t flush'

Don't know why an enum value would conflict with a function prototype
they are typically used in a different context anyways.

> As you can maybe tell from the above trace, I have created two new 
> classes: "prefetcher" and "algorithm". I made an instance of class 
> prefetcher a member of the fsdb class... which is why you see that 
> included in fso.h. class algorithm is similarly used by prefetcher. 

Be careful when using C++ objects that are stored in RVM, i.e. the fsdb
class is instantiated as a persistent object, so your prefetcher objects
will also be persistent. But the way C++/RVM works you cannot store
things with virtual functions or inherited functions as recoverable
objects in RVM.

> It is inside class algorithm that iostream.h is included. It appears that 
> the following declaration in iostream.h:
> 
> extern ostream& flush(ostream& outs);
> 
> is conflicting with this enum in rvm.h:
> 
> /*  Transaction mode codes: rvm_mode_t */
> typedef enum
>     {
>     rvm_first_mode = 139,               /* internal use only */
>     restore,                            /* restore memory on abort */
>     no_restore,                         /* do not restore memory on abort */
>     flush,                              /* flush records to logdev on commit */
>     no_flush,                           /* do not flush records on commit */
>     rvm_last_mode                       /* internal use only */
>     }
> rvm_mode_t;
> 
> specifically, the "flush" member.
> 
> Any suggestions? Or can I just not use the iostream package inside of 
> venus?

Venus uses stdio everywhere, I'm pretty sure iostream wasn't even
defined around the time that Coda forked off of AFS2. and I don't really
see that much added benefit in using iostream. The only difference
right now is that objects have a 'print(int fd)' method, instead of
operator<<(&iostream) and the code is a little bit more verbose,

 foo->print(stdout);
 bar->print(stdout);
 blah->print(stdout);

instead of,

 cout << foo << bar << blah;

Jan
Received on 2002-11-11 12:48:01