I don’t really understand how to reply correctly to an IO_STAT message.
i.e.
I write a ressource manager. Without doing anything special, when we do
a ls -l on a basic ressource manager, we get 0 as file size.
In my application, I want to have the real size of my ‘pseudo-file’.
First, I didn’t supply an io_stat function and I tried to set the
ocb->attr.nbytes field.
ls -l always gave 0
Strange if iofunc_stat_default() really use that structure to fill in
the io_stat returned structure ?!?
After, I tried to supply my own io-stat function begining with a very
simple code (your course code).
int io_stat(…)
{
msg->o.st_ino = 1;
msg->o.st_dev = 2;
msg->o.st_size = 10;
return(RESMGR_PTR(ctp, &msg->o, sizeof(msg->o));
}
Good for the size but, of course, not for the other information.
So, let’s go to use the helper function according to the help. In
parenthesis, there is an error in this code snipet, the resmgr_context_t
parameter is missing in the iofunc_stat() function.
io_stat(…)
{
iofunc_time_update(…);
iofunc_stat(…);
msg->o.st_size = 10;
return(_RESMGR_PTR(…));
}
Now, ok for all informations given by ls -l EXCEPT the size which is 0!!
gasp!
Maybe the difference is about st_ino and st_dev fields but I don’t
really know what to do with!
Could you tell me what it’s all about!
Alain.