mirror of https://github.com/ARMmbed/mbed-os.git
Filesystem: Moved toolchain-specific types into retarget.h
parent
a5245e32fe
commit
ee3e920ed1
|
@ -17,33 +17,10 @@
|
||||||
#define MBED_DIRHANDLE_H
|
#define MBED_DIRHANDLE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "retarget.h"
|
||||||
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
|
|
||||||
# define NAME_MAX 255
|
|
||||||
typedef int mode_t;
|
|
||||||
|
|
||||||
#else
|
|
||||||
# include <sys/syslimits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "FileHandle.h"
|
#include "FileHandle.h"
|
||||||
|
|
||||||
struct dirent {
|
|
||||||
char d_name[NAME_MAX+1];
|
|
||||||
uint8_t d_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
DT_UNKNOWN, // The file type could not be determined.
|
|
||||||
DT_FIFO, // This is a named pipe (FIFO).
|
|
||||||
DT_CHR, // This is a character device.
|
|
||||||
DT_DIR, // This is a directory.
|
|
||||||
DT_BLK, // This is a block device.
|
|
||||||
DT_REG, // This is a regular file.
|
|
||||||
DT_LNK, // This is a symbolic link.
|
|
||||||
DT_SOCK, // This is a UNIX domain socket.
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
/** @{*/
|
/** @{*/
|
||||||
|
|
|
@ -19,14 +19,7 @@
|
||||||
typedef int FILEHANDLE;
|
typedef int FILEHANDLE;
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "retarget.h"
|
||||||
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
|
|
||||||
typedef int ssize_t;
|
|
||||||
typedef long off_t;
|
|
||||||
|
|
||||||
#else
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -38,18 +38,6 @@ enum fs_error {
|
||||||
FS_ERROR_PARAMETER = -5002, ///< invalid parameter
|
FS_ERROR_PARAMETER = -5002, ///< invalid parameter
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO move to retarget
|
|
||||||
enum fs_type {
|
|
||||||
DT_UNKNOWN, // The file type could not be determined.
|
|
||||||
DT_FIFO, // This is a named pipe (FIFO).
|
|
||||||
DT_CHR, // This is a character device.
|
|
||||||
DT_DIR, // This is a directory.
|
|
||||||
DT_BLK, // This is a block device.
|
|
||||||
DT_REG, // This is a regular file.
|
|
||||||
DT_LNK, // This is a symbolic link.
|
|
||||||
DT_SOCK, // This is a UNIX domain socket.
|
|
||||||
};
|
|
||||||
|
|
||||||
// Opaque pointer representing files and directories
|
// Opaque pointer representing files and directories
|
||||||
typedef void *fs_file_t;
|
typedef void *fs_file_t;
|
||||||
typedef void *fs_dir_t;
|
typedef void *fs_dir_t;
|
||||||
|
|
|
@ -19,6 +19,21 @@
|
||||||
#ifndef RETARGET_H
|
#ifndef RETARGET_H
|
||||||
#define RETARGET_H
|
#define RETARGET_H
|
||||||
|
|
||||||
|
/* We can get the following standard types from sys/types for gcc, but we
|
||||||
|
* need to define the types ourselves for the other compilers that normally
|
||||||
|
* target embedded systems */
|
||||||
|
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
|
||||||
|
typedef int ssize_t; ///< Signed size type, usually encodes negative errors
|
||||||
|
typedef long off_t; ///< Offset in a data stream
|
||||||
|
typedef int mode_t; ///< Mode for opening files
|
||||||
|
|
||||||
|
#define NAME_MAX 255 ///< Maximum size of a name in a file path
|
||||||
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/syslimits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
|
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
|
||||||
/* The intent of this section is to unify the errno error values to match
|
/* The intent of this section is to unify the errno error values to match
|
||||||
* the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is
|
* the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is
|
||||||
|
@ -108,4 +123,24 @@
|
||||||
|
|
||||||
#endif /* defined(__ARMCC_VERSION) || defined(__ICCARM__) */
|
#endif /* defined(__ARMCC_VERSION) || defined(__ICCARM__) */
|
||||||
|
|
||||||
|
|
||||||
|
/* The following are dirent.h definitions are declared here to garuntee
|
||||||
|
* consistency where structure may be different with different toolchains */
|
||||||
|
struct dirent {
|
||||||
|
char d_name[NAME_MAX+1];
|
||||||
|
uint8_t d_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DT_UNKNOWN, // The file type could not be determined.
|
||||||
|
DT_FIFO, // This is a named pipe (FIFO).
|
||||||
|
DT_CHR, // This is a character device.
|
||||||
|
DT_DIR, // This is a directory.
|
||||||
|
DT_BLK, // This is a block device.
|
||||||
|
DT_REG, // This is a regular file.
|
||||||
|
DT_LNK, // This is a symbolic link.
|
||||||
|
DT_SOCK, // This is a UNIX domain socket.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* RETARGET_H */
|
#endif /* RETARGET_H */
|
||||||
|
|
Loading…
Reference in New Issue