mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
LFS nits
This commit is contained in:
1 parent
f62f3545b4
commit
81f6acbce7
19 files changed
+258
-128
No files matched your search
+28
-8
@@ -103,8 +103,9 @@ extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef MG_PATH_MAX
|
||||
#define MG_PATH_MAX 100
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -127,8 +128,9 @@ extern "C" {
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MG_PATH_MAX
|
||||
#define MG_PATH_MAX 100
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -158,10 +160,6 @@ extern "C" {
|
||||
#define MG_PATH_MAX 100
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MG_ENABLE_TCPIP
|
||||
#define MG_ENABLE_TCPIP 1 // Enable built-in TCP/IP stack
|
||||
@@ -1364,7 +1362,7 @@ struct timeval {
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#define MG_ENABLE_DIRLIST MG_ENABLE_LFS
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||
@@ -1416,7 +1414,7 @@ struct timeval {
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_POSIX_FS
|
||||
#define MG_ENABLE_POSIX_FS 0
|
||||
#define MG_ENABLE_POSIX_FS MG_ENABLE_LFS
|
||||
#endif
|
||||
|
||||
#ifndef MG_INVALID_SOCKET
|
||||
@@ -1929,6 +1927,7 @@ void mg_timer_poll(struct mg_timer **head, uint64_t new_ms);
|
||||
|
||||
|
||||
|
||||
|
||||
// Flags returned by mg_fs.st() and passed to mg_fs.open().
|
||||
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4, MG_FS_EXCL = 8 };
|
||||
|
||||
@@ -1966,6 +1965,7 @@ void mg_fs_close(struct mg_fd *fd);
|
||||
|
||||
// Sequential directory iterator. Call repeatedly with the same buf/len;
|
||||
// each call fills buf with the next entry name. Returns false when done.
|
||||
// Note: make sure buf[0] == 0 before the first call
|
||||
bool mg_fs_ls(struct mg_fs *fs, const char *path, char *buf, size_t len);
|
||||
|
||||
// Reads the entire file into a heap-allocated buffer. The returned mg_str is
|
||||
@@ -2005,6 +2005,26 @@ struct mg_str mg_unpacked(const char *path);
|
||||
extern const struct mg_mem_file mg_packed_files[];
|
||||
|
||||
|
||||
#if MG_ENABLE_LFS
|
||||
#include <fcntl.h>
|
||||
#include <littlefs/lfs.h>
|
||||
|
||||
#ifndef DT_DIR
|
||||
#define DT_DIR 4
|
||||
#endif
|
||||
#ifndef DT_REG
|
||||
#define DT_REG 8
|
||||
#endif
|
||||
|
||||
struct dirent {
|
||||
char d_name[LFS_NAME_MAX + 1];
|
||||
unsigned char d_type;
|
||||
};
|
||||
|
||||
typedef struct mg_lfs_fd DIR;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user