DFS is a virtual file system in RT-Thread RTOS.
The DFS (Device Virtual File System) is a vfs file system of RT-Thread RTOS, which is focused on embedded device. VFS is an abstraction layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way.
Figure 4: Device Virtual File System Architecture
The DFS specifies an interface between the kernel and a concrete file system. Therefore, it is easy to add support for new file system types to the kernel simply by fulfilling the interface.
◆ dfs_init()
this function will initialize device file system.
◆ dfs_fdtable_get()
struct dfs_fdtable* dfs_fdtable_get |
( |
void |
| ) |
|
This function will get the file descriptor table of current process.
◆ dfs_fdtable_dup()
int dfs_fdtable_dup |
( |
struct dfs_fdtable * |
fdt_dst, |
|
|
struct dfs_fdtable * |
fdt_src, |
|
|
int |
fd_src |
|
) |
| |
Dup the specified fd_src from fdt_src to fdt_dst.
- Parameters
-
fdt_dst | is the fd table for destination, if empty, use global (_fdtab). |
fdt_src | is the fd table for source, if empty, use global (_fdtab). |
fd_src | is the fd in the designate fdt_src table. |
- Returns
- -1 on failed or the allocated file descriptor.
◆ dfs_fdtable_drop_fd()
int dfs_fdtable_drop_fd |
( |
struct dfs_fdtable * |
fdt, |
|
|
int |
fd |
|
) |
| |
drop fd from the fd table.
- Parameters
-
fdt | is the fd table, if empty, use global (_fdtab). |
fd | is the fd in the designate fd table. |
- Returns
- -1 on failed the drop file descriptor.
◆ dfs_dup_to()
int dfs_dup_to |
( |
int |
oldfd, |
|
|
struct dfs_fdtable * |
fdtab |
|
) |
| |
The fd in the current process dup to designate fd table.
- Parameters
-
oldfd | is the fd in current process. |
fdtab | is the fd table to dup, if empty, use global (_fdtab). |
- Returns
- -1 on failed or the allocated file descriptor.
◆ dfs_dup_from()
int dfs_dup_from |
( |
int |
oldfd, |
|
|
struct dfs_fdtable * |
fdtab |
|
) |
| |
The fd in the designate fd table dup to current process.
- Parameters
-
oldfd | is the fd in the designate fd table. |
fdtab | is the fd table for oldfd, if empty, use global (_fdtab). |
- Returns
- -1 on failed or the allocated file descriptor.
◆ dfs_subdir()
const char* dfs_subdir |
( |
const char * |
directory, |
|
|
const char * |
filename |
|
) |
| |
this function will return a sub-path name under directory.
- Parameters
-
directory | the parent directory. |
filename | the filename. |
- Returns
- the subdir pointer in filename
◆ dfs_normalize_path()
char* dfs_normalize_path |
( |
const char * |
directory, |
|
|
const char * |
filename |
|
) |
| |
this function will normalize a path according to specified parent directory and file name.
- Parameters
-
directory | the parent path |
filename | the file name |
- Returns
- the built full file path (absolute path)