XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_vfs

xf_vfs 虚拟文件系统 (Virtual File System). 更多...

结构体

struct  xf_vfs_dir_ops_t
 Struct containing function pointers to directory related functionality. 更多...
 
struct  xf_vfs_fs_ops_t
 Main struct of the minified vfs API, containing basic function pointers as well as pointers to the other subcomponents. 更多...
 
struct  xf_vfs_select_sem_t
 VFS semaphore type for select() 更多...
 
struct  xf_vfs_t
 VFS definition structure 更多...
 
struct  xf_vfs_select_ops_t
 Struct containing function pointers to select related functionality. 更多...
 

宏定义

#define XF_VFS_PATH_PREFIX_LEN_IGNORED   (~(size_t)0)
 
#define XF_VFS_FLAG_DEFAULT   (1 << 0)
 
#define XF_VFS_FLAG_CONTEXT_PTR   (1 << 1)
 
#define XF_VFS_FLAG_READONLY_FS   (1 << 2)
 
#define XF_VFS_FLAG_STATIC   (1 << 3)
 

类型定义

typedef int(* xf_vfs_stat_ctx_op_t) (void *ctx, const char *path, xf_vfs_stat_t *st)
 
typedef int(* xf_vfs_stat_op_t) (const char *path, xf_vfs_stat_t *st)
 
typedef int(* xf_vfs_link_ctx_op_t) (void *ctx, const char *n1, const char *n2)
 
typedef int(* xf_vfs_link_op_t) (const char *n1, const char *n2)
 
typedef int(* xf_vfs_unlink_ctx_op_t) (void *ctx, const char *path)
 
typedef int(* xf_vfs_unlink_op_t) (const char *path)
 
typedef int(* xf_vfs_rename_ctx_op_t) (void *ctx, const char *src, const char *dst)
 
typedef int(* xf_vfs_rename_op_t) (const char *src, const char *dst)
 
typedef xf_vfs_dir_t *(* xf_vfs_opendir_ctx_op_t) (void *ctx, const char *name)
 
typedef xf_vfs_dir_t *(* xf_vfs_opendir_op_t) (const char *name)
 
typedef xf_vfs_dirent_t *(* xf_vfs_readdir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)
 
typedef xf_vfs_dirent_t *(* xf_vfs_readdir_op_t) (xf_vfs_dir_t *pdir)
 
typedef int(* xf_vfs_readdir_r_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir, xf_vfs_dirent_t *entry, xf_vfs_dirent_t **out)
 
typedef int(* xf_vfs_readdir_r_op_t) (xf_vfs_dir_t *pdir, xf_vfs_dirent_t *entry, xf_vfs_dirent_t **out)
 
typedef long(* xf_vfs_telldir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)
 
typedef long(* xf_vfs_telldir_op_t) (xf_vfs_dir_t *pdir)
 
typedef void(* xf_vfs_seekdir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir, long offset)
 
typedef void(* xf_vfs_seekdir_op_t) (xf_vfs_dir_t *pdir, long offset)
 
typedef int(* xf_vfs_closedir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)
 
typedef int(* xf_vfs_closedir_op_t) (xf_vfs_dir_t *pdir)
 
typedef int(* xf_vfs_mkdir_ctx_op_t) (void *ctx, const char *name, xf_vfs_mode_t mode)
 
typedef int(* xf_vfs_mkdir_op_t) (const char *name, xf_vfs_mode_t mode)
 
typedef int(* xf_vfs_rmdir_ctx_op_t) (void *ctx, const char *name)
 
typedef int(* xf_vfs_rmdir_op_t) (const char *name)
 
typedef int(* xf_vfs_access_ctx_op_t) (void *ctx, const char *path, int amode)
 
typedef int(* xf_vfs_access_op_t) (const char *path, int amode)
 
typedef int(* xf_vfs_truncate_ctx_op_t) (void *ctx, const char *path, xf_vfs_off_t length)
 
typedef int(* xf_vfs_truncate_op_t) (const char *path, xf_vfs_off_t length)
 
typedef int(* xf_vfs_ftruncate_ctx_op_t) (void *ctx, int fd, xf_vfs_off_t length)
 
typedef int(* xf_vfs_ftruncate_op_t) (int fd, xf_vfs_off_t length)
 
typedef int(* xf_vfs_utime_ctx_op_t) (void *ctx, const char *path, const xf_vfs_utimbuf_t *times)
 
typedef int(* xf_vfs_utime_op_t) (const char *path, const xf_vfs_utimbuf_t *times)
 
typedef xf_vfs_ssize_t(* xf_vfs_write_ctx_op_t) (void *ctx, int fd, const void *data, size_t size)
 
typedef xf_vfs_ssize_t(* xf_vfs_write_op_t) (int fd, const void *data, size_t size)
 
typedef xf_vfs_off_t(* xf_vfs_lseek_ctx_op_t) (void *ctx, int fd, xf_vfs_off_t size, int mode)
 
typedef xf_vfs_off_t(* xf_vfs_lseek_op_t) (int fd, xf_vfs_off_t size, int mode)
 
typedef xf_vfs_ssize_t(* xf_vfs_read_ctx_op_t) (void *ctx, int fd, void *dst, size_t size)
 
typedef xf_vfs_ssize_t(* xf_vfs_read_op_t) (int fd, void *dst, size_t size)
 
typedef xf_vfs_ssize_t(* xf_vfs_pread_ctx_op_t) (void *ctx, int fd, void *dst, size_t size, xf_vfs_off_t offset)
 
typedef xf_vfs_ssize_t(* xf_vfs_pread_op_t) (int fd, void *dst, size_t size, xf_vfs_off_t offset)
 
typedef xf_vfs_ssize_t(* xf_vfs_pwrite_ctx_op_t) (void *ctx, int fd, const void *src, size_t size, xf_vfs_off_t offset)
 
