Experimental virtual file support

QuRT does not have a filesystem, so creating a virtual filesystem
that could be implemented as an in-memory file or a remote file
over fastRPC.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-05-06 22:12:45 -07:00
parent 35e6822d95
commit 6db77dc8bb
11 changed files with 206 additions and 23 deletions
+7 -6
View File
@@ -40,6 +40,7 @@
*/
#include <px4_config.h>
#include <px4_posix.h>
#include <stdio.h>
#include <stdlib.h>
@@ -182,7 +183,7 @@ static int
do_save(const char *param_file_name)
{
/* create the file */
int fd = open(param_file_name, O_WRONLY | O_CREAT, 0x777);
int fd = px4_open(param_file_name, O_WRONLY | O_CREAT, 0x777);
if (fd < 0) {
warn("opening '%s' failed", param_file_name);
@@ -190,7 +191,7 @@ do_save(const char *param_file_name)
}
int result = param_export(fd, false);
close(fd);
px4_close(fd);
if (result < 0) {
(void)unlink(param_file_name);
@@ -204,7 +205,7 @@ do_save(const char *param_file_name)
static int
do_load(const char *param_file_name)
{
int fd = open(param_file_name, O_RDONLY);
int fd = px4_open(param_file_name, O_RDONLY);
if (fd < 0) {
warn("open '%s'", param_file_name);
@@ -212,7 +213,7 @@ do_load(const char *param_file_name)
}
int result = param_load(fd);
close(fd);
px4_close(fd);
if (result < 0) {
warnx("error importing from '%s'", param_file_name);
@@ -225,7 +226,7 @@ do_load(const char *param_file_name)
static int
do_import(const char *param_file_name)
{
int fd = open(param_file_name, O_RDONLY);
int fd = px4_open(param_file_name, O_RDONLY);
if (fd < 0) {
warn("open '%s'", param_file_name);
@@ -233,7 +234,7 @@ do_import(const char *param_file_name)
}
int result = param_import(fd);
close(fd);
px4_close(fd);
if (result < 0) {
warnx("error importing from '%s'", param_file_name);