RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
|
专题 | |
File Descriptor | |
File System API | |
File API | |
File POSIX API | |
函数 | |
rt_err_t | dfs_file_lock (void) |
void | dfs_file_unlock (void) |
int | dfs_init (void) |
INIT_PREV_EXPORT (dfs_init) | |
void | fdt_fd_release (struct dfs_fdtable *fdt, int fd) |
int | fdt_fd_associate_file (struct dfs_fdtable *fdt, int fd, struct dfs_file *file) |
int | fd_new (void) |
struct dfs_file * | fd_get (int fd) |
struct dfs_fdtable * | dfs_fdtable_get (void) |
struct dfs_fdtable * | dfs_fdtable_get_global (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 (int oldfd, int startfd) |
int | dfs_dup_to (int oldfd, struct dfs_fdtable *fdtab) |
int | dfs_dup_from (int oldfd, struct dfs_fdtable *fdtab) |
int | sys_dup (int oldfd) |
rt_err_t | sys_dup2 (int oldfd, int newfd) |
const char * | dfs_subdir (const char *directory, const char *filename) |
RTM_EXPORT (dfs_subdir) | |
char * | dfs_normalize_path (const char *directory, const char *filename) |
RTM_EXPORT (dfs_normalize_path) | |
int | list_fd (void) |
MSH_CMD_EXPORT (list_fd, list file descriptor) | |
int | dfs_fd_dump (int argc, char **argv) |
MSH_CMD_EXPORT_ALIAS (dfs_fd_dump, fd_dump, fd dump) | |
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.
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.
rt_err_t dfs_file_lock | ( | void | ) |
引用了 rt_mutex_take() , 以及 RT_WAITING_FOREVER.
void dfs_file_unlock | ( | void | ) |
引用了 rt_mutex_release().
int dfs_init | ( | void | ) |
this function will initialize device file system.
引用了 dfs_dentry_init(), LOG_E, RT_IPC_FLAG_FIFO, rt_mutex_init() , 以及 RT_TRUE.
INIT_PREV_EXPORT | ( | dfs_init | ) |
void fdt_fd_release | ( | struct dfs_fdtable * | fdt, |
int | fd ) |
引用了 dfs_fdtable::fds, fdt_get_file(), dfs_file::mmap_context, dfs_file::pos_lock, dfs_file::ref_count, rt_atomic_sub, rt_free(), rt_mutex_detach() , 以及 RT_NULL.
int fdt_fd_associate_file | ( | struct dfs_fdtable * | fdt, |
int | fd, | ||
struct dfs_file * | file ) |
引用了 dfs_file_lock(), dfs_file_unlock(), dfs_fdtable::fds, dfs_fdtable::maxfd, dfs_file::ref_count , 以及 rt_atomic_add.
int fd_new | ( | void | ) |
引用了 dfs_fdtable_get() , 以及 fdt_fd_new().
struct dfs_file * fd_get | ( | int | fd | ) |
struct dfs_fdtable * dfs_fdtable_get | ( | void | ) |
This function will get the file descriptor table of current process.
引用了 rt_thread_self().
struct dfs_fdtable * dfs_fdtable_get_global | ( | void | ) |
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.
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. |
引用了 dfs_file::data, dfs_file::dentry, dfs_dentry_ref(), dfs_file_lock(), dfs_file_unlock(), dfs_fdtable::fds, fdt_fd_new(), dfs_file::flags, dfs_file::fops, dfs_fdtable::maxfd, dfs_file::mmap_context, dfs_file::mode, dfs_vnode::ref_count, rt_atomic_add, RT_NULL , 以及 dfs_file::vnode.
int dfs_fdtable_drop_fd | ( | struct dfs_fdtable * | fdt, |
int | fd ) |
drop fd from the fd table.
fdt | is the fd table, if empty, use global (_fdtab). |
fd | is the fd in the designate fd table. |
引用了 dfs_file_close(), dfs_file_lock(), dfs_file_unlock(), dfs_fdtable::fds , 以及 fdt_fd_release().
int dfs_dup | ( | int | oldfd, |
int | startfd ) |
引用了 dfs_fdtable_get(), dfs_file_lock(), dfs_file_unlock(), dfs_fdtable::fds, dfs_fdtable::maxfd, dfs_file::ref_count , 以及 rt_atomic_add.
int dfs_dup_to | ( | int | oldfd, |
struct dfs_fdtable * | fdtab ) |
The fd in the current process dup to designate fd table.
oldfd | is the fd in current process. |
fdtab | is the fd table to dup, if empty, use global (_fdtab). |
引用了 dfs_fdtable_get(), dfs_file_lock(), dfs_file_unlock(), DFS_STDIO_OFFSET, dfs_fdtable::fds, dfs_fdtable::maxfd, dfs_file::ref_count , 以及 rt_atomic_add.
int dfs_dup_from | ( | int | oldfd, |
struct dfs_fdtable * | fdtab ) |
The fd in the designate fd table dup to current process.
oldfd | is the fd in the designate fd table. |
fdtab | is the fd table for oldfd, if empty, use global (_fdtab). |
引用了 dfs_file::data, dfs_file::dentry, dfs_dentry_ref(), dfs_file_close(), dfs_file_lock(), dfs_file_unlock(), fd_get(), fd_new(), dfs_fdtable::fds, fdt_fd_release(), dfs_file::flags, dfs_file::fops, dfs_fdtable::maxfd, dfs_file::mmap_context, dfs_file::mode, RT_NULL , 以及 dfs_file::vnode.
int sys_dup | ( | int | oldfd | ) |
引用了 dfs_dup(), dfs_fdtable_get() , 以及 DFS_STDIO_OFFSET.
rt_err_t sys_dup2 | ( | int | oldfd, |
int | newfd ) |
引用了 dfs_fdtable_get(), dfs_file_close(), dfs_file_lock(), dfs_file_unlock(), fd_release(), dfs_fdtable::fds, dfs_fdtable::maxfd, dfs_file::ref_count , 以及 rt_atomic_add.
const char * dfs_subdir | ( | const char * | directory, |
const char * | filename ) |
this function will return a sub-path name under directory.
directory | the parent directory. |
filename | the filename. |
RTM_EXPORT | ( | dfs_subdir | ) |
char * dfs_normalize_path | ( | const char * | directory, |
const char * | filename ) |
this function will normalize a path according to specified parent directory and file name.
directory | the parent path |
filename | the file name |
引用了 DFS_PATH_MAX, NO_WORKING_DIR, RT_ASSERT, rt_free(), rt_kprintf, rt_malloc() , 以及 working_directory.
RTM_EXPORT | ( | dfs_normalize_path | ) |
int list_fd | ( | void | ) |
引用了 dfs_file::dentry, dfs_fdtable_get(), dfs_fdtable::fds, dfs_mnt::fullpath, dfs_file::magic, dfs_fdtable::maxfd, dfs_dentry::mnt, dfs_dentry::pathname, dfs_file::ref_count, rt_enter_critical(), rt_exit_critical(), rt_kprintf, dfs_vnode::type , 以及 dfs_file::vnode.
int dfs_fd_dump | ( | int | argc, |
char ** | argv ) |
引用了 dfs_file::dentry, dfs_dentry_full_path(), dfs_file_lock(), dfs_file_unlock(), dfs_dentry::pathname, dfs_file::ref_count, rt_atomic_load , 以及 rt_free().
MSH_CMD_EXPORT_ALIAS | ( | dfs_fd_dump | , |
fd_dump | , | ||
fd | dump ) |