typedef xf_vfs_ssize_t(* xf_vfs_pwrite_op_t) (int fd, const void *src, size_t size, xf_vfs_off_t offset)
 
typedef int(* xf_vfs_open_ctx_op_t) (void *ctx, const char *path, int flags, int mode)
 
typedef int(* xf_vfs_open_op_t) (const char *path, int flags, int mode)
 
typedef int(* xf_vfs_close_ctx_op_t) (void *ctx, int fd)
 
typedef int(* xf_vfs_close_op_t) (int fd)
 
typedef int(* xf_vfs_fstat_ctx_op_t) (void *ctx, int fd, xf_vfs_stat_t *st)
 
typedef int(* xf_vfs_fstat_op_t) (int fd, xf_vfs_stat_t *st)
 
typedef int(* xf_vfs_fcntl_ctx_op_t) (void *ctx, int fd, int cmd, int arg)
 
typedef int(* xf_vfs_fcntl_op_t) (int fd, int cmd, int arg)
 
typedef int(* xf_vfs_ioctl_ctx_op_t) (void *ctx, int fd, int cmd, va_list args)
 
typedef int(* xf_vfs_ioctl_op_t) (int fd, int cmd, va_list args)
 
typedef int(* xf_vfs_fsync_ctx_op_t) (void *ctx, int fd)
 
typedef int(* xf_vfs_fsync_op_t) (int fd)
 
typedef int xf_vfs_id_t
 
typedef xf_err_t(* xf_vfs_start_select_op_t) (int nfds, xf_fd_set *readfds, xf_fd_set *writefds, xf_fd_set *exceptfds, xf_vfs_select_sem_t sem, void **end_select_args)
 
typedef int(* xf_vfs_socket_select_op_t) (int nfds, xf_fd_set *readfds, xf_fd_set *writefds, xf_fd_set *errorfds, xf_vfs_timeval_t *timeout)
 
typedef void(* xf_vfs_stop_socket_select_op_t) (void *sem)
 
typedef void(* xf_vfs_stop_socket_select_isr_op_t) (void *sem, int *woken)
 
typedef void *(* xf_vfs_get_socket_select_semaphore_op_t) (void)
 
typedef xf_err_t(* xf_vfs_end_select_op_t) (void *end_select_args)
 

函数

xf_err_t xf_vfs_register (const char *base_path, const xf_vfs_t *vfs, void *ctx)
 
xf_err_t xf_vfs_register_fd_range (const xf_vfs_t *vfs, void *ctx, int min_fd, int max_fd)
 
xf_err_t xf_vfs_register_with_id (const xf_vfs_t *vfs, void *ctx, xf_vfs_id_t *vfs_id)
 
xf_err_t xf_vfs_unregister (const char *base_path)
 
xf_err_t xf_vfs_unregister_with_id (xf_vfs_id_t vfs_id)
 
xf_err_t xf_vfs_register_fd (xf_vfs_id_t vfs_id, int *fd)
 
xf_err_t xf_vfs_register_fd_with_local_fd (xf_vfs_id_t vfs_id, int local_fd, bool permanent, int *fd)
 
xf_err_t xf_vfs_unregister_fd (xf_vfs_id_t vfs_id, int fd)
 
xf_vfs_ssize_t xf_vfs_pread (int fd, void *dst, size_t size, xf_vfs_off_t offset)
 Implements the VFS layer of POSIX pread()
 
xf_vfs_ssize_t xf_vfs_pwrite (int fd, const void *src, size_t size, xf_vfs_off_t offset)
 Implements the VFS layer of POSIX pwrite()
 
void xf_vfs_dump_fds (void)
 Dump the existing VFS FDs data to FILE* fp
 
void xf_vfs_dump_registered_paths (void)
 Dump all registered FSs to the provided FILE*
 
int xf_vfs_select (int nfds, xf_fd_set *readfds, xf_fd_set *writefds, xf_fd_set *errorfds, xf_vfs_timeval_t *timeout)
 Synchronous I/O multiplexing which implements the functionality of POSIX select() for VFS
 
void xf_vfs_select_triggered (xf_vfs_select_sem_t sem)
 Notification from a VFS driver about a read/write/error condition
 
void xf_vfs_select_triggered_isr (xf_vfs_select_sem_t sem, int *woken)
 Notification from a VFS driver about a read/write/error condition (ISR version)
 
xf_err_t xf_vfs_register_fs (const char *base_path, const xf_vfs_fs_ops_t *vfs, int flags, void *ctx)
 
xf_err_t xf_vfs_register_fs_with_id (const xf_vfs_fs_ops_t *vfs, int flags, void *ctx, xf_vfs_id_t *id)
 
xf_err_t xf_vfs_unregister_fs (const char *base_path)
 
xf_err_t xf_vfs_unregister_fs_with_id (xf_vfs_id_t id)
 
xf_vfs_ssize_t xf_vfs_write (int fd, const void *data, size_t size)
 
xf_vfs_off_t xf_vfs_lseek (int fd, xf_vfs_off_t size, int mode)
 
xf_vfs_ssize_t xf_vfs_read (int fd, void *dst, size_t size)
 
int xf_vfs_open (const char *path, int flags, int mode)
 
int xf_vfs_close (int fd)
 
int xf_vfs_fstat (int fd, xf_vfs_stat_t *st)
 
int xf_vfs_fcntl_r (int fd, int cmd, int arg)
 
int xf_vfs_ioctl (int fd, int cmd,...)
 
int xf_vfs_fsync (int fd)
 
int xf_vfs_stat (const char *path, xf_vfs_stat_t *st)
 
int xf_vfs_link (const char *n1, const char *n2)
 
int xf_vfs_unlink (const char *path)
 
