-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[components][dfs]separate dfs fs data structure ops #9205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * Copyright (c) 2006-2024, RT-Thread Development Team | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Change Logs: | ||
| * Date Author Notes | ||
| */ | ||
|
|
||
| #ifndef __DFS_VFS_H__ | ||
| #define __DFS_VFS_H__ | ||
|
|
||
| #include "dfs_file.h" | ||
| #include "dfs_fs.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| struct dfs_vfs_node | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dfs = vfs,这样就变得重复了
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个目的是抽出一个通用的虚拟文件系统管理层。逻辑是很多调试、系统管理用的文件系统,devfs、procfs、sysfs、debugfs 等本质都是基于 tmpfs 衍生出来的,但现在 devfs、tmpfs、procfs 都有单独的文件管理实现。这不利于维护。所以希望单独抽出一个层次的抽象,专注于虚拟文件系统的文件与目录管理。 命名确实可以再讨论一下。比如
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 那我改libvfs吗? |
||
| { | ||
| rt_list_t subnode; /* file subnode list */ | ||
| rt_list_t sibling; /* file sibling list */ | ||
| }; | ||
|
|
||
| rt_inline void dfs_vfs_init_node(struct dfs_vfs_node *node) | ||
| { | ||
| rt_list_init(&node->subnode); | ||
| rt_list_init(&node->sibling); | ||
| } | ||
|
|
||
| rt_inline void dfs_vfs_append_node(struct dfs_vfs_node *dir, struct dfs_vfs_node *node) | ||
| { | ||
| rt_list_insert_after(&(dir->subnode), &(node->sibling)); | ||
| } | ||
|
|
||
| rt_inline void dfs_vfs_remove_node(struct dfs_vfs_node *node) | ||
| { | ||
| rt_list_remove(&(node->sibling)); | ||
| } | ||
|
|
||
| #define dfs_vfs_for_each_subnode(node, tmp, dir, member) \ | ||
| rt_list_for_each_entry_safe(node, tmp, &dir->member.subnode, member.sibling) | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /*__DFS_VFS_H__*/ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块代码本身也有些问题,不应该有
#if 0的代码的。这次提交也一起拿掉吧