diff options
| author | liukangcc <[email protected]> | 2021-10-14 10:31:44 +0800 |
|---|---|---|
| committer | liukangcc <[email protected]> | 2021-10-14 10:32:22 +0800 |
| commit | 3ac36a31071f66a06217b4676fc7266ba66c906a (patch) | |
| tree | be32fc9b7abb102aa905fdba0165bf6adf4c065d /components/dfs/include | |
| parent | 0369db718cd3b1ff58ceb2fc44a48641a0fecc66 (diff) | |
| parent | 33263d7e4ec22b118d0407ec7488ccfa60a8a0a1 (diff) | |
[update] Fix compiler flags issue
Diffstat (limited to 'components/dfs/include')
| -rw-r--r-- | components/dfs/include/dfs.h | 37 | ||||
| -rw-r--r-- | components/dfs/include/dfs_poll.h | 33 | ||||
| -rw-r--r-- | components/dfs/include/dfs_posix.h | 63 | ||||
| -rw-r--r-- | components/dfs/include/dfs_select.h | 11 |
4 files changed, 17 insertions, 127 deletions
diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index 80dc433787..38f19aa7e7 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -15,17 +15,23 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> - -#include <time.h> -#include <rtthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/statfs.h> +#include <sys/time.h> #include <rtdevice.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifndef DFS_FILESYSTEMS_MAX -#define DFS_FILESYSTEMS_MAX 2 +#define DFS_FILESYSTEMS_MAX 4 #endif #ifndef DFS_FD_MAX -#define DFS_FD_MAX 4 +#define DFS_FD_MAX 16 #endif /* @@ -36,7 +42,7 @@ #endif #ifndef DFS_PATH_MAX -#define DFS_PATH_MAX 256 +#define DFS_PATH_MAX DIRENT_NAME_MAX #endif #ifndef SECTOR_SIZE @@ -63,25 +69,6 @@ #define DFS_F_EOF 0x04000000 #define DFS_F_ERR 0x08000000 -#ifdef __cplusplus -extern "C" { -#endif - -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 dirent -{ - uint8_t d_type; /* The type of the file */ - uint8_t d_namlen; /* The length of the not including the terminating null file name */ - uint16_t d_reclen; /* length of this record */ - char d_name[DFS_PATH_MAX]; /* The null-terminated file name */ -}; - 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 0475460d95..ee62cdde82 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -16,64 +16,9 @@ #define __DFS_POSIX_H__ #include <dfs_file.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - int fd; /* directory file */ - char buf[512]; - int num; - int cur; -} DIR; - -/* 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 - |
