[sheepdog] [PATCH v4 1/2] sheep: move journal_descriptor from journal.c to internal_proto.h

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Jul 8 10:02:16 CEST 2013


At Mon, 8 Jul 2013 15:40:27 +0800,
Kai Zhang wrote:
> 
> 
> On Jul 8, 2013, at 3:36 PM, MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> wrote:
> 
> > At Mon, 08 Jul 2013 15:37:37 +0900,
> > Hitoshi Mitake wrote:
> >> 
> >> At Mon, 8 Jul 2013 14:32:58 +0800,
> >> Liu Yuan wrote:
> >>> 
> >>> On Fri, Jul 05, 2013 at 12:06:47PM +0900, Hitoshi Mitake wrote:
> >>>> The definition of struct journal_descriptor has to be shared by
> >>>> DynamoRIO based fault injector because the test interprets internal
> >>>> data structs and injects faults at critical timings.
> >>> 
> >>> does this mean if we want to test other modules like object cache, we need to
> >>> move headers private to cache out too?
> >> 
> >> If a fault injector needs to interpret the data structures, yes.
> > 
> > On the second thought, exposing private structures looks a bad idea.
> > There is no clean approach for accessing the private stucture from the
> > test codes, and redefining the same structure in tests/dynamorio is
> > fine to me.
> > 
> 
> Can we just include 'journal.c' in the test file?

Including .c files would not be a better way. Because we have to
insert #ifndef like this:

#ifndef FAULT_INJECTOR
#include ...
#endif

definition of structs

#ifndef FAULT_INJECTOR
definition of variables and functions
#endif

This looks ugly and would be hard to maintain.

> I agree that we should not expose private structures.
> 

Yes, copying definitions of structs naively would be better. I'll send
v5 later.

Thanks,
Hitoshi



More information about the sheepdog mailing list