skeleton.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_FS_FLAG_DEFAULT,
  48. dfs_skt_mount,
  49. dfs_skt_unmount,
  50. RT_NULL,
  51. RT_NULL,
  52. dfs_skt_open,
  53. dfs_skt_close,
  54. dfs_skt_ioctl,
  55. dfs_skt_read,
  56. RT_NULL,
  57. RT_NULL,
  58. dfs_skt_lseek,
  59. dfs_skt_getdents,
  60. RT_NULL,
  61. dfs_skt_stat,
  62. RT_NULL,
  63. };
  64. int dfs_skt_init(void)
  65. {
  66. /* register rom file system */
  67. dfs_register(&_skt_fs);
  68. return 0;
  69. }