int xf_vfs_rename (const char *src, const char *dst)
 
int xf_vfs_utime (const char *path, const xf_vfs_utimbuf_t *times)
 
xf_vfs_dir_txf_vfs_opendir (const char *name)
 
xf_vfs_dirent_txf_vfs_readdir (xf_vfs_dir_t *pdir)
 
int xf_vfs_readdir_r (xf_vfs_dir_t *pdir, xf_vfs_dirent_t *entry, xf_vfs_dirent_t **out_dirent)
 
long xf_vfs_telldir (xf_vfs_dir_t *pdir)
 
void xf_vfs_seekdir (xf_vfs_dir_t *pdir, long loc)
 
void xf_vfs_rewinddir (xf_vfs_dir_t *pdir)
 
int xf_vfs_closedir (xf_vfs_dir_t *pdir)
 
int xf_vfs_mkdir (const char *name, xf_vfs_mode_t mode)
 
int xf_vfs_rmdir (const char *name)
 
int xf_vfs_access (const char *path, int amode)
 
int xf_vfs_truncate (const char *path, xf_vfs_off_t length)
 
int xf_vfs_ftruncate (int fd, xf_vfs_off_t length)
 
#define xf_vfs_fcntl(fd, cmd, arg)   xf_vfs_fcntl_r((fd), (cmd), (arg))
 

详细描述

xf_vfs 虚拟文件系统 (Virtual File System).

Copyright (c) 2024, CorAL. This file has been modified by CorAL under the terms of the Apache License, Version 2.0.

Modifications:

Copyright (c) 2024, CorAL. This file has been modified by CorAL under the terms of the Apache License, Version 2.0.

Modifications:

宏定义说明

◆ xf_vfs_fcntl

#define xf_vfs_fcntl (   fd,
  cmd,
  arg 
)    xf_vfs_fcntl_r((fd), (cmd), (arg))

在文件 xf_vfs.h192 行定义.

◆ XF_VFS_PATH_PREFIX_LEN_IGNORED

#define XF_VFS_PATH_PREFIX_LEN_IGNORED   (~(size_t)0)

在文件 xf_vfs_types.h61 行定义.

◆ XF_VFS_FLAG_DEFAULT

#define XF_VFS_FLAG_DEFAULT   (1 << 0)

Default value of flags member in xf_vfs_t structure.

在文件 xf_vfs_types.h66 行定义.

◆ XF_VFS_FLAG_CONTEXT_PTR

#define XF_VFS_FLAG_CONTEXT_PTR   (1 << 1)

Flag which indicates that FS needs extra context pointer in syscalls.

在文件 xf_vfs_types.h71 行定义.

◆ XF_VFS_FLAG_READONLY_FS

#define XF_VFS_FLAG_READONLY_FS   (1 << 2)

Flag which indicates that FS is located on read-only partition.

在文件 xf_vfs_types.h76 行定义.

◆ XF_VFS_FLAG_STATIC

#define XF_VFS_FLAG_STATIC   (1 << 3)

Flag which indicates that VFS structure should be freed upon unregistering.

注解
Free if false, do not free if true

在文件 xf_vfs_types.h82 行定义.

类型定义说明

◆ xf_vfs_stat_ctx_op_t

typedef int(* xf_vfs_stat_ctx_op_t) (void *ctx, const char *path, xf_vfs_stat_t *st)

stat with context pointer

在文件 xf_vfs_ops.h54 行定义.

◆ xf_vfs_stat_op_t

typedef int(* xf_vfs_stat_op_t) (const char *path, xf_vfs_stat_t *st)

stat without context pointer

在文件 xf_vfs_ops.h55 行定义.

◆ xf_vfs_link_ctx_op_t

typedef int(* xf_vfs_link_ctx_op_t) (void *ctx, const char *n1, const char *n2)

link with context pointer

在文件 xf_vfs_ops.h56 行定义.

◆ xf_vfs_link_op_t

typedef int(* xf_vfs_link_op_t) (const char *n1, const char *n2)

link without context pointer

在文件 xf_vfs_ops.h57 行定义.

◆ xf_vfs_unlink_ctx_op_t

typedef int(* xf_vfs_unlink_ctx_op_t) (void *ctx, const char *path)

unlink with context pointer

在文件 xf_vfs_ops.h58 行定义.

◆ xf_vfs_unlink_op_t

typedef int(* xf_vfs_unlink_op_t) (const char *path)

unlink without context pointer

在文件 xf_vfs_ops.h59 行定义.

◆ xf_vfs_rename_ctx_op_t

typedef int(* xf_vfs_rename_ctx_op_t) (void *ctx, const char *src, const char *dst)

rename with context pointer

在文件 xf_vfs_ops.h60 行定义.

◆ xf_vfs_rename_op_t

typedef int(* xf_vfs_rename_op_t) (const char *src, const char *dst)

rename without context pointer

在文件 xf_vfs_ops.h61 行定义.

◆ xf_vfs_opendir_ctx_op_t

typedef xf_vfs_dir_t *(* xf_vfs_opendir_ctx_op_t) (void *ctx, const char *name)

opendir with context pointer

在文件 xf_vfs_ops.h62 行定义.

◆ xf_vfs_opendir_op_t

typedef xf_vfs_dir_t *(* xf_vfs_opendir_op_t) (const char *name)

opendir without context pointer

在文件 xf_vfs_ops.h63 行定义.

◆ xf_vfs_readdir_ctx_op_t

typedef xf_vfs_dirent_t *(* xf_vfs_readdir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)

readdir with context pointer

在文件 xf_vfs_ops.h64 行定义.

◆ xf_vfs_readdir_op_t

typedef xf_vfs_dirent_t *(* xf_vfs_readdir_op_t) (xf_vfs_dir_t *pdir)

readdir without context pointer

