skeleton.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #include <rtthread.h>
  10. #include <dfs.h>
  11. #include <dfs_fs.h>
  12. #include <dfs_file.h>
  13. #include "dfs_skt_fs.h"
  14. int dfs_skt_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *data)
  15. {
  16. return RT_EOK;
  17. }
  18. int dfs_skt_unmount(struct dfs_filesystem *fs)
  19. {
  20. return RT_EOK;
  21. }
  22. int dfs_skt_ioctl(struct dfs_file *file, int cmd, void *args)
  23. {
  24. return -RT_EIO;
  25. }
  26. int dfs_skt_read(struct dfs_file *file, void *buf, rt_size_t count)
  27. {
  28. return count;
  29. }
  30. int dfs_skt_lseek(struct dfs_file *file, rt_off_t offset)
  31. {
  32. return -RT_EIO;
  33. }
  34. int dfs_skt_close(struct dfs_file *file)
  35. {
  36. return RT_EOK;
  37. }
  38. int dfs_skt_open(struct dfs_file *file)
  39. {
  40. return RT_EOK;
  41. }
  42. int dfs_skt_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
  43. {
  44. return RT_EOK;
  45. }
  46. int dfs_skt_getdents(struct dfs_file *file, struct dirent *dirp, rt_uint32_t count)
  47. {
  48. return count * sizeof(struct dirent);
  49. }
  50. static const struct dfs_file_ops _skt_fops =
  51. {
  52. dfs_skt_open,
  53. dfs_skt_close,
  54. dfs_skt_ioctl,
  55. dfs_skt_read,
  56. NULL, /* write */
  57. NULL, /* flush */
  58. dfs_skt_lseek,
  59. dfs_skt_getdents,
  60. };
  61. static const struct dfs_filesystem_ops _skt_fs =
  62. {
  63. "skt",
  64. DFS_FS_FLAG_DEFAULT,
  65. &_skt_fops,
  66. dfs_skt_mount,
  67. dfs_skt_unmount,
  68. NULL, /* mkfs */
  69. NULL, /* statfs */
  70. NULL, /* unlink */
  71. dfs_skt_stat,
  72. NULL, /* rename */
  73. };
  74. int dfs_skt_init(void)
  75. {
  76. /* register rom file system */
  77. dfs_register(&_skt_fs);
  78. return 0;
  79. }
  80. INIT_COMPONENT_EXPORT(dfs_skt_init);