[Disksim-users] accessing logorg struct

Shahrukh Rohinton Tarapore shahrukh at cs.virginia.edu
Tue Jun 13 16:42:14 EDT 2006


Sorry to ask such an implementation type question but I've been plagued 
by this for almost 2 days.  I am writing a program which controls the 
disksim simulator (i.e. treats it as a slave).  Thus I need certain 
information regarding the state of the simulation.  Specifically I need 
to if the storage system is addressed by Array or by Parts.  It seems 
there is no way to access the logical organization structure (struct 
logorg which contains a member called addrbyparts) from outside the 
disksim code base.  I've delved deeply into the disksim code and I'm not 
even sure how its done in the base code.

I've narrowed my problem to the fact that the disksim_t struct uses 
forward declarations to make the compiler happy when defining pointers 
to other structs like iodriver_info.  The errors I get imply that the 
unit I am compiling cannot see all of the structure definitions it 
needs.  I think the forward declarations allow this to occur.

Hopefully this makes some sense; in my own code I try to access the 
addrbyparts variable like this:
    disksim->iodriver_info->sysorgs->addrbyparts
where disksim, iodriver_info, and sysorgs are structure pointers and 
which are members in the subsequent structure.  Disksim has macros 
defined similiar to this in disksim_iodriver.c, so its odd that it 
wouldn't work.

 I tried a little test:
    int x = disksim->intqlen;  // this compiles fine which means the 
disksim struct definition can be seen

Then I tried:
    int x = disksim->iodriver_info->numiodrivers  // this gives me the 
same error I initially incountered regarding the compliation unit not 
seeing the definition of struct iodriver_info.

Any help resolving this issue would be appreciated.  I hope changing the 
core disksim code is not necessary as I would like my own code to be 
able to work as an extension to disksim rather than as patch work to 
arbitrary code segments.  Thanks.


-- shahrukh



More information about the Disksim-users mailing list