Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
File System interface structure. More...
#include <fs_sys.h>
Data Fields | |
File operations | |
int(* | open )(struct fs_file_t *filp, const char *fs_path, fs_mode_t flags) |
Opens or creates a file, depending on flags given. | |
ssize_t(* | read )(struct fs_file_t *filp, void *dest, size_t nbytes) |
Reads nbytes number of bytes. | |
ssize_t(* | write )(struct fs_file_t *filp, const void *src, size_t nbytes) |
Writes nbytes number of bytes. | |
int(* | lseek )(struct fs_file_t *filp, off_t off, int whence) |
Moves the file position to a new location in the file. | |
off_t(* | tell )(struct fs_file_t *filp) |
Retrieves the current position in the file. | |
int(* | truncate )(struct fs_file_t *filp, off_t length) |
Truncates/expands the file to the new length. | |
int(* | sync )(struct fs_file_t *filp) |
Flushes the cache of an open file. | |
int(* | close )(struct fs_file_t *filp) |
Flushes the associated stream and closes the file. | |
Directory operations | |
int(* | opendir )(struct fs_dir_t *dirp, const char *fs_path) |
Opens an existing directory specified by the path. | |
int(* | readdir )(struct fs_dir_t *dirp, struct fs_dirent *entry) |
Reads directory entries of an open directory. | |
int(* | closedir )(struct fs_dir_t *dirp) |
Closes an open directory. | |
File system level operations | |
int(* | mount )(struct fs_mount_t *mountp) |
Mounts a file system. | |
int(* | unmount )(struct fs_mount_t *mountp) |
Unmounts a file system. | |
int(* | unlink )(struct fs_mount_t *mountp, const char *name) |
Deletes the specified file or directory. | |
int(* | rename )(struct fs_mount_t *mountp, const char *from, const char *to) |
Renames a file or directory. | |
int(* | mkdir )(struct fs_mount_t *mountp, const char *name) |
Creates a new directory using specified path. | |
int(* | stat )(struct fs_mount_t *mountp, const char *path, struct fs_dirent *entry) |
Checks the status of a file or directory specified by the path. | |
int(* | statvfs )(struct fs_mount_t *mountp, const char *path, struct fs_statvfs *stat) |
Returns the total and available space on the file system volume. | |
int(* | mkfs )(uintptr_t dev_id, void *cfg, int flags) |
Formats a device to specified file system type. | |
File System interface structure.
int(* fs_file_system_t::close) (struct fs_file_t *filp) |
Flushes the associated stream and closes the file.
filp | File to close. |
int(* fs_file_system_t::closedir) (struct fs_dir_t *dirp) |
Closes an open directory.
dirp | Directory to close. |
Moves the file position to a new location in the file.
filp | File to move. |
off | Relative offset from the position specified by whence. |
whence | Position in the file. Possible values: SEEK_CUR, SEEK_SET, SEEK_END. |
int(* fs_file_system_t::mkdir) (struct fs_mount_t *mountp, const char *name) |
Creates a new directory using specified path.
mountp | Mount point. |
name | Path to the directory to create. |
Formats a device to specified file system type.
Available only if
CONFIG_FILE_SYSTEM_MKFS
is enabled.
dev_id | Device identifier. |
cfg | File system configuration. |
flags | Formatting flags. |
int(* fs_file_system_t::mount) (struct fs_mount_t *mountp) |
Mounts a file system.
mountp | Mount point. |
Opens or creates a file, depending on flags given.
filp | File to open/create. |
fs_path | Path to the file. |
flags | Flags for opening/creating the file. |
int(* fs_file_system_t::opendir) (struct fs_dir_t *dirp, const char *fs_path) |
Opens an existing directory specified by the path.
dirp | Directory to open. |
fs_path | Path to the directory. |
Reads nbytes number of bytes.
filp | File to read from. |
dest | Destination buffer. |
nbytes | Number of bytes to read. |
Reads directory entries of an open directory.
dirp | Directory to read from. |
entry | Next directory entry in the dirp directory. |
int(* fs_file_system_t::rename) (struct fs_mount_t *mountp, const char *from, const char *to) |
Renames a file or directory.
mountp | Mount point. |
from | Path to the file or directory to rename. |
to | New name of the file or directory. |
int(* fs_file_system_t::stat) (struct fs_mount_t *mountp, const char *path, struct fs_dirent *entry) |
Checks the status of a file or directory specified by the path.
mountp | Mount point. |
path | Path to the file or directory. |
entry | Directory entry. |
int(* fs_file_system_t::statvfs) (struct fs_mount_t *mountp, const char *path, struct fs_statvfs *stat) |
Returns the total and available space on the file system volume.
mountp | Mount point. |
path | Path to the file or directory. |
stat | File system statistics. |
int(* fs_file_system_t::sync) (struct fs_file_t *filp) |
Flushes the cache of an open file.
filp | File to flush. |
Retrieves the current position in the file.
filp | File to get the current position from. |
Truncates/expands the file to the new length.
filp | File to truncate/expand. |
length | New length of the file. |
int(* fs_file_system_t::unlink) (struct fs_mount_t *mountp, const char *name) |
Deletes the specified file or directory.
mountp | Mount point. |
name | Path to the file or directory to delete. |
int(* fs_file_system_t::unmount) (struct fs_mount_t *mountp) |
Unmounts a file system.
mountp | Mount point. |
Writes nbytes number of bytes.
filp | File to write to. |
src | Source buffer. |
nbytes | Number of bytes to write. |