mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Rename FS API functions to avoid conflicts
This commit is contained in:
1 parent
49d5aff8f9
commit
8cd4699dbc
7 files changed
+77
-67
No files matched your search
+17
-12
@@ -165,6 +165,7 @@ static __inline struct tm *localtime_r(const time_t *t, struct tm *tm) {
|
||||
|
||||
#if MG_ARCH == MG_ARCH_FREERTOS_LWIP
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -642,19 +643,23 @@ void mg_timer_poll(int64_t current_time_ms);
|
||||
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
||||
|
||||
// Filesystem API functions
|
||||
// stat() returns MG_FS_* flags and populates file size and modification time
|
||||
// list() calls fn() for every directory entry, allowing to list a directory
|
||||
// st() returns MG_FS_* flags and populates file size and modification time
|
||||
// ls() calls fn() for every directory entry, allowing to list a directory
|
||||
//
|
||||
// NOTE: UNIX-style shorthand names for the API functions are deliberately
|
||||
// chosen to avoid conflicts with some libraries that make macros for e.g.
|
||||
// stat(), write(), read() calls.
|
||||
struct mg_fs {
|
||||
int (*stat)(const char *path, size_t *size, time_t *mtime);
|
||||
void (*list)(const char *path, void (*fn)(const char *, void *), void *);
|
||||
void *(*open)(const char *path, int flags); // Open file
|
||||
void (*close)(void *fd); // Close file
|
||||
size_t (*read)(void *fd, void *buf, size_t len); // Read file
|
||||
size_t (*write)(void *fd, const void *buf, size_t len); // Write file
|
||||
size_t (*seek)(void *fd, size_t offset); // Set file position
|
||||
bool (*rename)(const char *from, const char *to); // Rename
|
||||
bool (*remove)(const char *path); // Delete file
|
||||
bool (*mkd)(const char *path); // Create directory
|
||||
int (*st)(const char *path, size_t *size, time_t *mtime); // stat file
|
||||
void (*ls)(const char *path, void (*fn)(const char *, void *), void *);
|
||||
void *(*op)(const char *path, int flags); // Open file
|
||||
void (*cl)(void *fd); // Close file
|
||||
size_t (*rd)(void *fd, void *buf, size_t len); // Read file
|
||||
size_t (*wr)(void *fd, const void *buf, size_t len); // Write file
|
||||
size_t (*sk)(void *fd, size_t offset); // Set file position
|
||||
bool (*mv)(const char *from, const char *to); // Rename file
|
||||
bool (*rm)(const char *path); // Delete file
|
||||
bool (*mkd)(const char *path); // Create directory
|
||||
};
|
||||
|
||||
extern struct mg_fs mg_fs_posix; // POSIX open/close/read/write/seek
|
||||
|
||||
Reference in new issue
Block a user