From 0e977c00c4d0ad4a2b8b34491eb1c63f37187a25 Mon Sep 17 00:00:00 2001 From: armink Date: Sat, 19 Jan 2019 18:09:18 +0800 Subject: Sync from master (0889bafda8e03c6809d43ec87ee28b940efb28aa). --- components/dfs/src/dfs.c | 6 +++--- components/dfs/src/dfs_file.c | 5 +++-- components/dfs/src/poll.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'components/dfs/src') diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 12ae8e9d95..066c800568 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -18,7 +18,7 @@ #include #endif -#ifdef RT_USING_DFS_DEVFS +#if defined(RT_USING_DFS_DEVFS) && defined(RT_USING_POSIX) #include #endif @@ -216,7 +216,7 @@ struct dfs_fd *fd_get(int fd) struct dfs_fd *d; struct dfs_fdtable *fdt; -#ifdef RT_USING_DFS_DEVFS +#if defined(RT_USING_DFS_DEVFS) && defined(RT_USING_POSIX) if ((0 <= fd) && (fd <= 2)) fd = libc_stdio_get_console(); #endif @@ -320,7 +320,7 @@ int fd_is_open(const char *pathname) fd = fdt->fds[index]; if (fd == NULL || fd->fops == NULL || fd->path == NULL) continue; - if (fd->fops == fs->ops->fops && strcmp(fd->path, mountpath) == 0) + if (fd->fs == fs && strcmp(fd->path, mountpath) == 0) { /* found file in file descriptor table */ rt_free(fullpath); diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index 646ae58e36..4505667738 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -66,7 +66,8 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags) } LOG_D("open in filesystem:%s", fs->ops->name); - fd->fops = fs->ops->fops; /* set file ops */ + fd->fs = fs; /* set file system */ + fd->fops = fs->ops->fops; /* set file ops */ /* initialize the fd item */ fd->type = FT_REGULAR; @@ -171,7 +172,7 @@ int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args) return fd->flags; /* return flags */ case F_SETFL: { - int flags = (int)args; + int flags = (int)(rt_base_t)args; int mask = O_NONBLOCK | O_APPEND; flags &= mask; diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c index 6655a8a667..6f83762082 100644 --- a/components/dfs/src/poll.c +++ b/components/dfs/src/poll.c @@ -40,7 +40,7 @@ static int __wqueue_pollwake(struct rt_wqueue_node *wait, void *key) { struct rt_poll_node *pn; - if (key && !((rt_uint32_t)key & wait->key)) + if (key && !((rt_ubase_t)key & wait->key)) return -1; pn = rt_container_of(wait, struct rt_poll_node, wqn); -- cgit v1.3.1