在文件 xf_vfs_ops.h65 行定义.

◆ xf_vfs_readdir_r_ctx_op_t

typedef int(* xf_vfs_readdir_r_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir, xf_vfs_dirent_t *entry, xf_vfs_dirent_t **out)

readdir_r with context pointer

在文件 xf_vfs_ops.h66 行定义.

◆ xf_vfs_readdir_r_op_t

typedef int(* xf_vfs_readdir_r_op_t) (xf_vfs_dir_t *pdir, xf_vfs_dirent_t *entry, xf_vfs_dirent_t **out)

readdir_r without context pointer

在文件 xf_vfs_ops.h67 行定义.

◆ xf_vfs_telldir_ctx_op_t

typedef long(* xf_vfs_telldir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)

telldir with context pointer

在文件 xf_vfs_ops.h68 行定义.

◆ xf_vfs_telldir_op_t

typedef long(* xf_vfs_telldir_op_t) (xf_vfs_dir_t *pdir)

telldir without context pointer

在文件 xf_vfs_ops.h69 行定义.

◆ xf_vfs_seekdir_ctx_op_t

typedef void(* xf_vfs_seekdir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir, long offset)

seekdir with context pointer

在文件 xf_vfs_ops.h70 行定义.

◆ xf_vfs_seekdir_op_t

typedef void(* xf_vfs_seekdir_op_t) (xf_vfs_dir_t *pdir, long offset)

seekdir without context pointer

在文件 xf_vfs_ops.h71 行定义.

◆ xf_vfs_closedir_ctx_op_t

typedef int(* xf_vfs_closedir_ctx_op_t) (void *ctx, xf_vfs_dir_t *pdir)

closedir with context pointer

在文件 xf_vfs_ops.h72 行定义.

◆ xf_vfs_closedir_op_t

typedef int(* xf_vfs_closedir_op_t) (xf_vfs_dir_t *pdir)

closedir without context pointer

在文件 xf_vfs_ops.h73 行定义.

◆ xf_vfs_mkdir_ctx_op_t

typedef int(* xf_vfs_mkdir_ctx_op_t) (void *ctx, const char *name, xf_vfs_mode_t mode)

mkdir with context pointer

在文件 xf_vfs_ops.h74 行定义.

◆ xf_vfs_mkdir_op_t

typedef int(* xf_vfs_mkdir_op_t) (const char *name, xf_vfs_mode_t mode)

mkdir without context pointer

在文件 xf_vfs_ops.h75 行定义.

◆ xf_vfs_rmdir_ctx_op_t

typedef int(* xf_vfs_rmdir_ctx_op_t) (void *ctx, const char *name)

rmdir with context pointer

在文件 xf_vfs_ops.h76 行定义.

◆ xf_vfs_rmdir_op_t

typedef int(* xf_vfs_rmdir_op_t) (const char *name)

rmdir without context pointer

在文件 xf_vfs_ops.h77 行定义.

◆ xf_vfs_access_ctx_op_t

typedef int(* xf_vfs_access_ctx_op_t) (void *ctx, const char *path, int amode)

access with context pointer

在文件 xf_vfs_ops.h78 行定义.

◆ xf_vfs_access_op_t

typedef int(* xf_vfs_access_op_t) (const char *path, int amode)

access without context pointer

在文件 xf_vfs_ops.h79 行定义.

◆ xf_vfs_truncate_ctx_op_t

typedef int(* xf_vfs_truncate_ctx_op_t) (void *ctx, const char *path, xf_vfs_off_t length)

truncate with context pointer

在文件 xf_vfs_ops.h80 行定义.

◆ xf_vfs_truncate_op_t

typedef int(* xf_vfs_truncate_op_t) (const char *path, xf_vfs_off_t length)

truncate without context pointer

在文件 xf_vfs_ops.h81 行定义.

◆ xf_vfs_ftruncate_ctx_op_t

typedef int(* xf_vfs_ftruncate_ctx_op_t) (void *ctx, int fd, xf_vfs_off_t length)

ftruncate with context pointer

在文件 xf_vfs_ops.h82 行定义.

◆ xf_vfs_ftruncate_op_t

typedef int(* xf_vfs_ftruncate_op_t) (int fd, xf_vfs_off_t length)

ftruncate without context pointer

在文件 xf_vfs_ops.h83 行定义.

◆ xf_vfs_utime_ctx_op_t

typedef int(* xf_vfs_utime_ctx_op_t) (void *ctx, const char *path, const xf_vfs_utimbuf_t *times)

utime with context pointer

在文件 xf_vfs_ops.h84 行定义.

◆ xf_vfs_utime_op_t

typedef int(* xf_vfs_utime_op_t) (const char *path, const xf_vfs_utimbuf_t *times)

utime without context pointer

在文件 xf_vfs_ops.h85 行定义.

◆ xf_vfs_write_ctx_op_t

typedef xf_vfs_ssize_t(* xf_vfs_write_ctx_op_t) (void *ctx, int fd, const void *data, size_t size)

Write with context pointer

在文件 xf_vfs_ops.h162 行定义.

◆ xf_vfs_write_op_t

typedef xf_vfs_ssize_t(* xf_vfs_write_op_t) (int fd, const void *data, size_t size)

Write without context pointer

在文件 xf_vfs_ops.h163 行定义.

◆ xf_vfs_lseek_ctx_op_t

typedef xf_vfs_off_t(* xf_vfs_lseek_ctx_op_t) (void *ctx, int fd, xf_vfs_off_t size, int mode)

Seek with context pointer

在文件 xf_vfs_ops.h164 行定义.

◆ xf_vfs_lseek_op_t

typedef xf_vfs_off_t(* xf_vfs_lseek_op_t) (int fd, xf_vfs_off_t size, int mode)

Seek without context pointer

