skeleton.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * A skeleton of file system in Device File System
  3. */
  4. #include <rtthread.h>
  5. #include <dfs.h>
  6. #include <dfs_fs.h>
  7. #include "dfs_skt_fs.h"
  8. int dfs_skt_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data)
  9. {
  10. return DFS_STATUS_OK;
  11. }
  12. int dfs_skt_unmount(struct dfs_filesystem* fs)
  13. {
  14. return DFS_STATUS_OK;
  15. }
  16. int dfs_skt_ioctl(struct dfs_fd* file, int cmd, void* args)
  17. {
  18. return -DFS_STATUS_EIO;
  19. }
  20. int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count)
  21. {
  22. return count;
  23. }
  24. int dfs_skt_lseek(struct dfs_fd* file, rt_off_t offset)
  25. {
  26. return -DFS_STATUS_EIO;
  27. }
  28. int dfs_skt_close(struct dfs_fd* file)
  29. {
  30. return DFS_STATUS_OK;
  31. }
  32. int dfs_skt_open(struct dfs_fd* file)
  33. {
  34. return DFS_STATUS_OK;
  35. }
  36. int dfs_skt_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
  37. {
  38. return DFS_STATUS_OK;
  39. }
  40. int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count)
  41. {
  42. return count * sizeof(struct dirent);
  43. }
  44. static const struct dfs_filesystem_operation _skt_fs =
  45. {
  46. "skt",
  47. dfs_skt_mount,
  48. dfs_skt_unmount,
  49. RT_NULL,
  50. RT_NULL,
  51. dfs_skt_open,
  52. dfs_skt_close,
  53. dfs_skt_ioctl,
  54. dfs_skt_read,
  55. RT_NULL,
  56. RT_NULL,
  57. dfs_skt_lseek,
  58. dfs_skt_getdents,
  59. RT_NULL,
  60. dfs_skt_stat,
  61. RT_NULL,
  62. };
  63. int dfs_skt_init(void)
  64. {
  65. /* register rom file system */
  66. dfs_register(&_skt_fs);
  67. return 0;
  68. }