[openbeosstorage] Dir to FileDescriptor transition
- From: Tyler Dauwalder <tyler@xxxxxxxxxxxxx>
- To: OpenBeOSStorage@xxxxxxxxxxxxx
- Date: Sun, 14 Apr 2002 01:01:19 -0700
Well, I got all the kernel_interface functions that had StorageKit::Dir
parameters rewritten to use StorageKit::FileDescriptors. BNode had no troubles,
but I ran into a strange error with BEntry during traversal tests.
I was iterating through a directory and getting a pointer to a valid dirent
structure (i.e. proper name, pdev and pino values). Then, after turning those
values into a pathname, if I went back to the dirent pointer, the pdev and pino
values were both reset to 0. The values themselves (not any pointers) were
being passed to entry_ref_to_path(), so I appears it must've been happening
somewhere else in the system.
Up until that point I'd been free()ing and malloc()ing DIR structs as necessary
for the various StorageKit::*_dir() functions as Ingo had done in the sample
code he posted a few days back. Taking out all the calls to free() made the
weird errors disappear, but now we're leaking memory with a vengence. So next
I'm going to write up a quick and dirty DIR* cache and just hang on to the DIR
pointers returned by opendir() and fs_open_attr_dir() until we closedir() or
fs_close_attr_dir() them.
-Tyler
- Follow-Ups:
- [openbeosstorage] Re: Dir to FileDescriptor transition
- From: Tyler Dauwalder
Other related posts:
- » [openbeosstorage] Dir to FileDescriptor transition
- » [openbeosstorage] Re: Dir to FileDescriptor transition
- [openbeosstorage] Re: Dir to FileDescriptor transition
- From: Tyler Dauwalder