skeleton.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * File : skeleton.c
  3. * This file is part of Device File System in RT-Thread RTOS
  4. * COPYRIGHT (C) 2004-2015, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. */
  23. #include <rtthread.h>
  24. #include <dfs.h>
  25. #include <dfs_fs.h>
  26. #include "dfs_skt_fs.h"
  27. int dfs_skt_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data)
  28. {
  29. return DFS_STATUS_OK;
  30. }
  31. int dfs_skt_unmount(struct dfs_filesystem* fs)
  32. {
  33. return DFS_STATUS_OK;
  34. }
  35. int dfs_skt_ioctl(struct dfs_fd* file, int cmd, void* args)
  36. {
  37. return -DFS_STATUS_EIO;
  38. }
  39. int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count)
  40. {
  41. return count;
  42. }
  43. int dfs_skt_lseek(struct dfs_fd* file, rt_off_t offset)
  44. {
  45. return -DFS_STATUS_EIO;
  46. }
  47. int dfs_skt_close(struct dfs_fd* file)
  48. {
  49. return DFS_STATUS_OK;
  50. }
  51. int dfs_skt_open(struct dfs_fd* file)
  52. {
  53. return DFS_STATUS_OK;
  54. }
  55. int dfs_skt_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
  56. {
  57. return DFS_STATUS_OK;
  58. }
  59. int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count)
  60. {
  61. return count * sizeof(struct dirent);
  62. }
  63. static const struct dfs_filesystem_operation _skt_fs =
  64. {
  65. "skt",
  66. DFS_FS_FLAG_DEFAULT,
  67. dfs_skt_mount,
  68. dfs_skt_unmount,
  69. RT_NULL,
  70. RT_NULL,
  71. dfs_skt_open,
  72. dfs_skt_close,
  73. dfs_skt_ioctl,
  74. dfs_skt_read,
  75. RT_NULL,
  76. RT_NULL,
  77. dfs_skt_lseek,
  78. dfs_skt_getdents,
  79. RT_NULL,
  80. dfs_skt_stat,
  81. RT_NULL,
  82. };
  83. int dfs_skt_init(void)
  84. {
  85. /* register rom file system */
  86. dfs_register(&_skt_fs);
  87. return 0;
  88. }
  89. INIT_FS_EXPORT(dfs_skt_init);