[fixed]serial_v2.c兼容DFS_V2接口 (#9153)

This commit is contained in:
LaterComer 2024-07-09 12:10:08 +08:00 committed by GitHub
parent 66ff62413e
commit 4d0b048c97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 11 deletions

View File

@ -118,7 +118,11 @@ static int serial_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
return rt_device_control(device, cmd, args); return rt_device_control(device, cmd, args);
} }
static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count) #ifdef RT_USING_DFS_V2
static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
#else
static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
#endif
{ {
int size = 0; int size = 0;
rt_device_t device; rt_device_t device;
@ -143,7 +147,11 @@ static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
return size; return size;
} }
static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count) #ifdef RT_USING_DFS_V2
static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
#else
static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count)
#endif
{ {
rt_device_t device; rt_device_t device;
@ -186,15 +194,12 @@ static int serial_fops_poll(struct dfs_file *fd, struct rt_pollreq *req)
const static struct dfs_file_ops _serial_fops = const static struct dfs_file_ops _serial_fops =
{ {
serial_fops_open, .open = serial_fops_open,
serial_fops_close, .close = serial_fops_close,
serial_fops_ioctl, .ioctl = serial_fops_ioctl,
serial_fops_read, .read = serial_fops_read,
serial_fops_write, .write = serial_fops_write,
RT_NULL, /* flush */ .poll = serial_fops_poll,
RT_NULL, /* lseek */
RT_NULL, /* getdents */
serial_fops_poll,
}; };
#endif /* RT_USING_POSIX_STDIO */ #endif /* RT_USING_POSIX_STDIO */