在文件 xf_vfs_ops.h165 行定义.

◆ xf_vfs_read_ctx_op_t

typedef xf_vfs_ssize_t(* xf_vfs_read_ctx_op_t) (void *ctx, int fd, void *dst, size_t size)

Read with context pointer

在文件 xf_vfs_ops.h166 行定义.

◆ xf_vfs_read_op_t

typedef xf_vfs_ssize_t(* xf_vfs_read_op_t) (int fd, void *dst, size_t size)

Read without context pointer

在文件 xf_vfs_ops.h167 行定义.

◆ xf_vfs_pread_ctx_op_t

typedef xf_vfs_ssize_t(* xf_vfs_pread_ctx_op_t) (void *ctx, int fd, void *dst, size_t size, xf_vfs_off_t offset)

pread with context pointer

在文件 xf_vfs_ops.h168 行定义.

◆ xf_vfs_pread_op_t

typedef xf_vfs_ssize_t(* xf_vfs_pread_op_t) (int fd, void *dst, size_t size, xf_vfs_off_t offset)

pread without context pointer

在文件 xf_vfs_ops.h169 行定义.

◆ xf_vfs_pwrite_ctx_op_t

typedef xf_vfs_ssize_t(* xf_vfs_pwrite_ctx_op_t) (void *ctx, int fd, const void *src, size_t size, xf_vfs_off_t offset)

pwrite with context pointer

在文件 xf_vfs_ops.h170 行定义.

◆ xf_vfs_pwrite_op_t

typedef xf_vfs_ssize_t(* xf_vfs_pwrite_op_t) (int fd, const void *src, size_t size, xf_vfs_off_t offset)

pwrite without context pointer

在文件 xf_vfs_ops.h171 行定义.

◆ xf_vfs_open_ctx_op_t

typedef int(* xf_vfs_open_ctx_op_t) (void *ctx, const char *path, int flags, int mode)

open with context pointer

在文件 xf_vfs_ops.h172 行定义.

◆ xf_vfs_open_op_t

typedef int(* xf_vfs_open_op_t) (const char *path, int flags, int mode)

open without context pointer

在文件 xf_vfs_ops.h173 行定义.

◆ xf_vfs_close_ctx_op_t

typedef int(* xf_vfs_close_ctx_op_t) (void *ctx, int fd)

close with context pointer

在文件 xf_vfs_ops.h174 行定义.

◆ xf_vfs_close_op_t

typedef int(* xf_vfs_close_op_t) (int fd)

close without context pointer

在文件 xf_vfs_ops.h175 行定义.

◆ xf_vfs_fstat_ctx_op_t

typedef int(* xf_vfs_fstat_ctx_op_t) (void *ctx, int fd, xf_vfs_stat_t *st)

fstat with context pointer

在文件 xf_vfs_ops.h176 行定义.

◆ xf_vfs_fstat_op_t

typedef int(* xf_vfs_fstat_op_t) (int fd, xf_vfs_stat_t *st)

fstat without context pointer

在文件 xf_vfs_ops.h177 行定义.

◆ xf_vfs_fcntl_ctx_op_t

typedef int(* xf_vfs_fcntl_ctx_op_t) (void *ctx, int fd, int cmd, int arg)

fcntl with context pointer

在文件 xf_vfs_ops.h178 行定义.

◆ xf_vfs_fcntl_op_t

typedef int(* xf_vfs_fcntl_op_t) (int fd, int cmd, int arg)

fcntl without context pointer

在文件 xf_vfs_ops.h179 行定义.

◆ xf_vfs_ioctl_ctx_op_t

typedef int(* xf_vfs_ioctl_ctx_op_t) (void *ctx, int fd, int cmd, va_list args)

ioctl with context pointer

在文件 xf_vfs_ops.h180 行定义.

◆ xf_vfs_ioctl_op_t

typedef int(* xf_vfs_ioctl_op_t) (int fd, int cmd, va_list args)

ioctl without context pointer

在文件 xf_vfs_ops.h181 行定义.

◆ xf_vfs_fsync_ctx_op_t

typedef int(* xf_vfs_fsync_ctx_op_t) (void *ctx, int fd)

fsync with context pointer

在文件 xf_vfs_ops.h182 行定义.

◆ xf_vfs_fsync_op_t

typedef int(* xf_vfs_fsync_op_t) (int fd)

fsync without context pointer

在文件 xf_vfs_ops.h183 行定义.

◆ xf_vfs_id_t

typedef int xf_vfs_id_t

在文件 xf_vfs_types.h99 行定义.

◆ xf_vfs_start_select_op_t

typedef xf_err_t(* xf_vfs_start_select_op_t) (int nfds, xf_fd_set *readfds, xf_fd_set *writefds, xf_fd_set *exceptfds, xf_vfs_select_sem_t sem, void **end_select_args)

在文件 xf_vfs_types.h260 行定义.

◆ xf_vfs_socket_select_op_t

typedef int(* xf_vfs_socket_select_op_t) (int nfds, xf_fd_set *readfds, xf_fd_set *writefds, xf_fd_set *errorfds, xf_vfs_timeval_t *timeout)

在文件 xf_vfs_types.h261 行定义.

◆ xf_vfs_stop_socket_select_op_t

typedef void(* xf_vfs_stop_socket_select_op_t) (void *sem)

在文件 xf_vfs_types.h262 行定义.

◆ xf_vfs_stop_socket_select_isr_op_t

typedef void(* xf_vfs_stop_socket_select_isr_op_t) (void *sem, int *woken)

在文件 xf_vfs_types.h263 行定义.

◆ xf_vfs_get_socket_select_semaphore_op_t

typedef void *(* xf_vfs_get_socket_select_semaphore_op_t) (void)

在文件 xf_vfs_types.h264 行定义.

