skeleton.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_file.h>
  27. #include "dfs_skt_fs.h"
  28. int dfs_skt_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data)
  29. {
  30. return RT_EOK;
  31. }
  32. int dfs_skt_unmount(struct dfs_filesystem* fs)
  33. {
  34. return RT_EOK;
  35. }
  36. int dfs_skt_ioctl(struct dfs_fd* file, int cmd, void* args)
  37. {
  38. return -RT_EIO;
  39. }
  40. int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count)
  41. {
  42. return count;
  43. }
  44. int dfs_skt_lseek(struct dfs_fd* file, rt_off_t offset)
  45. {
  46. return -RT_EIO;
  47. }
  48. int dfs_skt_close(struct dfs_fd* file)
  49. {
  50. return RT_EOK;
  51. }
  52. int dfs_skt_open(struct dfs_fd* file)
  53. {
  54. return RT_EOK;
  55. }
  56. int dfs_skt_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
  57. {
  58. return RT_EOK;
  59. }
  60. int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count)
  61. {
  62. return count * sizeof(struct dirent);
  63. }
  64. static const struct dfs_file_ops _skt_fops =
  65. {
  66. dfs_skt_open,
  67. dfs_skt_close,
  68. dfs_skt_ioctl,
  69. dfs_skt_read,
  70. NULL, /* write */
  71. NULL, /* flush */
  72. dfs_skt_lseek,
  73. dfs_skt_getdents,
  74. };
  75. static const struct dfs_filesystem_ops _skt_fs =
  76. {
  77. "skt",
  78. DFS_FS_FLAG_DEFAULT,
  79. &_skt_fops,
  80. dfs_skt_mount,
  81. dfs_skt_unmount,
  82. NULL, /* mkfs */
  83. NULL, /* statfs */
  84. NULL, /* unlink */
  85. dfs_skt_stat,
  86. NULL, /* rename */
  87. };
  88. int dfs_skt_init(void)
  89. {
  90. /* register rom file system */
  91. dfs_register(&_skt_fs);
  92. return 0;
  93. }
  94. INIT_COMPONENT_EXPORT(dfs_skt_init);