Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dfs]添加对>=5.0.2内核支持,修复编译报错 #20

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions dfs_lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Loading