RT-Thread RTOS  1.2.0
An open source embedded real-time operating system
Device Virtual File System
+ Collaboration diagram for Device Virtual File System:

Modules

 File Descriptor
 
 File System API
 
 File API
 
 File POSIX API
 

Functions

int dfs_init (void)
 
struct dfs_fdtable * dfs_fdtable_get (void)
 
int dfs_fdtable_dup (struct dfs_fdtable *fdt_dst, struct dfs_fdtable *fdt_src, int fd_src)
 
int dfs_fdtable_drop_fd (struct dfs_fdtable *fdt, int fd)
 
int dfs_dup_to (int oldfd, struct dfs_fdtable *fdtab)
 
int dfs_dup_from (int oldfd, struct dfs_fdtable *fdtab)
 
const char * dfs_subdir (const char *directory, const char *filename)
 
char * dfs_normalize_path (const char *directory, const char *filename)
 

Detailed Description

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.

Function Documentation

◆ dfs_init()

int dfs_init ( void  )

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_dstis the fd table for destination, if empty, use global (_fdtab).
fdt_srcis the fd table for source, if empty, use global (_fdtab).
fd_srcis 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
fdtis the fd table, if empty, use global (_fdtab).
fdis 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
oldfdis the fd in current process.
fdtabis 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
oldfdis the fd in the designate fd table.
fdtabis 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
directorythe parent directory.
filenamethe 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
directorythe parent path
filenamethe file name
Returns
the built full file path (absolute path)