WE310F5  39.00.000
m2mb_fs_posix.h
Go to the documentation of this file.
1  /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
25 #ifndef M2MB_FS_POSIX_H
26 #define M2MB_FS_POSIX_H
27 
44 /*-----------------------------------------------------------------------------------------------*/
45 
50 /*-----------------------------------------------------------------------------------------------*/
51 
52 /* Global declarations ==========================================================================*/
53 /* Files open modes */
54 #define M2MB_O_RDONLY 00
55 #define M2MB_O_WRONLY 01
56 #define M2MB_O_RDWR 02
57 #define M2MB_O_CREAT 0100
58 #define M2MB_O_EXCL 0200
59 #define M2MB_O_TRUNC 01000
60 #define M2MB_O_APPEND 02000
62 /* File seek flags */
63 #define M2MB_SEEK_SET 0
64 #define M2MB_SEEK_CUR 1
65 #define M2MB_SEEK_END 2
67 /* File function return code (FRESULT) */
68 typedef enum {
69  M2MB_FR_ERROR = -1, /* (0) failed */
70  M2MB_FR_OK = 0, /* (0) Succeeded */
71  M2MB_FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
72  M2MB_FR_INT_ERR, /* (2) Assertion failed */
73  M2MB_FR_NOT_READY, /* (3) The physical drive cannot work */
74  M2MB_FR_NO_FILE, /* (4) Could not find the file */
75  M2MB_FR_NO_PATH, /* (5) Could not find the path */
76  M2MB_FR_INVALID_NAME, /* (6) The path name format is invalid */
77  M2MB_FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
78  M2MB_FR_EXIST, /* (8) Access denied due to prohibited access */
79  M2MB_FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
80  M2MB_FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
81  M2MB_FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
82  M2MB_FR_NOT_ENABLED, /* (12) The volume has no work area */
83  M2MB_FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
84  M2MB_FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */
85  M2MB_FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
86  M2MB_FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
87  M2MB_FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
88  M2MB_FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */
89  M2MB_FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
90 } M2MB_FR_E;
91 
92 
93 /* Global typedefs ==============================================================================*/
94 typedef struct M2MB_STAT
95 {
101 }M2MB_STAT_T;
102 
103 typedef struct M2MB_LS_ENTRY
104 {
105  char file_path[100];
106  struct M2MB_STAT sbuf;
108 
109 /* Global functions =============================================================================*/
110 /*-----------------------------------------------------------------------------------------------*/
140 /*-----------------------------------------------------------------------------------------------*/
141 
143 
144 /*-----------------------------------------------------------------------------------------------*/
197 /*-----------------------------------------------------------------------------------------------*/
198 INT32 m2mb_fs_open( const CHAR *path, INT32 oflag, ... );
199 
200 /*-----------------------------------------------------------------------------------------------*/
263 /*-----------------------------------------------------------------------------------------------*/
264 
265 INT32 m2mb_fs_secure_open( const CHAR *path, INT32 oflag, const char* pwd );
266 
267 /*-----------------------------------------------------------------------------------------------*/
335 /*-----------------------------------------------------------------------------------------------*/
336 SSIZE_T m2mb_fs_read( INT32 fd, void *buf, UINT32 nbyte );
337 
338 /*-----------------------------------------------------------------------------------------------*/
401 /*-----------------------------------------------------------------------------------------------*/
402 SSIZE_T m2mb_fs_write( INT32 fd, const void *buf, UINT32 nbyte );
403 
404 /*-----------------------------------------------------------------------------------------------*/
468 /*-----------------------------------------------------------------------------------------------*/
470 
471 /*-----------------------------------------------------------------------------------------------*/
538 /*-----------------------------------------------------------------------------------------------*/
540 
541 /*-----------------------------------------------------------------------------------------------*/
614 /*-----------------------------------------------------------------------------------------------*/
615 OFF_T m2mb_fs_lseek( INT32 fd, OFF_T offset, INT32 whence );
616 
617 /*-----------------------------------------------------------------------------------------------*/
664 /*-----------------------------------------------------------------------------------------------*/
665 INT32 m2mb_fs_stat( const CHAR *path, struct M2MB_STAT *buf );
666 
667 /*-----------------------------------------------------------------------------------------------*/
734 /*-----------------------------------------------------------------------------------------------*/
735 INT32 m2mb_fs_unlink( const CHAR *path );
736 /*-----------------------------------------------------------------------------------------------*/
796 /*-----------------------------------------------------------------------------------------------*/
797 INT32 m2mb_fs_ls_open( const char *path, HANDLE *handle );
798 /*-----------------------------------------------------------------------------------------------*/
885 /*-----------------------------------------------------------------------------------------------*/
886 
887 INT32 m2mb_fs_ls_next( HANDLE ls_hdl, struct M2MB_LS_ENTRY *ls_entry );
888 /*-----------------------------------------------------------------------------------------------*/
944 /*-----------------------------------------------------------------------------------------------*/
945 
946 INT32 m2mb_fs_ls_close( HANDLE ls_hdl );
947 
951 /*-----------------------------------------------------------------------------------------------*/
952 
953 #endif /* M2M_M2MB_FS_POSIX_H */
954 
struct M2MB_STAT M2MB_STAT_T
M2MB_STATUS_T m2mb_fs_init(VOID)
File system initialization.
UINT32 st_blksize
Definition: m2mb_fs_posix.h:99
INT32 SSIZE_T
Definition: m2mb_types.h:107
INODE_T st_ino
Definition: m2mb_fs_posix.h:97
DEV_T st_dev
Definition: m2mb_fs_posix.h:96
UINT32 st_blocks
char file_path[100]
INT32 M2MB_STATUS_T
Definition: m2mb_status.h:97
SSIZE_T m2mb_fs_read(INT32 fd, void *buf, UINT32 nbyte)
Read file.
INT32 m2mb_fs_close(INT32 fd)
Close file.
SSIZE_T m2mb_fs_length(INT32 fd)
Write file.
INT32 m2mb_fs_stat(const CHAR *path, struct M2MB_STAT *buf)
File status.
OFF_T m2mb_fs_lseek(INT32 fd, OFF_T offset, INT32 whence)
Move file offset.
UINT32 INODE_T
Definition: m2mb_types.h:112
char CHAR
Definition: m2mb_types.h:76
M2MB_FR_E
Definition: m2mb_fs_posix.h:68
INT32 m2mb_fs_ls_close(HANDLE ls_hdl)
File system ls close.
void VOID
Definition: m2mb_types.h:74
INT32 m2mb_fs_open(const CHAR *path, INT32 oflag,...)
Open file.
INT32 m2mb_fs_secure_open(const CHAR *path, INT32 oflag, const char *pwd)
Open secure file.
struct M2MB_LS_ENTRY M2MB_LS_ENTRY_T
INT32 m2mb_fs_ls_next(HANDLE ls_hdl, struct M2MB_LS_ENTRY *ls_entry)
Returns the next file system entry while listing. Depending on the read/write speeds of the underlyin...
INT32 OFF_T
Definition: m2mb_types.h:110
INT32 m2mb_fs_ls_open(const char *path, HANDLE *handle)
The function opens the folder whose name is the string pointed to by path. Depending on the read/wri...
INT32 m2mb_fs_unlink(const CHAR *path)
Delete file.
UINT32 st_size
Definition: m2mb_fs_posix.h:98
SSIZE_T m2mb_fs_write(INT32 fd, const void *buf, UINT32 nbyte)
Write file.
unsigned long int UINT32
Definition: m2mb_types.h:88
UINT16 DEV_T
Definition: m2mb_types.h:108
signed int INT32
Definition: m2mb_types.h:82
void * HANDLE
Definition: m2mb_types.h:98
struct M2MB_STAT sbuf