AP_Filesystem: expose APFS_FILE structure
allows scripting to set the fd for sendfile()
This commit is contained in:
parent
26d814880e
commit
c9c38300bd
@ -30,14 +30,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <AP_Math/AP_Math.h>
|
#include <AP_Math/AP_Math.h>
|
||||||
|
|
||||||
struct apfs_file {
|
|
||||||
int fd;
|
|
||||||
bool error;
|
|
||||||
bool eof;
|
|
||||||
int16_t unget;
|
|
||||||
char *tmpfile_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CHECK_STREAM(stream, ret) while (stream == NULL || stream->fd < 0) { errno = EBADF; return ret; }
|
#define CHECK_STREAM(stream, ret) while (stream == NULL || stream->fd < 0) { errno = EBADF; return ret; }
|
||||||
|
|
||||||
#define modecmp(str, pat) (strcmp(str, pat) == 0 ? 1: 0)
|
#define modecmp(str, pat) (strcmp(str, pat) == 0 ? 1: 0)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -29,7 +30,13 @@ extern "C" {
|
|||||||
these are here to allow lua to build on HAL_ChibiOS
|
these are here to allow lua to build on HAL_ChibiOS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct apfs_file APFS_FILE;
|
typedef struct apfs_file {
|
||||||
|
int fd;
|
||||||
|
bool error;
|
||||||
|
bool eof;
|
||||||
|
int16_t unget;
|
||||||
|
char *tmpfile_name;
|
||||||
|
} APFS_FILE;
|
||||||
|
|
||||||
APFS_FILE *apfs_fopen(const char *pathname, const char *mode);
|
APFS_FILE *apfs_fopen(const char *pathname, const char *mode);
|
||||||
int apfs_fprintf(APFS_FILE *stream, const char *format, ...);
|
int apfs_fprintf(APFS_FILE *stream, const char *format, ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user