mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-27 05:50:35 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user