| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /*****************************************************************************
- * Copyright (c) 2019, Nations Technologies Inc.
- *
- * All rights reserved.
- * ****************************************************************************
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the disclaimer below.
- *
- * Nations' name may not be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ****************************************************************************/
- /**
- * @file dfs_posix.h
- * @author Nations
- * @version v1.0.0
- *
- * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
- */
- #ifndef __DFS_POSIX_H__
- #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
- #endif
|