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