@@ -118,7 +118,11 @@ static int serial_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
118
118
return rt_device_control (device , cmd , args );
119
119
}
120
120
121
- static int serial_fops_read (struct dfs_file * fd , void * buf , size_t count )
121
+ #ifdef RT_USING_DFS_V2
122
+ static ssize_t serial_fops_read (struct dfs_file * fd , void * buf , size_t count , off_t * pos )
123
+ #else
124
+ static ssize_t serial_fops_read (struct dfs_file * fd , void * buf , size_t count )
125
+ #endif
122
126
{
123
127
int size = 0 ;
124
128
rt_device_t device ;
@@ -143,7 +147,11 @@ static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
143
147
return size ;
144
148
}
145
149
146
- static int serial_fops_write (struct dfs_file * fd , const void * buf , size_t count )
150
+ #ifdef RT_USING_DFS_V2
151
+ static ssize_t serial_fops_write (struct dfs_file * fd , const void * buf , size_t count , off_t * pos )
152
+ #else
153
+ static ssize_t serial_fops_write (struct dfs_file * fd , const void * buf , size_t count )
154
+ #endif
147
155
{
148
156
rt_device_t device ;
149
157
@@ -186,15 +194,12 @@ static int serial_fops_poll(struct dfs_file *fd, struct rt_pollreq *req)
186
194
187
195
const static struct dfs_file_ops _serial_fops =
188
196
{
189
- serial_fops_open ,
190
- serial_fops_close ,
191
- serial_fops_ioctl ,
192
- serial_fops_read ,
193
- serial_fops_write ,
194
- RT_NULL , /* flush */
195
- RT_NULL , /* lseek */
196
- RT_NULL , /* getdents */
197
- serial_fops_poll ,
197
+ .open = serial_fops_open ,
198
+ .close = serial_fops_close ,
199
+ .ioctl = serial_fops_ioctl ,
200
+ .read = serial_fops_read ,
201
+ .write = serial_fops_write ,
202
+ .poll = serial_fops_poll ,
198
203
};
199
204
#endif /* RT_USING_POSIX_STDIO */
200
205
0 commit comments