io functions: Foo_Fut vs. Foo vs. foo ? - General Discussion and Assistance - CHDK Forum

io functions: Foo_Fut vs. Foo vs. foo ?

  • 2 Replies
  • 3806 Views
*

Offline reyalp

  • ******
  • 14125
io functions: Foo_Fut vs. Foo vs. foo ?
« on: 14 / September / 2008, 19:57:44 »
Advertisements
There seem to be several different file/directory APIs , which CHDK doesn't use entirely consistently. I'd be interested to know what the reasoning is to use a particular one ? If there are situations where you shouldn't use the _Fut API, I'd particularly like to know about that.

My observation
*_Fut is the highest level, wraps calls to lower level functions with calls to Mounter... StartAccessFile_filesem, statcache etc. Generally seems to work. Most stdio file functions are #defined to use this in stdlib.h

capital letter Open etc are the functions called by fut. These mostly work, and are used in some cases by CHDK. open() in chdk actually calls Open. There is also *_FileStream called by the _Fut functions use that FILE*.

lower case (vxworks libc ?) often do not work.

In the current chdk
remove calls Remove rather than the equivalent Fut function, while rename (at least on a540) calls rename, which doesn't actually appear to work. mkdir calls a lower level function which works, but appears to return 0 on failure unlike most libc (not surprising since mkdir isn't even ANSI)

edit:
it appears that read and write (or Read and Write as they are known stubs_entry) should only be used with uncached memory.
« Last Edit: 25 / October / 2008, 04:22:30 by reyalp »
Don't forget what the H stands for.

Re: io functions: Foo_Fut vs. Foo vs. foo ?
« Reply #1 on: 15 / September / 2008, 04:55:57 »
rename (at least on a540) calls rename, which doesn't actually appear to work.

Is there a corresponding function in wrappers.c ?

I have added the function to my own code but it still does not do anything (with JPG files).

If it did, the image files would not be visible in playback anyway.

*

Offline reyalp

  • ******
  • 14125
Re: io functions: Foo_Fut vs. Foo vs. foo ?
« Reply #2 on: 15 / September / 2008, 05:44:39 »
rename (at least on a540) calls rename, which doesn't actually appear to work.

Is there a corresponding function in wrappers.c ?
Yes, _rename -> 0xffede570, otherwise it wouldn't compile. I probably should have been more specific. By "doesn't work" i mean you call the function, and file doesn't get renamed ;)
Quote
I have added the function to my own code but it still does not do anything (with JPG files).

If it did, the image files would not be visible in playback anyway.
RenameFile_Fut works fine for me. (edit: in the juciphox tree, this was defined in stdlib, but without the corresponding stuff in lowlevel, stubs and wrappers)

For gensig/finsig:
sig_ref_vxworks_1.txt
RenameFile_Fut 0xFFC559AC
sig_ref_vxworks_3.txt
RenameFile_Fut 0xFFE42084
sig_ref_dryos_1.txt
RenameFile_Fut 0xFFC14840
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal