dfs_tmpfs.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-10-24 flybreak the first version
  9. */
  10. #ifndef __DFS_TMPFS_H__
  11. #define __DFS_TMPFS_H__
  12. #include <rtthread.h>
  13. #define TMPFS_NAME_MAX 32
  14. #define TMPFS_MAGIC 0x0B0B0B0B
  15. #define TMPFS_TYPE_FILE 0x00
  16. #define TMPFS_TYPE_DIR 0x01
  17. struct tmpfs_sb;
  18. struct tmpfs_file
  19. {
  20. rt_uint32_t type; /* file type */
  21. char name[TMPFS_NAME_MAX]; /* file name */
  22. rt_list_t subdirs; /* file subdir list */
  23. rt_list_t sibling; /* file sibling list */
  24. struct tmpfs_sb *sb; /* superblock ptr */
  25. rt_uint8_t *data; /* file date ptr */
  26. rt_size_t size; /* file size */
  27. };
  28. struct tmpfs_sb
  29. {
  30. rt_uint32_t magic; /* TMPFS_MAGIC */
  31. struct tmpfs_file root; /* root dir */
  32. rt_size_t df_size; /* df size */
  33. rt_list_t sibling; /* sb sibling list */
  34. struct rt_spinlock lock; /* tmpfs lock */
  35. };
  36. int dfs_tmpfs_init(void);
  37. #endif