mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-18 01:02:50 +08:00
Improve the Device File System of the POSIX compatibility
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1015 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static unsigned int seed=1;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
typedef rt_off_t off_t;
|
||||
typedef long off_t;
|
||||
typedef rt_size_t size_t;
|
||||
|
||||
typedef rt_uint8_t u_char;
|
||||
@@ -11,14 +11,8 @@ typedef rt_uint16_t u_short;
|
||||
typedef rt_ubase_t u_int;
|
||||
typedef rt_uint32_t u_long;
|
||||
|
||||
typedef rt_uint8_t u_int8_t;
|
||||
typedef rt_uint16_t u_int16_t;
|
||||
typedef rt_uint32_t u_int32_t;
|
||||
typedef rt_int8_t int8_t;
|
||||
typedef rt_int16_t int16_t;
|
||||
typedef rt_int32_t int32_t;
|
||||
|
||||
typedef rt_time_t time_t;
|
||||
typedef int mode_t;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL RT_NULL
|
||||
|
57
components/libc/newlib/sys/dirent.h
Normal file
57
components/libc/newlib/sys/dirent.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef __RTT_DIRENT_H__
|
||||
#define __RTT_DIRENT_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
/*
|
||||
* dirent.h - format of directory entries
|
||||
* Ref: http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html
|
||||
*/
|
||||
|
||||
/* 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 */
|
||||
|
||||
#define DT_UNKNOWN 0x00
|
||||
#define DT_REG 0x01
|
||||
#define DT_DIR 0x02
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DIR_STRUCTURE
|
||||
typedef struct
|
||||
{
|
||||
int fd; /* directory file */
|
||||
char buf[512];
|
||||
int num;
|
||||
int cur;
|
||||
} DIR;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DIRENT_STRUCTURE
|
||||
struct dirent
|
||||
{
|
||||
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_uint16_t d_reclen; /* length of this record */
|
||||
char d_name[256]; /* The null-terminated file name */
|
||||
};
|
||||
#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 *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
15
components/libc/newlib/sys/fcntl.h
Normal file
15
components/libc/newlib/sys/fcntl.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __RTT_FCNTL_H__
|
||||
#define __RTT_FCNTL_H__
|
||||
|
||||
/* Operation flags */
|
||||
#define O_RDONLY 0000000
|
||||
#define O_WRONLY 0000001
|
||||
#define O_RDWR 0000002
|
||||
#define O_ACCMODE 0000003
|
||||
#define O_CREAT 0000100
|
||||
#define O_EXCL 0000200
|
||||
#define O_TRUNC 0001000
|
||||
#define O_APPEND 0002000
|
||||
#define O_DIRECTORY 0200000
|
||||
|
||||
#endif
|
13
components/libc/newlib/sys/statfs.h
Normal file
13
components/libc/newlib/sys/statfs.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __RTT_STATFS_H__
|
||||
#define __RTT_STATFS_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
struct statfs
|
||||
{
|
||||
rt_size_t f_bsize; /* block size */
|
||||
rt_size_t f_blocks; /* total data blocks in file system */
|
||||
rt_size_t f_bfree; /* free blocks in file system */
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user