8#ifndef ZEPHYR_INCLUDE_FS_FS_H_
9#define ZEPHYR_INCLUDE_FS_FS_H_
60#define FS_MOUNT_FLAG_NO_FORMAT BIT(0)
62#define FS_MOUNT_FLAG_READ_ONLY BIT(1)
68#define FS_MOUNT_FLAG_AUTOMOUNT BIT(2)
137#define FS_O_READ 0x01
139#define FS_O_WRITE 0x02
141#define FS_O_RDWR (FS_O_READ | FS_O_WRITE)
143#define FS_O_MODE_MASK 0x03
146#define FS_O_CREATE 0x10
148#define FS_O_APPEND 0x20
150#define FS_O_FLAGS_MASK 0x30
153#define FS_O_MASK (FS_O_MODE_MASK | FS_O_FLAGS_MASK)
186#define FSTAB_ENTRY_DT_MOUNT_FLAGS(node_id) \
187 ((DT_PROP(node_id, automount) ? FS_MOUNT_FLAG_AUTOMOUNT : 0) \
188 | (DT_PROP(node_id, read_only) ? FS_MOUNT_FLAG_READ_ONLY : 0) \
189 | (DT_PROP(node_id, no_format) ? FS_MOUNT_FLAG_NO_FORMAT : 0))
195#define FS_FSTAB_ENTRY(node_id) _CONCAT(z_fsmp_, node_id)
203#define FS_FSTAB_DECLARE_ENTRY(node_id) \
204 extern struct fs_mount_t FS_FSTAB_ENTRY(node_id)
ZTEST_BMEM int index[(3)]
Definition: main.c:32
Doubly-linked list implementation.
uint8_t fs_mode_t
Definition: fs_interface.h:36
#define MAX_FILE_NAME
Definition: fs_interface.h:30
struct _dnode sys_dnode_t
Definition: dlist.h:49
int fs_opendir(struct fs_dir_t *zdp, const char *path)
Directory open.
int fs_unregister(int type, const struct fs_file_system_t *fs)
Unregister a file system.
int fs_statvfs(const char *path, struct fs_statvfs *stat)
Retrieves statistics of the file system volume.
int fs_mkdir(const char *path)
Directory create.
int fs_rename(const char *from, const char *to)
Rename file or directory.
int fs_mount(struct fs_mount_t *mp)
Mount filesystem.
int fs_close(struct fs_file_t *zfp)
Close file.
off_t fs_tell(struct fs_file_t *zfp)
Get current file position.
fs_dir_entry_type
Definition: fs.h:27
int fs_seek(struct fs_file_t *zfp, off_t offset, int whence)
Seek file.
int fs_stat(const char *path, struct fs_dirent *entry)
File or directory status.
int fs_register(int type, const struct fs_file_system_t *fs)
Register a file system.
int fs_open(struct fs_file_t *zfp, const char *file_name, fs_mode_t flags)
Open or create file.
ssize_t fs_write(struct fs_file_t *zfp, const void *ptr, size_t size)
Write file.
int fs_closedir(struct fs_dir_t *zdp)
Directory close.
int fs_readmount(int *index, const char **name)
Get path of mount point at index.
int fs_readdir(struct fs_dir_t *zdp, struct fs_dirent *entry)
Directory read entry.
int fs_unlink(const char *path)
Unlink file.
ssize_t fs_read(struct fs_file_t *zfp, void *ptr, size_t size)
Read file.
int fs_unmount(struct fs_mount_t *mp)
Unmount filesystem.
int fs_sync(struct fs_file_t *zfp)
Flush cached write data buffers of an open file.
static void fs_dir_t_init(struct fs_dir_t *zdp)
Initialize fs_dir_t object.
Definition: fs.h:229
static void fs_file_t_init(struct fs_file_t *zfp)
Initialize fs_file_t object.
Definition: fs.h:215
int fs_truncate(struct fs_file_t *zfp, off_t length)
Truncate or extend an open file to a given size.
@ FS_LITTLEFS
Definition: fs.h:53
@ FS_TYPE_EXTERNAL_BASE
Definition: fs.h:56
@ FS_FATFS
Definition: fs.h:50
@ FS_DIR_ENTRY_DIR
Definition: fs.h:31
@ FS_DIR_ENTRY_FILE
Definition: fs.h:29
flags
Definition: http_parser.h:131
__SIZE_TYPE__ ssize_t
Definition: types.h:28
void * ptr
Definition: printk.c:79
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Directory object representing an open directory.
Definition: fs_interface.h:67
Structure to receive file or directory information.
Definition: fs.h:107
enum fs_dir_entry_type type
Definition: fs.h:108
size_t size
Definition: fs.h:110
char name[MAX_FILE_NAME+1]
Definition: fs.h:109
File System interface structure.
Definition: fs_sys.h:42
File object representing an open file.
Definition: fs_interface.h:53
File system mount info structure.
Definition: fs.h:83
const struct fs_file_system_t * fs
Definition: fs.h:91
const char * mnt_point
Definition: fs.h:86
void * storage_dev
Definition: fs.h:88
void * fs_data
Definition: fs.h:87
int type
Definition: fs.h:85
size_t mountp_len
Definition: fs.h:90
uint8_t flags
Definition: fs.h:92
sys_dnode_t node
Definition: fs.h:84
Structure to receive volume statistics.
Definition: fs.h:124
unsigned long f_bsize
Definition: fs.h:125
unsigned long f_frsize
Definition: fs.h:126
unsigned long f_blocks
Definition: fs.h:127
unsigned long f_bfree
Definition: fs.h:128