◆ xf_vfs_end_select_op_t

typedef xf_err_t(* xf_vfs_end_select_op_t) (void *end_select_args)

在文件 xf_vfs_types.h265 行定义.

函数说明

◆ xf_vfs_register()

xf_err_t xf_vfs_register ( const char *  base_path,
const xf_vfs_t vfs,
void *  ctx 
)

Register a virtual filesystem for given path prefix.

参数
base_pathfile path prefix associated with the filesystem. Must be a zero-terminated C string, may be empty. If not empty, must be up to XF_VFS_PATH_MAX characters long, and at least 2 characters long. Name must start with a "/" and must not end with "/". For example, "/data" or "/dev/spi" are valid. These VFSes would then be called to handle file paths such as "/data/myfile.txt" or "/dev/spi/0". In the special case of an empty base_path, a "fallback" VFS is registered. Such VFS will handle paths which are not matched by any other registered VFS.
vfsPointer to xf_vfs_t, a structure which maps syscalls to the filesystem driver functions. VFS component doesn't assume ownership of this pointer.
ctxIf vfs->flags has XF_VFS_FLAG_CONTEXT_PTR set, a pointer which should be passed to VFS functions. Otherwise, NULL.
返回
XF_OK if successful, XF_ERR_NO_MEM if too many VFSes are registered.

在文件 xf_vfs.c177 行定义.

◆ xf_vfs_register_fd_range()

xf_err_t xf_vfs_register_fd_range ( const xf_vfs_t vfs,
void *  ctx,
int  min_fd,
int  max_fd 
)

Special case function for registering a VFS that uses a method other than open() to open new file descriptors from the interval <min_fd; max_fd).

This is a special-purpose function intended for registering LWIP sockets to VFS.

参数
vfsPointer to xf_vfs_t. Meaning is the same as for xf_vfs_register().
ctxPointer to context structure. Meaning is the same as for xf_vfs_register().
min_fdThe smallest file descriptor this VFS will use.
max_fdUpper boundary for file descriptors this VFS will use (the biggest file descriptor plus one).
返回
XF_OK if successful, XF_ERR_NO_MEM if too many VFSes are registered, XF_ERR_INVALID_ARG if the file descriptor boundaries are incorrect.

在文件 xf_vfs.c182 行定义.

◆ xf_vfs_register_with_id()

xf_err_t xf_vfs_register_with_id ( const xf_vfs_t vfs,
void *  ctx,
xf_vfs_id_t vfs_id 
)

Special case function for registering a VFS that uses a method other than open() to open new file descriptors. In comparison with xf_vfs_register_fd_range, this function doesn't pre-registers an interval of file descriptors. File descriptors can be registered later, by using xf_vfs_register_fd.

参数
vfsPointer to xf_vfs_t. Meaning is the same as for xf_vfs_register().
ctxPointer to context structure. Meaning is the same as for xf_vfs_register().
vfs_idHere will be written the VFS ID which can be passed to xf_vfs_register_fd for registering file descriptors.
返回
XF_OK if successful, XF_ERR_NO_MEM if too many VFSes are registered, XF_ERR_INVALID_ARG if the file descriptor boundaries are incorrect.

在文件 xf_vfs.c230 行定义.

◆ xf_vfs_unregister()

xf_err_t xf_vfs_unregister ( const char *  base_path)

Unregister a virtual filesystem for given path prefix

参数
base_pathfile prefix previously used in xf_vfs_register call
返回
XF_OK if successful, XF_ERR_INVALID_STATE if VFS for given prefix hasn't been registered

在文件 xf_vfs.c267 行定义.

◆ xf_vfs_unregister_with_id()

xf_err_t xf_vfs_unregister_with_id ( xf_vfs_id_t  vfs_id)

Unregister a virtual filesystem with the given index

参数
vfs_idThe VFS ID returned by xf_vfs_register_with_id
返回
XF_OK if successful, XF_ERR_INVALID_STATE if VFS for the given index hasn't been registered

在文件 xf_vfs.c240 行定义.

◆ xf_vfs_register_fd()

xf_err_t xf_vfs_register_fd ( xf_vfs_id_t  vfs_id,
int *  fd 
)

Special function for registering another file descriptor for a VFS registered by xf_vfs_register_with_id. This function should only be used to register permanent file descriptors (socket fd) that are not removed after being closed.

参数
vfs_idVFS identificator returned by xf_vfs_register_with_id.
fdThe registered file descriptor will be written to this address.
返回
XF_OK if the registration is successful, XF_ERR_NO_MEM if too many file descriptors are registered, XF_ERR_INVALID_ARG if the arguments are incorrect.

在文件 xf_vfs.c288 行定义.

◆ xf_vfs_register_fd_with_local_fd()

xf_err_t xf_vfs_register_fd_with_local_fd ( xf_vfs_id_t  vfs_id,
int  local_fd,
bool  permanent,
int *  fd 
)

Special function for registering another file descriptor with given local_fd for a VFS registered by xf_vfs_register_with_id.

参数
vfs_idVFS identificator returned by xf_vfs_register_with_id.
local_fdThe fd in the local vfs. Passing -1 will set the local fd as the (*fd) value.
permanentWhether the fd should be treated as permannet (not removed after close())
fdThe registered file descriptor will be written to this address.
返回
XF_OK if the registration is successful, XF_ERR_NO_MEM if too many file descriptors are registered, XF_ERR_INVALID_ARG if the arguments are incorrect.

在文件 xf_vfs.c293 行定义.

◆ xf_vfs_unregister_fd()

xf_err_t xf_vfs_unregister_fd ( xf_vfs_id_t  vfs_id,
int  fd 
)

Special function for unregistering a file descriptor belonging to a VFS registered by xf_vfs_register_with_id.

参数
vfs_idVFS identificator returned by xf_vfs_register_with_id.
fdFile descriptor which should be unregistered.
返回
XF_OK if the registration is successful, XF_ERR_INVALID_ARG if the arguments are incorrect.

在文件 xf_vfs.c325 行定义.

◆ xf_vfs_write()

xf_vfs_ssize_t xf_vfs_write ( int  fd,
const void *  data,
size_t  size 
)

在文件 xf_vfs.c577 行定义.

◆ xf_vfs_lseek()

xf_vfs_off_t xf_vfs_lseek ( int  fd,
xf_vfs_off_t  size,
int  mode 
)

在文件 xf_vfs.c590 行定义.

◆ xf_vfs_read()

xf_vfs_ssize_t xf_vfs_read ( int  fd,
void *  dst,
size_t  size 
)

在文件 xf_vfs.c603 行定义.

◆ xf_vfs_open()

int xf_vfs_open ( const char *  path,
int  flags,
int  mode 
)

在文件 xf_vfs.c538 行定义.

◆ xf_vfs_close()

int xf_vfs_close ( int  fd)

在文件 xf_vfs.c642 行定义.

◆ xf_vfs_fstat()

int xf_vfs_fstat ( int  fd,
xf_vfs_stat_t st 
)

在文件 xf_vfs.c665 行定义.

◆ xf_vfs_fcntl_r()

int xf_vfs_fcntl_r ( int  fd,
int  cmd,
int  arg 
)

在文件 xf_vfs.c678 行定义.

◆ xf_vfs_ioctl()

int xf_vfs_ioctl ( int  fd,
int  cmd,
  ... 
)

在文件 xf_vfs.c691 行定义.

◆ xf_vfs_fsync()

int xf_vfs_fsync ( int  fd)

在文件 xf_vfs.c707 行定义.

◆ xf_vfs_stat()

int xf_vfs_stat ( const char *  path,
xf_vfs_stat_t st 
)

在文件 xf_vfs.c722 行定义.

◆ xf_vfs_link()

int xf_vfs_link ( const char *  n1,
const char *  n2 
)

在文件 xf_vfs.c748 行定义.

◆ xf_vfs_unlink()

int xf_vfs_unlink ( const char *  path)

在文件 xf_vfs.c770 行定义.

◆ xf_vfs_rename()

int xf_vfs_rename ( const char *  src,
const char *  dst 
)

在文件 xf_vfs.c786 行定义.

◆ xf_vfs_utime()

int xf_vfs_utime ( const char *  path,
const xf_vfs_utimbuf_t times 
)

在文件 xf_vfs.c735 行定义.

◆ xf_vfs_opendir()

xf_vfs_dir_t * xf_vfs_opendir ( const char *  name)

在文件 xf_vfs.c811 行定义.

◆ xf_vfs_readdir()

xf_vfs_dirent_t * xf_vfs_readdir ( xf_vfs_dir_t pdir)

在文件 xf_vfs.c827 行定义.

◆ xf_vfs_readdir_r()

int xf_vfs_readdir_r ( xf_vfs_dir_t pdir,
xf_vfs_dirent_t entry,
xf_vfs_dirent_t **  out_dirent 
)

在文件 xf_vfs.c839 行定义.

◆ xf_vfs_telldir()

long xf_vfs_telldir ( xf_vfs_dir_t pdir)

在文件 xf_vfs.c851 行定义.

◆ xf_vfs_seekdir()

void xf_vfs_seekdir ( xf_vfs_dir_t pdir,
long  loc 
)

在文件 xf_vfs.c863 行定义.

◆ xf_vfs_rewinddir()

void xf_vfs_rewinddir ( xf_vfs_dir_t pdir)

在文件 xf_vfs.c873 行定义.

◆ xf_vfs_closedir()

int xf_vfs_closedir ( xf_vfs_dir_t pdir)

在文件 xf_vfs.c878 行定义.

◆ xf_vfs_mkdir()

int xf_vfs_mkdir ( const char *  name,
xf_vfs_mode_t  mode 
)

在文件 xf_vfs.c890 行定义.

◆ xf_vfs_rmdir()

int xf_vfs_rmdir ( const char *  name)

在文件 xf_vfs.c906 行定义.

◆ xf_vfs_access()

int xf_vfs_access ( const char *  path,
int  amode 
)

在文件 xf_vfs.c922 行定义.

◆ xf_vfs_truncate()

int xf_vfs_truncate ( const char *  path,
xf_vfs_off_t  length 
)

在文件 xf_vfs.c935 行定义.

◆ xf_vfs_ftruncate()

int xf_vfs_ftruncate ( int  fd,
xf_vfs_off_t  length 
)

在文件 xf_vfs.c951 行定义.

◆ xf_vfs_pread()

xf_vfs_ssize_t xf_vfs_pread ( int  fd,
void *  dst,
size_t  size,
xf_vfs_off_t  offset 
)

Implements the VFS layer of POSIX pread()

参数
fdFile descriptor used for read
dstPointer to the buffer where the output will be written
sizeNumber of bytes to be read
offsetStarting offset of the read
返回
A positive return value indicates the number of bytes read. -1 is return on failure and errno is set accordingly.

在文件 xf_vfs.c616 行定义.

◆ xf_vfs_pwrite()

xf_vfs_ssize_t xf_vfs_pwrite ( int  fd,
const void *  src,
size_t  size,
xf_vfs_off_t  offset 
)

Implements the VFS layer of POSIX pwrite()

参数
fdFile descriptor used for write
srcPointer to the buffer from where the output will be read
sizeNumber of bytes to write
offsetStarting offset of the write
返回
A positive return value indicates the number of bytes written. -1 is return on failure and errno is set accordingly.

在文件 xf_vfs.c629 行定义.

◆ xf_vfs_dump_fds()

