summaryrefslogtreecommitdiff
path: root/components/dfs/include
diff options
context:
space:
mode:
authorliukangcc <[email protected]>2021-09-17 15:03:14 +0800
committerliukangcc <[email protected]>2021-09-17 15:03:14 +0800
commit4b3df6010f7870aebcd1df20bbaabd5fe9212c6d (patch)
tree95b0e12447425f803be46d16eaf6e7188c364fec /components/dfs/include
parentf07507a91310bc5696a08f5bbf6ab8679cfbcf73 (diff)
parentef71de34f76d4403fcd2cddd21a17f3a53a40296 (diff)
Merge remote-tracking branch 'remotes/rtt_github/master'
Diffstat (limited to 'components/dfs/include')
-rw-r--r--components/dfs/include/dfs.h10
-rw-r--r--components/dfs/include/dfs_poll.h33
-rw-r--r--components/dfs/include/dfs_posix.h55
-rw-r--r--components/dfs/include/dfs_select.h11
4 files changed, 8 insertions, 101 deletions
diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h
index 0fd8c2dccc..38f19aa7e7 100644
--- a/components/dfs/include/dfs.h
+++ b/components/dfs/include/dfs.h
@@ -16,6 +16,9 @@
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
#include <sys/time.h>
#include <rtdevice.h>
@@ -66,13 +69,6 @@ extern "C" {
#define DFS_F_EOF 0x04000000
#define DFS_F_ERR 0x08000000
-struct statfs
-{
- size_t f_bsize; /* block size */
- size_t f_blocks; /* total data blocks in file system */
- size_t f_bfree; /* free blocks in file system */
-};
-
struct dfs_fdtable
{
uint32_t maxfd;
diff --git a/components/dfs/include/dfs_poll.h b/components/dfs/include/dfs_poll.h
index 096a5fe712..11d17cc1ff 100644
--- a/components/dfs/include/dfs_poll.h
+++ b/components/dfs/include/dfs_poll.h
@@ -10,37 +10,6 @@
#ifndef DFS_POLL_H__
#define DFS_POLL_H__
-#include <rtthread.h>
-
-#ifdef RT_USING_POSIX
-#include <sys/time.h> /* for struct timeval */
-
-#if !defined(POLLIN) && !defined(POLLOUT)
-#define POLLIN (0x01)
-#define POLLRDNORM (0x01)
-#define POLLRDBAND (0x01)
-#define POLLPRI (0x01)
-
-#define POLLOUT (0x02)
-#define POLLWRNORM (0x02)
-#define POLLWRBAND (0x02)
-
-#define POLLERR (0x04)
-#define POLLHUP (0x08)
-#define POLLNVAL (0x10)
-
-typedef unsigned int nfds_t;
-
-struct pollfd
-{
- int fd;
- short events;
- short revents;
-};
-#endif /* !defined(POLLIN) && !defined(POLLOUT) */
-
-#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
-int poll(struct pollfd *fds, nfds_t nfds, int timeout);
-#endif /* RT_USING_POSIX */
+#include <poll.h>
#endif /* DFS_POLL_H__ */
diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h
index ec7cdc9de4..ee62cdde82 100644
--- a/components/dfs/include/dfs_posix.h
+++ b/components/dfs/include/dfs_posix.h
@@ -16,56 +16,9 @@
#define __DFS_POSIX_H__
#include <dfs_file.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* directory api*/
-int mkdir(const char *path, mode_t mode);
-DIR *opendir(const char *name);
-struct dirent *readdir(DIR *d);
-long telldir(DIR *d);
-void seekdir(DIR *d, off_t offset);
-void rewinddir(DIR *d);
-int closedir(DIR *d);
-
-/* file api*/
-int open(const char *file, int flags, ...);
-int close(int d);
-
-#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
-_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte));
-_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte));
-#else
-int read(int fd, void *buf, size_t len);
-int write(int fd, const void *buf, size_t len);
-#endif
-
-off_t lseek(int fd, off_t offset, int whence);
-int rename(const char *from, const char *to);
-int unlink(const char *pathname);
-int stat(const char *file, struct stat *buf);
-int fstat(int fildes, struct stat *buf);
-int fsync(int fildes);
-int fcntl(int fildes, int cmd, ...);
-int ioctl(int fildes, int cmd, ...);
-int ftruncate(int fd, off_t length);
-
-/* directory api*/
-int rmdir(const char *path);
-int chdir(const char *path);
-char *getcwd(char *buf, size_t size);
-
-/* file system api */
-int statfs(const char *path, struct statfs *buf);
-
-int access(const char *path, int amode);
-int pipe(int fildes[2]);
-int mkfifo(const char *path, mode_t mode);
-
-#ifdef __cplusplus
-}
-#endif
+#include <unistd.h>
+#include <stdio.h> /* rename() */
+#include <sys/stat.h>
+#include <sys/statfs.h> /* statfs() */
#endif
diff --git a/components/dfs/include/dfs_select.h b/components/dfs/include/dfs_select.h
index e0572c5059..17291a60dc 100644
--- a/components/dfs/include/dfs_select.h
+++ b/components/dfs/include/dfs_select.h
@@ -12,15 +12,4 @@
#include <sys/select.h>
-#ifdef __cplusplus
-extern "C" {
#endif
-
-int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-