diff --git a/components/dfs/dfs_v1/filesystems/devfs/devfs.c b/components/dfs/dfs_v1/filesystems/devfs/devfs.c index 0779a594d0..993f967131 100644 --- a/components/dfs/dfs_v1/filesystems/devfs/devfs.c +++ b/components/dfs/dfs_v1/filesystems/devfs/devfs.c @@ -61,7 +61,7 @@ int dfs_device_fs_ioctl(struct dfs_file *file, int cmd, void *args) return result; } -int dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count) +ssize_t dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count) { int result; rt_device_t dev_id; @@ -82,7 +82,7 @@ int dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count) return result; } -int dfs_device_fs_write(struct dfs_file *file, const void *buf, size_t count) +ssize_t dfs_device_fs_write(struct dfs_file *file, const void *buf, size_t count) { int result; rt_device_t dev_id; diff --git a/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c b/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c index a2a6258f36..e9680e07bf 100644 --- a/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c @@ -537,7 +537,7 @@ int dfs_elm_ioctl(struct dfs_file *file, int cmd, void *args) return -ENOSYS; } -int dfs_elm_read(struct dfs_file *file, void *buf, size_t len) +ssize_t dfs_elm_read(struct dfs_file *file, void *buf, size_t len) { FIL *fd; FRESULT result; @@ -560,7 +560,7 @@ int dfs_elm_read(struct dfs_file *file, void *buf, size_t len) return elm_result_to_dfs(result); } -int dfs_elm_write(struct dfs_file *file, const void *buf, size_t len) +ssize_t dfs_elm_write(struct dfs_file *file, const void *buf, size_t len) { FIL *fd; FRESULT result; @@ -596,7 +596,7 @@ int dfs_elm_flush(struct dfs_file *file) return elm_result_to_dfs(result); } -int dfs_elm_lseek(struct dfs_file *file, off_t offset) +off_t dfs_elm_lseek(struct dfs_file *file, off_t offset) { FRESULT result = FR_OK; if (file->vnode->type == FT_REGULAR) diff --git a/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c b/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c index 8c80b5690e..9ecb0819c4 100644 --- a/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c @@ -146,7 +146,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch return NULL; } -int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count) +ssize_t dfs_romfs_read(struct dfs_file *file, void *buf, size_t count) { rt_size_t length; struct romfs_dirent *dirent; @@ -173,7 +173,7 @@ int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count) return length; } -int dfs_romfs_lseek(struct dfs_file *file, off_t offset) +off_t dfs_romfs_lseek(struct dfs_file *file, off_t offset) { if (offset <= file->vnode->size) { diff --git a/components/dfs/dfs_v1/filesystems/tmpfs/dfs_tmpfs.c b/components/dfs/dfs_v1/filesystems/tmpfs/dfs_tmpfs.c index d22eb0e016..f690d5750f 100644 --- a/components/dfs/dfs_v1/filesystems/tmpfs/dfs_tmpfs.c +++ b/components/dfs/dfs_v1/filesystems/tmpfs/dfs_tmpfs.c @@ -267,7 +267,7 @@ find_subpath: return NULL; } -int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count) +ssize_t dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count) { rt_size_t length; struct tmpfs_file *d_file; @@ -290,7 +290,7 @@ int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count) } -int dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count) +ssize_t dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count) { struct tmpfs_file *d_file; struct tmpfs_sb *superblock; @@ -328,7 +328,7 @@ int dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count) return count; } -int dfs_tmpfs_lseek(struct dfs_file *file, off_t offset) +off_t dfs_tmpfs_lseek(struct dfs_file *file, off_t offset) { if (offset <= (off_t)file->vnode->size) { diff --git a/components/dfs/dfs_v1/include/dfs_file.h b/components/dfs/dfs_v1/include/dfs_file.h index 971089f21b..d36b2ce89b 100644 --- a/components/dfs/dfs_v1/include/dfs_file.h +++ b/components/dfs/dfs_v1/include/dfs_file.h @@ -25,10 +25,10 @@ struct dfs_file_ops int (*open) (struct dfs_file *fd); int (*close) (struct dfs_file *fd); int (*ioctl) (struct dfs_file *fd, int cmd, void *args); - int (*read) (struct dfs_file *fd, void *buf, size_t count); - int (*write) (struct dfs_file *fd, const void *buf, size_t count); + ssize_t (*read) (struct dfs_file *fd, void *buf, size_t count); + ssize_t (*write) (struct dfs_file *fd, const void *buf, size_t count); int (*flush) (struct dfs_file *fd); - int (*lseek) (struct dfs_file *fd, off_t offset); + off_t (*lseek) (struct dfs_file *fd, off_t offset); int (*getdents) (struct dfs_file *fd, struct dirent *dirp, uint32_t count); int (*poll) (struct dfs_file *fd, struct rt_pollreq *req); @@ -82,12 +82,12 @@ int dfs_file_is_open(const char *pathname); int dfs_file_open(struct dfs_file *fd, const char *path, int flags); int dfs_file_close(struct dfs_file *fd); int dfs_file_ioctl(struct dfs_file *fd, int cmd, void *args); -int dfs_file_read(struct dfs_file *fd, void *buf, size_t len); +ssize_t dfs_file_read(struct dfs_file *fd, void *buf, size_t len); int dfs_file_getdents(struct dfs_file *fd, struct dirent *dirp, size_t nbytes); int dfs_file_unlink(const char *path); -int dfs_file_write(struct dfs_file *fd, const void *buf, size_t len); +ssize_t dfs_file_write(struct dfs_file *fd, const void *buf, size_t len); int dfs_file_flush(struct dfs_file *fd); -int dfs_file_lseek(struct dfs_file *fd, off_t offset); +off_t dfs_file_lseek(struct dfs_file *fd, off_t offset); int dfs_file_stat(const char *path, struct stat *buf); int dfs_file_rename(const char *oldpath, const char *newpath); diff --git a/components/dfs/dfs_v1/src/dfs_file.c b/components/dfs/dfs_v1/src/dfs_file.c index 6dbec6e129..094e26c323 100644 --- a/components/dfs/dfs_v1/src/dfs_file.c +++ b/components/dfs/dfs_v1/src/dfs_file.c @@ -389,7 +389,7 @@ int dfs_file_ioctl(struct dfs_file *fd, int cmd, void *args) * * @return the actual read data bytes or 0 on end of file or failed. */ -int dfs_file_read(struct dfs_file *fd, void *buf, size_t len) +ssize_t dfs_file_read(struct dfs_file *fd, void *buf, size_t len) { int result = 0; @@ -503,7 +503,7 @@ __exit: * * @return the actual written data length. */ -int dfs_file_write(struct dfs_file *fd, const void *buf, size_t len) +ssize_t dfs_file_write(struct dfs_file *fd, const void *buf, size_t len) { if (fd == NULL) { @@ -544,7 +544,7 @@ int dfs_file_flush(struct dfs_file *fd) * * @return the current position after seek. */ -int dfs_file_lseek(struct dfs_file *fd, off_t offset) +off_t dfs_file_lseek(struct dfs_file *fd, off_t offset) { int result; diff --git a/components/dfs/dfs_v2/filesystems/devfs/devfs.c b/components/dfs/dfs_v2/filesystems/devfs/devfs.c index 0353a20527..cfd47cdcce 100644 --- a/components/dfs/dfs_v2/filesystems/devfs/devfs.c +++ b/components/dfs/dfs_v2/filesystems/devfs/devfs.c @@ -30,9 +30,9 @@ struct device_dirent int dfs_devfs_open(struct dfs_file *file); int dfs_devfs_close(struct dfs_file *file); -int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence); -int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos); -int dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos); +off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence); +ssize_t dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos); +ssize_t dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos); int dfs_devfs_ioctl(struct dfs_file *file, int cmd, void *args); int dfs_devfs_getdents(struct dfs_file *file, struct dirent *dirp, uint32_t count); static int dfs_devfs_poll(struct dfs_file *file, struct rt_pollreq *req); @@ -275,7 +275,7 @@ int dfs_devfs_ioctl(struct dfs_file *file, int cmd, void *args) return result; } -int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) +ssize_t dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) { int result; rt_device_t dev_id; @@ -296,7 +296,7 @@ int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) return result; } -int dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) +ssize_t dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) { int result; rt_device_t dev_id; diff --git a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c index f4f27bd273..5e0280d941 100644 --- a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c @@ -557,7 +557,7 @@ int dfs_elm_ioctl(struct dfs_file *file, int cmd, void *args) return -ENOSYS; } -int dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos) +ssize_t dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos) { FIL *fd; FRESULT result; @@ -581,7 +581,7 @@ int dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos) return elm_result_to_dfs(result); } -int dfs_elm_write(struct dfs_file *file, const void *buf, size_t len, off_t *pos) +ssize_t dfs_elm_write(struct dfs_file *file, const void *buf, size_t len, off_t *pos) { FIL *fd; FRESULT result; @@ -618,7 +618,7 @@ int dfs_elm_flush(struct dfs_file *file) return elm_result_to_dfs(result); } -int dfs_elm_lseek(struct dfs_file *file, off_t offset, int wherece) +off_t dfs_elm_lseek(struct dfs_file *file, off_t offset, int wherece) { FRESULT result = FR_OK; if (file->vnode->type == FT_REGULAR) diff --git a/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c b/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c index 4e9502fc10..81382ae69b 100644 --- a/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c @@ -228,7 +228,7 @@ static int dfs_romfs_free_vnode(struct dfs_vnode *vnode) return 0; } -static int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) +static ssize_t dfs_romfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) { rt_size_t length; struct romfs_dirent *dirent; diff --git a/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c b/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c index 32ddad821c..752fbc2513 100644 --- a/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c +++ b/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c @@ -272,7 +272,7 @@ find_subpath: return NULL; } -static int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) +static ssize_t dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) { rt_size_t length; struct tmpfs_file *d_file; @@ -295,7 +295,7 @@ static int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t return length; } -static int dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) +static ssize_t dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) { struct tmpfs_file *d_file; struct tmpfs_sb *superblock; @@ -334,7 +334,7 @@ static int dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count, return count; } -static int dfs_tmpfs_lseek(struct dfs_file *file, off_t offset, int wherece) +static off_t dfs_tmpfs_lseek(struct dfs_file *file, off_t offset, int wherece) { if (offset <= (off_t)file->vnode->size) { diff --git a/components/dfs/dfs_v2/include/dfs_file.h b/components/dfs/dfs_v2/include/dfs_file.h index 7dbe366fe9..11793b2ad7 100644 --- a/components/dfs/dfs_v2/include/dfs_file.h +++ b/components/dfs/dfs_v2/include/dfs_file.h @@ -39,10 +39,10 @@ struct dfs_file_ops int (*open)(struct dfs_file *file); int (*close)(struct dfs_file *file); int (*ioctl)(struct dfs_file *file, int cmd, void *arg); - int (*read)(struct dfs_file *file, void *buf, size_t count, off_t *pos); - int (*write)(struct dfs_file *file, const void *buf, size_t count, off_t *pos); + ssize_t (*read)(struct dfs_file *file, void *buf, size_t count, off_t *pos); + ssize_t (*write)(struct dfs_file *file, const void *buf, size_t count, off_t *pos); int (*flush)(struct dfs_file *file); - int (*lseek)(struct dfs_file *file, off_t offset, int wherece); + off_t (*lseek)(struct dfs_file *file, off_t offset, int wherece); int (*truncate)(struct dfs_file *file, off_t offset); int (*getdents)(struct dfs_file *file, struct dirent *dirp, uint32_t count); int (*poll)(struct dfs_file *file, struct rt_pollreq *req); @@ -142,7 +142,7 @@ int dfs_file_close(struct dfs_file *file); ssize_t dfs_file_read(struct dfs_file *file, void *buf, size_t len); ssize_t dfs_file_write(struct dfs_file *file, const void *buf, size_t len); -int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence); +off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence); off_t dfs_file_lseek(struct dfs_file *file, off_t offset, int wherece); int dfs_file_stat(const char *path, struct stat *buf); int dfs_file_lstat(const char *path, struct stat *buf); diff --git a/components/dfs/dfs_v2/src/dfs_file.c b/components/dfs/dfs_v2/src/dfs_file.c index 0bc08bf562..9ed0a2b2c7 100644 --- a/components/dfs/dfs_v2/src/dfs_file.c +++ b/components/dfs/dfs_v2/src/dfs_file.c @@ -652,7 +652,7 @@ ssize_t dfs_file_write(struct dfs_file *file, const void *buf, size_t len) return ret; } -int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence) +off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence) { off_t foffset; diff --git a/components/drivers/ipc/pipe.c b/components/drivers/ipc/pipe.c index d1e8665963..acd0c2def6 100644 --- a/components/drivers/ipc/pipe.c +++ b/components/drivers/ipc/pipe.c @@ -203,9 +203,9 @@ static int pipe_fops_ioctl(struct dfs_file *fd, int cmd, void *args) * When the return value is -EAGAIN, it means there are no data to be read. */ #ifdef RT_USING_DFS_V2 -static int pipe_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) +static ssize_t pipe_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) #else -static int pipe_fops_read(struct dfs_file *fd, void *buf, size_t count) +static ssize_t pipe_fops_read(struct dfs_file *fd, void *buf, size_t count) #endif { int len = 0; @@ -261,9 +261,9 @@ out: * When the return value is -EPIPE, it means there is no thread that has the pipe open for reading. */ #ifdef RT_USING_DFS_V2 -static int pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) +static ssize_t pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) #else -static int pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count) +static ssize_t pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count) #endif { int len; diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index fd904078f7..1777a231b3 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -136,9 +136,9 @@ static int serial_fops_ioctl(struct dfs_file *fd, int cmd, void *args) } #ifdef RT_USING_DFS_V2 -static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) +static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) #else -static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count) +static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count) #endif { int size = 0; @@ -174,9 +174,9 @@ static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count) } #ifdef RT_USING_DFS_V2 -static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) +static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) #else -static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count) +static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count) #endif { rt_device_t device; diff --git a/components/drivers/tty/tty.c b/components/drivers/tty/tty.c index 53f7ae1e59..30ab00d890 100644 --- a/components/drivers/tty/tty.c +++ b/components/drivers/tty/tty.c @@ -306,9 +306,9 @@ static int tty_ioctl(struct dfs_file *fd, int cmd, void *args) } #ifdef RT_USING_DFS_V2 -static int tty_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) +static ssize_t tty_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos) #else -static int tty_read(struct dfs_file *fd, void *buf, size_t count) +static ssize_t tty_read(struct dfs_file *fd, void *buf, size_t count) #endif { int ret = 0; @@ -327,9 +327,9 @@ static int tty_read(struct dfs_file *fd, void *buf, size_t count) } #ifdef RT_USING_DFS_V2 -static int tty_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) +static ssize_t tty_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos) #else -static int tty_write(struct dfs_file *fd, const void *buf, size_t count ) +static ssize_t tty_write(struct dfs_file *fd, const void *buf, size_t count ) #endif { int ret = 0; diff --git a/components/net/sal/dfs_net/dfs_net.c b/components/net/sal/dfs_net/dfs_net.c index 8179abdcb5..cae03c40a1 100644 --- a/components/net/sal/dfs_net/dfs_net.c +++ b/components/net/sal/dfs_net/dfs_net.c @@ -47,9 +47,9 @@ static int dfs_net_ioctl(struct dfs_file* file, int cmd, void* args) } #ifdef RT_USING_DFS_V2 -static int dfs_net_read(struct dfs_file* file, void *buf, size_t count, off_t *pos) +static ssize_t dfs_net_read(struct dfs_file* file, void *buf, size_t count, off_t *pos) #else -static int dfs_net_read(struct dfs_file* file, void *buf, size_t count) +static ssize_t dfs_net_read(struct dfs_file* file, void *buf, size_t count) #endif { int ret; @@ -66,9 +66,9 @@ static int dfs_net_read(struct dfs_file* file, void *buf, size_t count) } #ifdef RT_USING_DFS_V2 -static int dfs_net_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) +static ssize_t dfs_net_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos) #else -static int dfs_net_write(struct dfs_file *file, const void *buf, size_t count) +static ssize_t dfs_net_write(struct dfs_file *file, const void *buf, size_t count) #endif { int ret;