Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fs_sys.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_FS_FS_SYS_H_
14#define ZEPHYR_INCLUDE_FS_FS_SYS_H_
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
24
41 int (*open)(struct fs_file_t *filp, const char *fs_path,
51 ssize_t (*read)(struct fs_file_t *filp, void *dest, size_t nbytes);
60 ssize_t (*write)(struct fs_file_t *filp,
61 const void *src, size_t nbytes);
70 int (*lseek)(struct fs_file_t *filp, off_t off, int whence);
77 off_t (*tell)(struct fs_file_t *filp);
85 int (*truncate)(struct fs_file_t *filp, off_t length);
92 int (*sync)(struct fs_file_t *filp);
99 int (*close)(struct fs_file_t *filp);
101
113 int (*opendir)(struct fs_dir_t *dirp, const char *fs_path);
121 int (*readdir)(struct fs_dir_t *dirp, struct fs_dirent *entry);
128 int (*closedir)(struct fs_dir_t *dirp);
130
141 int (*mount)(struct fs_mount_t *mountp);
148 int (*unmount)(struct fs_mount_t *mountp);
156 int (*unlink)(struct fs_mount_t *mountp, const char *name);
165 int (*rename)(struct fs_mount_t *mountp, const char *from,
166 const char *to);
174 int (*mkdir)(struct fs_mount_t *mountp, const char *name);
183 int (*stat)(struct fs_mount_t *mountp, const char *path,
184 struct fs_dirent *entry);
193 int (*statvfs)(struct fs_mount_t *mountp, const char *path,
194 struct fs_statvfs *stat);
195#if defined(CONFIG_FILE_SYSTEM_GC) || defined(__DOXYGEN__)
202 int (*gc)(struct fs_mount_t *mountp);
203#endif
204#if defined(CONFIG_FILE_SYSTEM_MKFS) || defined(__DOXYGEN__)
216 int (*mkfs)(uintptr_t dev_id, void *cfg, int flags);
217#endif
219};
220
224
225#ifdef __cplusplus
226}
227#endif
228
229#endif /* ZEPHYR_INCLUDE_FS_FS_SYS_H_ */
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa off
Definition asm-macro-32-bit-gnu.h:20
uint8_t fs_mode_t
Type for fs_open() flags.
Definition fs_interface.h:81
__SIZE_TYPE__ ssize_t
Definition types.h:28
__INTPTR_TYPE__ off_t
Definition types.h:36
flags
Definition parser.h:97
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
Directory object representing an open directory.
Definition fs_interface.h:109
Structure to receive file or directory information.
Definition fs.h:132
File System interface structure.
Definition fs_sys.h:28
int(* unmount)(struct fs_mount_t *mountp)
Unmounts a file system.
Definition fs_sys.h:148
int(* lseek)(struct fs_file_t *filp, off_t off, int whence)
Moves the file position to a new location in the file.
Definition fs_sys.h:70
int(* mount)(struct fs_mount_t *mountp)
Mounts a file system.
Definition fs_sys.h:141
ssize_t(* write)(struct fs_file_t *filp, const void *src, size_t nbytes)
Writes nbytes number of bytes.
Definition fs_sys.h:60
int(* mkfs)(uintptr_t dev_id, void *cfg, int flags)
Formats a device to specified file system type.
Definition fs_sys.h:216
int(* unlink)(struct fs_mount_t *mountp, const char *name)
Deletes the specified file or directory.
Definition fs_sys.h:156
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.
Definition fs_sys.h:193
off_t(* tell)(struct fs_file_t *filp)
Retrieves the current position in the file.
Definition fs_sys.h:77
int(* gc)(struct fs_mount_t *mountp)
Attempt to proactively clean file system.
Definition fs_sys.h:202
int(* opendir)(struct fs_dir_t *dirp, const char *fs_path)
Opens an existing directory specified by the path.
Definition fs_sys.h:113
int(* open)(struct fs_file_t *filp, const char *fs_path, fs_mode_t flags)
Opens or creates a file, depending on flags given.
Definition fs_sys.h:41
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.
Definition fs_sys.h:183
int(* truncate)(struct fs_file_t *filp, off_t length)
Truncates/expands the file to the new length.
Definition fs_sys.h:85
ssize_t(* read)(struct fs_file_t *filp, void *dest, size_t nbytes)
Reads nbytes number of bytes.
Definition fs_sys.h:51
int(* mkdir)(struct fs_mount_t *mountp, const char *name)
Creates a new directory using specified path.
Definition fs_sys.h:174
int(* readdir)(struct fs_dir_t *dirp, struct fs_dirent *entry)
Reads directory entries of an open directory.
Definition fs_sys.h:121
int(* closedir)(struct fs_dir_t *dirp)
Closes an open directory.
Definition fs_sys.h:128
int(* sync)(struct fs_file_t *filp)
Flushes the cache of an open file.
Definition fs_sys.h:92
int(* close)(struct fs_file_t *filp)
Flushes the associated stream and closes the file.
Definition fs_sys.h:99
int(* rename)(struct fs_mount_t *mountp, const char *from, const char *to)
Renames a file or directory.
Definition fs_sys.h:165
File object representing an open file.
Definition fs_interface.h:95
File system mount info structure.
Definition fs.h:106
Structure to receive volume statistics.
Definition fs.h:149