From 9678bdc3ef1a2494a15ea19b67917165bbdd90e1 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Sun, 18 Nov 2012 14:31:04 +0400 Subject: [PATCH] vfs_s_subclass::linear_read: return ssize_t instead of int. Signed-off-by: Andrew Borodin --- lib/vfs/direntry.c | 3 ++- lib/vfs/xdirentry.h | 2 +- src/vfs/fish/fish.c | 3 +-- src/vfs/ftpfs/ftpfs.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/vfs/direntry.c b/lib/vfs/direntry.c index 5607987dc..01515f699 100644 --- a/lib/vfs/direntry.c +++ b/lib/vfs/direntry.c @@ -1338,7 +1338,8 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino) /* If you want reget, you'll have to open file with O_LINEAR */ off_t total = 0; char buffer[8192]; - int handle, n; + int handle; + ssize_t n; off_t stat_size = ino->st.st_size; vfs_file_handler_t fh; vfs_path_t *tmp_vpath; diff --git a/lib/vfs/xdirentry.h b/lib/vfs/xdirentry.h index 7b06deab9..1ef473a9a 100644 --- a/lib/vfs/xdirentry.h +++ b/lib/vfs/xdirentry.h @@ -147,7 +147,7 @@ struct vfs_s_subclass int (*file_store) (struct vfs_class * me, vfs_file_handler_t * fh, char *path, char *localname); int (*linear_start) (struct vfs_class * me, vfs_file_handler_t * fh, off_t from); - int (*linear_read) (struct vfs_class * me, vfs_file_handler_t * fh, void *buf, size_t len); + ssize_t (*linear_read) (struct vfs_class * me, vfs_file_handler_t * fh, void *buf, size_t len); void (*linear_close) (struct vfs_class * me, vfs_file_handler_t * fh); }; diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c index c90481051..5c466d5af 100644 --- a/src/vfs/fish/fish.c +++ b/src/vfs/fish/fish.c @@ -1057,14 +1057,13 @@ fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh) /* --------------------------------------------------------------------------------------------- */ -static int +static ssize_t fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size_t len) { fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; struct vfs_s_super *super = FH_SUPER; ssize_t n = 0; - len = MIN ((size_t) (fish->total - fish->got), len); tty_disable_interrupt_key (); while (len != 0 && ((n = read (SUP->sockr, buf, len)) < 0)) diff --git a/src/vfs/ftpfs/ftpfs.c b/src/vfs/ftpfs/ftpfs.c index df5be441b..690d89f27 100644 --- a/src/vfs/ftpfs/ftpfs.c +++ b/src/vfs/ftpfs/ftpfs.c @@ -1896,7 +1896,7 @@ ftpfs_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset) /* --------------------------------------------------------------------------------------------- */ -static int +static ssize_t ftpfs_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size_t len) { ssize_t n; -- 2.11.4.GIT