dfs_ramfs.h 883 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * File : dfs_ramfs.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2011, Shanghai Real-Thread Technology Co., Ltd
  5. *
  6. * All rights reserved.
  7. *
  8. * Change Logs:
  9. * Date Author Notes
  10. * 2013-04-15 Bernard the first version
  11. * 2013-05-05 Bernard remove CRC for ramfs persistence
  12. */
  13. #ifndef __DFS_ROMFS_H__
  14. #define __DFS_ROMFS_H__
  15. #include <rtthread.h>
  16. #include <rtservice.h>
  17. #define RAMFS_NAME_MAX 32
  18. #define RAMFS_MAGIC 0x0A0A0A0A
  19. struct ramfs_dirent
  20. {
  21. rt_list_t list;
  22. char name[RAMFS_NAME_MAX]; /* dirent name */
  23. rt_uint8_t* data;
  24. rt_size_t size; /* file size */
  25. };
  26. /**
  27. * DFS ramfs object
  28. */
  29. struct dfs_ramfs
  30. {
  31. rt_uint32_t magic;
  32. struct rt_memheap memheap;
  33. struct ramfs_dirent root;
  34. };
  35. int dfs_ramfs_init(void);
  36. struct dfs_ramfs* dfs_ramfs_create(rt_uint8_t* pool, rt_size_t size);
  37. #endif