/* * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ #ifndef __SYS_DIRENT_H__ #define __SYS_DIRENT_H__ #ifdef __cplusplus extern "C" { #endif /* * dirent.h - format of directory entries */ /* File types */ #define FT_REGULAR 0 /* regular file */ #define FT_SOCKET 1 /* socket file */ #define FT_DIRECTORY 2 /* directory */ #define FT_USER 3 /* user defined */ #ifndef HAVE_DIR_STRUCTURE typedef struct { int dd_fd; int dd_loc; /* directory file */ char *dd_buf; //dd_buf[512]; int dd_len; int dd_size; int dd_seek; } DIR; #endif #ifndef HAVE_DIRENT_STRUCTURE struct dirent { unsigned char d_type; /* The type of the file */ unsigned char d_namlen; /* The length of the not including the terminating null file name */ unsigned short d_reclen; /* length of this record */ char d_name[256]; /* The null-terminated file name */ char d_ino; }; #endif int closedir(DIR *); DIR *opendir(const char *); struct dirent *readdir(DIR *); int readdir_r(DIR *, struct dirent *, struct dirent **); void rewinddir(DIR *); void seekdir(DIR *, long int); long telldir(DIR *); #define __dirfd(dirp) ((DIR *)dirp)->dd_fd #ifdef __cplusplus } #endif #endif