Merge pull request #4991 from mysterywolf/libc_dirent.h
[rtlibc] remove libc_dirent.h
This commit is contained in:
commit
ee2881fe7e
|
@ -15,17 +15,20 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <time.h>
|
#include <sys/time.h>
|
||||||
#include <rtthread.h>
|
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DFS_FILESYSTEMS_MAX
|
#ifndef DFS_FILESYSTEMS_MAX
|
||||||
#define DFS_FILESYSTEMS_MAX 2
|
#define DFS_FILESYSTEMS_MAX 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DFS_FD_MAX
|
#ifndef DFS_FD_MAX
|
||||||
#define DFS_FD_MAX 4
|
#define DFS_FD_MAX 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DFS_PATH_MAX
|
#ifndef DFS_PATH_MAX
|
||||||
#define DFS_PATH_MAX 256
|
#define DFS_PATH_MAX DIRENT_NAME_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SECTOR_SIZE
|
#ifndef SECTOR_SIZE
|
||||||
|
@ -63,10 +66,6 @@
|
||||||
#define DFS_F_EOF 0x04000000
|
#define DFS_F_EOF 0x04000000
|
||||||
#define DFS_F_ERR 0x08000000
|
#define DFS_F_ERR 0x08000000
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct statfs
|
struct statfs
|
||||||
{
|
{
|
||||||
size_t f_bsize; /* block size */
|
size_t f_bsize; /* block size */
|
||||||
|
@ -74,14 +73,6 @@ struct statfs
|
||||||
size_t f_bfree; /* free 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
|
struct dfs_fdtable
|
||||||
{
|
{
|
||||||
uint32_t maxfd;
|
uint32_t maxfd;
|
||||||
|
|
|
@ -21,14 +21,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int fd; /* directory file */
|
|
||||||
char buf[512];
|
|
||||||
int num;
|
|
||||||
int cur;
|
|
||||||
} DIR;
|
|
||||||
|
|
||||||
/* directory api*/
|
/* directory api*/
|
||||||
int mkdir(const char *path, mode_t mode);
|
int mkdir(const char *path, mode_t mode);
|
||||||
DIR *opendir(const char *name);
|
DIR *opendir(const char *name);
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
*/
|
*/
|
||||||
#ifndef __RTT_DIRENT_H__
|
#ifndef __DIRENT_H__
|
||||||
#define __RTT_DIRENT_H__
|
#define __DIRENT_H__
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtdef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dirent.h - format of directory entries
|
* dirent.h - format of directory entries
|
||||||
|
@ -26,11 +30,8 @@
|
||||||
#define DT_REG 0x01
|
#define DT_REG 0x01
|
||||||
#define DT_DIR 0x02
|
#define DT_DIR 0x02
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_DIR_STRUCTURE
|
#ifndef HAVE_DIR_STRUCTURE
|
||||||
|
#define HAVE_DIR_STRUCTURE
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int fd; /* directory file */
|
int fd; /* directory file */
|
||||||
|
@ -41,12 +42,16 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_DIRENT_STRUCTURE
|
#ifndef HAVE_DIRENT_STRUCTURE
|
||||||
|
#define HAVE_DIRENT_STRUCTURE
|
||||||
|
|
||||||
|
#define DIRENT_NAME_MAX 256
|
||||||
|
|
||||||
struct dirent
|
struct dirent
|
||||||
{
|
{
|
||||||
rt_uint8_t d_type; /* The type of the file */
|
rt_uint8_t d_type; /* The type of the file */
|
||||||
rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
|
rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
|
||||||
rt_uint16_t d_reclen; /* length of this record */
|
rt_uint16_t d_reclen; /* length of this record */
|
||||||
char d_name[256]; /* The null-terminated file name */
|
char d_name[DIRENT_NAME_MAX]; /* The null-terminated file name */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Change Logs:
|
|
||||||
* Date Author Notes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIBC_DIRENT_H__
|
|
||||||
#define LIBC_DIRENT_H__
|
|
||||||
|
|
||||||
#define DT_UNKNOWN 0x00
|
|
||||||
#define DT_REG 0x01
|
|
||||||
#define DT_DIR 0x02
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -14,7 +14,6 @@
|
||||||
/* definitions for libc if toolchain has no these definitions */
|
/* definitions for libc if toolchain has no these definitions */
|
||||||
#include "libc/libc_stat.h"
|
#include "libc/libc_stat.h"
|
||||||
#include "libc/libc_fcntl.h"
|
#include "libc/libc_fcntl.h"
|
||||||
#include "libc/libc_dirent.h"
|
|
||||||
|
|
||||||
#ifndef RT_USING_LIBC
|
#ifndef RT_USING_LIBC
|
||||||
#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__)
|
#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
|
Loading…
Reference in New Issue