ARMmbed

Replacing 'filesystem' function (MBEDTLS_FS_IO)

Hello,
I’m porting mbed_tls to my platform, and would appreciate advice regarding functions that access a filesystem. I cannot enable the option MBEDTLS_FS_IO as my system does not have <stdio.h> functions ( fopen(), fgets(), etc. ). However my system does have its own implementations of file system (e.g alt_open(), alt_gets(), etc. ) with different signatures than <stdio.h> 's fopen(), fgets().
Can you advise me on how to plug those filesystem functions of mine into mbedTLS? For example, I plan to disable MBEDTLS_FS_IO (because it was trying to use fopen(), etc. that I do not have), then add my own implementations ( alt_open() ), in a new file (e.g. my_fs_io.c ). Then, in the documentation, I will mention that if the user need to access the filesystem, they can use my functions ? Does that make sense?
Thank you,

HI @KayT Thank you for your question!
Yes, it is ok to disable MBEDTLS_FS_IO. As mentioned in this article:

Every function that accesses the file-system is only a convenience wrapper around a function that does the same job with memory buffers, so there is nothing to replace here - just use the functions that work on buffers.

So, as you mentioned, your users can simply call your fs functions, and then the memory buffer will be given as input parameter to the functions receiving the loaded files, as you planned.
Regards,
Mbed TLS Team member
Ron

Thank you for your input!