lib: posix: Add Posix Style File System API support
Add IEEE 1003.1 Posix Style file system API support. These API's will internally use corresponding Zephyr File System API's. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
parent
0b76b12837
commit
eb0aaca64d
9 changed files with 550 additions and 19 deletions
|
@ -75,6 +75,7 @@ void __stdin_hook_install(unsigned char (*hook)(void))
|
|||
_stdin_hook = hook;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_POSIX_FS
|
||||
int _read(int fd, char *buf, int nbytes)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -104,6 +105,28 @@ int _write(int fd, char *buf, int nbytes)
|
|||
}
|
||||
FUNC_ALIAS(_write, write, int);
|
||||
|
||||
int _open(const char *name, int mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FUNC_ALIAS(_open, open, int);
|
||||
|
||||
int _close(int file)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FUNC_ALIAS(_close, close, int);
|
||||
|
||||
int _lseek(int file, int ptr, int dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
FUNC_ALIAS(_lseek, lseek, int);
|
||||
#else
|
||||
extern ssize_t write(int file, char *buffer, unsigned int count);
|
||||
#define _write write
|
||||
#endif
|
||||
|
||||
int _isatty(int file)
|
||||
{
|
||||
return 1;
|
||||
|
@ -137,24 +160,6 @@ void _exit(int status)
|
|||
}
|
||||
}
|
||||
|
||||
int _open(const char *name, int mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FUNC_ALIAS(_open, open, int);
|
||||
|
||||
int _close(int file)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FUNC_ALIAS(_close, close, int);
|
||||
|
||||
int _lseek(int file, int ptr, int dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
FUNC_ALIAS(_lseek, lseek, int);
|
||||
|
||||
void *_sbrk(int count)
|
||||
{
|
||||
void *ptr = heap_base + heap_sz;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue