XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_vfs_private.h 文件参考
#include "xf_vfs_types.h"
xf_vfs_private.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  _xf_vfs_entry_t
 
typedef struct _xf_vfs_entry_t xf_vfs_entry_t
 
xf_err_t xf_vfs_register_common (const char *base_path, size_t len, const xf_vfs_t *vfs, void *ctx, int *vfs_index)
 
const xf_vfs_entry_txf_vfs_get_vfs_for_path (const char *path)
 
const xf_vfs_entry_txf_vfs_get_vfs_for_index (int index)
 

详细描述

作者
catcatBlue (catca.nosp@m.tblu.nosp@m.e@qq..nosp@m.com)
版本
1.0
日期
2025-01-13

在文件 xf_vfs_private.h 中定义.

类型定义说明

◆ xf_vfs_entry_t

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

Modifications:

  • Modified by CorAL on 2025-01-10:
    1. modified the naming to prevent conflict with the original project.
    2. Remove posix docking, compatible with other platforms.
    3. removed esp-idf related dependencies.
    4. trimmed termios and other functions.

函数说明

◆ xf_vfs_register_common()

xf_err_t xf_vfs_register_common ( const char *  base_path,
size_t  len,
const xf_vfs_t vfs,
void *  ctx,
int *  vfs_index 
)

Register a virtual filesystem.

参数
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.
lenLength of the base_path.
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.
vfs_indexIndex for getting the vfs content.
返回
XF_OK if successful. XF_ERR_NO_MEM if too many VFSes are registered. XF_ERR_INVALID_ARG if given an invalid parameter.

在文件 xf_vfs.c146 行定义.

◆ xf_vfs_get_vfs_for_path()

const xf_vfs_entry_t * xf_vfs_get_vfs_for_path ( const char *  path)

Get vfs fd with given path.

参数
pathfile path prefix associated with the filesystem.
返回
Pointer to the xf_vfs_entry_t corresponding to the given path, which cannot be NULL.

在文件 xf_vfs.c414 行定义.

◆ xf_vfs_get_vfs_for_index()

const xf_vfs_entry_t * xf_vfs_get_vfs_for_index ( int  index)

Get vfs fd with given vfs index.

参数
indexVFS index.
返回
Pointer to the xf_vfs_entry_t corresponding to the given path, which cannot be NULL.

在文件 xf_vfs.c405 行定义.