|
|
@@ -9,6 +9,14 @@
|
|
|
#include <stdio.h>
|
|
|
#include <string.h>
|
|
|
|
|
|
+#if defined(RT_VERSION_CHECK) && (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 2))
|
|
|
+#define DFS_LFS_RETURN_TYPE ssize_t
|
|
|
+#define DFS_LFS_MKFS(dev_id, fs_name) _dfs_lfs_mkfs(dev_id, fs_name)
|
|
|
+#else
|
|
|
+#define DFS_LFS_RETURN_TYPE int
|
|
|
+#define DFS_LFS_MKFS(dev_id, fs_name) _dfs_lfs_mkfs(dev_id)
|
|
|
+#endif
|
|
|
+
|
|
|
#ifndef RT_DEF_LFS_DRIVERS
|
|
|
#define RT_DEF_LFS_DRIVERS 1
|
|
|
#endif
|
|
|
@@ -362,7 +370,7 @@ static int _dfs_lfs_unmount(struct dfs_filesystem* dfs)
|
|
|
}
|
|
|
|
|
|
#ifndef LFS_READONLY
|
|
|
-static int _dfs_lfs_mkfs(rt_device_t dev_id)
|
|
|
+static int DFS_LFS_MKFS(rt_device_t dev_id, const char *fs_name)
|
|
|
{
|
|
|
int result;
|
|
|
int index;
|
|
|
@@ -713,7 +721,7 @@ static int _dfs_lfs_ioctl(struct dfs_file* file, int cmd, void* args)
|
|
|
return -ENOSYS;
|
|
|
}
|
|
|
|
|
|
-static int _dfs_lfs_read(struct dfs_file* file, void* buf, size_t len)
|
|
|
+static DFS_LFS_RETURN_TYPE _dfs_lfs_read(struct dfs_file* file, void* buf, size_t len)
|
|
|
{
|
|
|
lfs_ssize_t ssize;
|
|
|
dfs_lfs_fd_t* dfs_lfs_fd;
|
|
|
@@ -752,7 +760,7 @@ static int _dfs_lfs_read(struct dfs_file* file, void* buf, size_t len)
|
|
|
}
|
|
|
|
|
|
#ifndef LFS_READONLY
|
|
|
-static int _dfs_lfs_write(struct dfs_file* file, const void* buf, size_t len)
|
|
|
+static DFS_LFS_RETURN_TYPE _dfs_lfs_write(struct dfs_file* file, const void* buf, size_t len)
|
|
|
{
|
|
|
lfs_ssize_t ssize;
|
|
|
dfs_lfs_fd_t* dfs_lfs_fd;
|
|
|
@@ -812,7 +820,7 @@ static int _dfs_lfs_flush(struct dfs_file* file)
|
|
|
return _lfs_result_to_dfs(result);
|
|
|
}
|
|
|
|
|
|
-static int _dfs_lfs_lseek(struct dfs_file* file, rt_off_t offset)
|
|
|
+static DFS_LFS_RETURN_TYPE _dfs_lfs_lseek(struct dfs_file* file, rt_off_t offset)
|
|
|
{
|
|
|
dfs_lfs_fd_t* dfs_lfs_fd;
|
|
|
|