dfs_vfs.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #ifndef __DFS_VFS_H__
  10. #define __DFS_VFS_H__
  11. #include "dfs_file.h"
  12. #include "dfs_fs.h"
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. struct dfs_vfs_node
  18. {
  19. rt_list_t subnode; /* file subnode list */
  20. rt_list_t sibling; /* file sibling list */
  21. };
  22. rt_inline void dfs_vfs_init_node(struct dfs_vfs_node *node)
  23. {
  24. rt_list_init(&node->subnode);
  25. rt_list_init(&node->sibling);
  26. }
  27. rt_inline void dfs_vfs_append_node(struct dfs_vfs_node *dir, struct dfs_vfs_node *node)
  28. {
  29. rt_list_insert_after(&(dir->subnode), &(node->sibling));
  30. }
  31. rt_inline void dfs_vfs_remove_node(struct dfs_vfs_node *node)
  32. {
  33. rt_list_remove(&(node->sibling));
  34. }
  35. #define dfs_vfs_for_each_subnode(node, tmp, dir, member) \
  36. rt_list_for_each_entry_safe(node, tmp, &dir->member.subnode, member.sibling)
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif /*__DFS_VFS_H__*/