[openbeosstorage] Re: Kernel Interface Design

> The reason I combined the read/readdir functions is that the NewOS 
> kernel does it this way (see bootfs.c).  The only problem with not 
> managing our own file descriptors, is how do we know if its a file or 
> directory?  (mind you, thinking about it, since sizeof(int) == 
> sizeof(DIR*) - we could just check its size:
> if (fd <256) {
>     // File
> } else {
>    // Directory
> }
> 
> since addresses in the range 0-255 are part of the kernel.
> 
>         What do you think?

You know, that probably *would* work. That's a neat idea. I'm a 
little wary of including something like that in a high-use OS library 
though; it seems like too much of a hack. Plus, it looks like you 
can call rstat with a pathname to find out what the stream type is. 
It'd probably be safer to go with that.

-Tyler





Other related posts: