Embedded TCP/IP stack
4.7.0
|
The FNET File System (FS) API provides standard interface for file and directory manipulations.
The FNET File System API is inspired by standard ANSI C and POSIX-based APIs.
The following table summarizes the supported File System API functions:
Functions | Description |
---|---|
fnet_fs_init(), fnet_fs_release() | FNET file system interface initialization/release. |
fnet_fs_mount(), fnet_fs_unmount() | Mount/unmount a file system image. |
fnet_fs_fopen(), fnet_fs_fopen_re(), fnet_fs_fclose() | Open/close a file. |
fnet_fs_fread(), fnet_fs_fgetc() | Read a file. |
fnet_fs_rewind(), fnet_fs_fseek(), fnet_fs_feof(), fnet_fs_ftell() | Move/get a file pointer. |
fnet_fs_opendir(), fnet_fs_closedir() | Open/close a directory. |
fnet_fs_readdir(), fnet_fs_rewinddir() | Read a directory. |
The path name that points to a file or directory has the following format:
/[mount name][/directory name]..[/file name]
After the FS is initialized by calling the fnet_fs_init() function, a user application should call a FS registration function (for example the fnet_fs_rom_register() for the FNET ROM FS registration), and finally mount a FS image by the fnet_fs_mount() function. Thereafter an application has access to files and directories on the mounted FS image.
For example:
Configuration parameters:
Modules | |
ROM File System API | |
Data Structures | |
struct | fnet_fs_dirent_t |
This structure is used by the fnet_fs_finfo() and the fnet_fs_readdir() function to get information about directory entries (files or directories). More... | |
Macros | |
#define | FNET_FS_SPLITTER |
File-path splitter. This symbol is used to delimit directories and files in a pathname string. More... | |
#define | FNET_FS_EOF |
End-of-file condition. This is a condition, where no data can be read from a data source. More... | |
Typedefs | |
typedef void * | fnet_fs_dir_t |
Directory descriptor. This is the abstract key for accessing a directory. More... | |
typedef void * | fnet_fs_file_t |
File descriptor. This is the abstract key for accessing a file. More... | |
Enumerations | |
enum | fnet_fs_seek_origin_t { FNET_FS_SEEK_SET, FNET_FS_SEEK_CUR, FNET_FS_SEEK_END } |
Origin position. Used by fnet_fs_fseek() function. More... | |
enum | fnet_fs_d_type_t { DT_UNKNOWN, DT_REG, DT_DIR } |
Directory entry type. More... | |
Functions | |
fnet_return_t | fnet_fs_init (void) |
Initializes the FNET File System Interface. More... | |
void | fnet_fs_release (void) |
Releases the FNET File System Interface. More... | |
fnet_return_t | fnet_fs_mount (fnet_char_t *fs_name, const fnet_char_t *mount_name, const void *arg) |
Mounts a file system. More... | |
fnet_return_t | fnet_fs_unmount (const fnet_char_t *mount_name) |
Unmounts a file system. More... | |
fnet_fs_dir_t | fnet_fs_opendir (const fnet_char_t *dirname) |
Opens a directory descriptor. More... | |
fnet_return_t | fnet_fs_closedir (fnet_fs_dir_t dir) |
Closes a directory descriptor. More... | |
fnet_return_t | fnet_fs_readdir (fnet_fs_dir_t dir, fnet_fs_dirent_t *dirent) |
Reads a directory entry. More... | |
void | fnet_fs_rewinddir (fnet_fs_dir_t dir) |
Resets a directory position. More... | |
fnet_fs_file_t | fnet_fs_fopen (const fnet_char_t *filename, const fnet_char_t *mode) |
Opens a file descriptor. More... | |
fnet_fs_file_t | fnet_fs_fopen_re (const fnet_char_t *filename, const fnet_char_t *mode, fnet_fs_dir_t dir) |
Opens a file relatively in an opened directory. More... | |
fnet_return_t | fnet_fs_fclose (fnet_fs_file_t file) |
Closes a file descriptor. More... | |
fnet_size_t | fnet_fs_fread (void *buf, fnet_size_t size, fnet_fs_file_t file) |
Reads data from a file. More... | |
void | fnet_fs_rewind (fnet_fs_file_t file) |
Resets a file position. More... | |
fnet_bool_t | fnet_fs_feof (fnet_fs_file_t file) |
Checks the End-of-File indicator. More... | |
fnet_int32_t | fnet_fs_fgetc (fnet_fs_file_t file) |
Gets a character from a file. More... | |
fnet_return_t | fnet_fs_fseek (fnet_fs_file_t file, fnet_int32_t offset, fnet_fs_seek_origin_t origin) |
Changes the file-position indicator for the specified file. More... | |
fnet_int32_t | fnet_fs_ftell (fnet_fs_file_t file) |
Gets the current position in a file. More... | |
fnet_return_t | fnet_fs_finfo (fnet_fs_file_t file, fnet_fs_dirent_t *dirent) |
Gets a file information. More... | |