void xf_vfs_dump_fds ( void  )

Dump the existing VFS FDs data to FILE* fp

Dump the FDs in the format:

        <VFS Path Prefix>-<FD seen by App>-<FD seen by driver>

   where:
    VFS Path Prefix   : file prefix used in the xf_vfs_register call
    FD seen by App    : file descriptor returned by the vfs to the application for the path prefix
    FD seen by driver : file descriptor used by the driver for the same file prefix.

在文件 xf_vfs.c347 行定义.

◆ xf_vfs_dump_registered_paths()

void xf_vfs_dump_registered_paths ( void  )

Dump all registered FSs to the provided FILE*

Dump the FSs in the format:

       <index>:<VFS Path Prefix> -> <VFS entry ptr>

   where:
       index           : internal index in the table of registered FSs (the same as returned when registering fd with id)
       VFS Path Prefix : file prefix used in the xf_vfs_register call or "NULL"
       VFS entry ptr   : pointer to the xf_vfs_fs_ops_t struct used internally when resolving the calls

在文件 xf_vfs.c367 行定义.

◆ xf_vfs_select()

int xf_vfs_select ( int  nfds,
xf_fd_set readfds,
xf_fd_set writefds,
xf_fd_set errorfds,
xf_vfs_timeval_t timeout 
)

Synchronous I/O multiplexing which implements the functionality of POSIX select() for VFS

参数
nfdsSpecifies the range of descriptors which should be checked. The first nfds descriptors will be checked in each set.
readfdsIf not NULL, then points to a descriptor set that on input specifies which descriptors should be checked for being ready to read, and on output indicates which descriptors are ready to read.
writefdsIf not NULL, then points to a descriptor set that on input specifies which descriptors should be checked for being ready to write, and on output indicates which descriptors are ready to write.
errorfdsIf not NULL, then points to a descriptor set that on input specifies which descriptors should be checked for error conditions, and on output indicates which descriptors have error conditions.
timeoutIf not NULL, then points to timeval structure which specifies the time period after which the functions should time-out and return. If it is NULL, then the function will not time-out. Note that the timeout period is rounded up to the system tick and incremented by one.
返回
The number of descriptors set in the descriptor sets, or -1 when an error (specified by errno) have occurred.

在文件 xf_vfs.c1040 行定义.

◆ xf_vfs_select_triggered()

void xf_vfs_select_triggered ( xf_vfs_select_sem_t  sem)

Notification from a VFS driver about a read/write/error condition

This function is called when the VFS driver detects a read/write/error condition as it was requested by the previous call to start_select.

参数
semsemaphore structure which was passed to the driver by the start_select call

在文件 xf_vfs.c1270 行定义.

◆ xf_vfs_select_triggered_isr()

void xf_vfs_select_triggered_isr ( xf_vfs_select_sem_t  sem,
int *  woken 
)

Notification from a VFS driver about a read/write/error condition (ISR version)

This function is called when the VFS driver detects a read/write/error condition as it was requested by the previous call to start_select.

参数
semsemaphore structure which was passed to the driver by the start_select call
wokenis set to pdTRUE if the function wakes up a task with higher priority

在文件 xf_vfs.c1293 行定义.

◆ xf_vfs_register_fs()

xf_err_t xf_vfs_register_fs ( const char *  base_path,
const xf_vfs_fs_ops_t vfs,
int  flags,
void *  ctx 
)

Register a virtual filesystem for given path prefix.

参数
base_pathfile path prefix associated with the filesystem. Must be a zero-terminated C string, may be empty. If not empty, must be up to XF_VFS_PATH_MAX characters long, and at least 2 characters long. Name must start with a "/" and must not end with "/". For example, "/data" or "/dev/spi" are valid. These VFSes would then be called to handle file paths such as "/data/myfile.txt" or "/dev/spi/0". In the special case of an empty base_path, a "fallback" VFS is registered. Such VFS will handle paths which are not matched by any other registered VFS.
vfsPointer to xf_vfs_fs_ops_t, a structure which maps syscalls to the filesystem driver functions. VFS component does not assume ownership of this struct, but see flags for more info
flagsSet of binary flags controlling how the registered FS should be treated
  • XF_VFS_FLAG_STATIC - if this flag is specified VFS assumes the provided xf_vfs_fs_ops_t and all its subcomponents are statically allocated, if it is not enabled a deep copy of the provided struct will be created, which will be managed by the VFS component
  • XF_VFS_FLAG_CONTEXT_PTR - If set, the VFS will use the context-aware versions of the filesystem operation functions (suffixed with _p) in xf_vfs_fs_ops_t and its subcomponents. The ctx parameter will be passed as the context argument when these functions are invoked.
ctxContext pointer for fs operation functions, see the XF_VFS_FLAG_CONTEXT_PTR. Should be NULL if not used.
返回
XF_OK if successful, XF_ERR_NO_MEM if too many FSes are registered.

在文件 xf_vfs.c117 行定义.

◆ xf_vfs_register_fs_with_id()

xf_err_t xf_vfs_register_fs_with_id ( const xf_vfs_fs_ops_t vfs,
int  flags,
void *  ctx,
xf_vfs_id_t id 
)

Analog of xf_vfs_register_with_id which accepts xf_vfs_fs_ops_t instead.

在文件 xf_vfs.c220 行定义.

◆ xf_vfs_unregister_fs()

xf_err_t xf_vfs_unregister_fs ( const char *  base_path)

Alias for xf_vfs_unregister for naming consistency

在文件 xf_vfs.c283 行定义.

◆ xf_vfs_unregister_fs_with_id()

xf_err_t xf_vfs_unregister_fs_with_id ( xf_vfs_id_t  id)

Alias for xf_vfs_unregister_with_id for naming consistency

在文件 xf_vfs.c262 行定义.