[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v2 5/5] lib/vfscore: make all vnops function return int



Hi Yuri,

this patch looks good.

Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>

On 6/3/19 11:04 AM, Yuri Volchkov wrote:
This must be a mistake made during porting and adapting types in
particular. All the vnops functions are returning error codes, not
offsets or not the number of bytes read.

Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
  lib/ramfs/ramfs_vnops.c             |  6 +++---
  lib/vfscore/include/vfscore/vnode.h | 10 ++++++----
  lib/vfscore/stdio.c                 |  4 ++--
  3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/ramfs/ramfs_vnops.c b/lib/ramfs/ramfs_vnops.c
index f0848bd0..6eca9b26 100644
--- a/lib/ramfs/ramfs_vnops.c
+++ b/lib/ramfs/ramfs_vnops.c
@@ -294,7 +294,7 @@ ramfs_symlink(struct vnode *dvp, char *name, char *link)
        return 0;
  }
-static ssize_t
+static int
  ramfs_readlink(struct vnode *vp, struct uio *uio)
  {
        struct ramfs_node *np = vp->v_data;
@@ -394,7 +394,7 @@ ramfs_create(struct vnode *dvp, char *name, mode_t mode)
        return 0;
  }
-static ssize_t
+static int
  ramfs_read(struct vnode *vp, struct vfscore_file *fp __unused,
           struct uio *uio, int ioflag __unused)
  {
@@ -444,7 +444,7 @@ ramfs_set_file_data(struct vnode *vp, const void *data, 
size_t size)
        return 0;
  }
-static ssize_t
+static int
  ramfs_write(struct vnode *vp, struct uio *uio, int ioflag)
  {
        struct ramfs_node *np =  vp->v_data;
diff --git a/lib/vfscore/include/vfscore/vnode.h 
b/lib/vfscore/include/vfscore/vnode.h
index 1348f579..e7ebc4ad 100644
--- a/lib/vfscore/include/vfscore/vnode.h
+++ b/lib/vfscore/include/vfscore/vnode.h
@@ -147,9 +147,11 @@ struct vattr {
typedef int (*vnop_open_t) (struct vfscore_file *);
  typedef       int (*vnop_close_t)     (struct vnode *, struct vfscore_file *);
-typedef        ssize_t (*vnop_read_t)  (struct vnode *, struct vfscore_file *, 
struct uio *, int);
-typedef        ssize_t (*vnop_write_t) (struct vnode *, struct uio *, int);
-typedef        off_t (*vnop_seek_t)    (struct vnode *, struct vfscore_file *, 
off_t, off_t);
+typedef        int (*vnop_read_t)      (struct vnode *, struct vfscore_file *,
+                                struct uio *, int);
+typedef        int (*vnop_write_t)     (struct vnode *, struct uio *, int);
+typedef        int (*vnop_seek_t)      (struct vnode *, struct vfscore_file *,
+                                off_t, off_t);
  typedef       int (*vnop_ioctl_t)     (struct vnode *, struct vfscore_file *, 
unsigned long, void *);
  typedef       int (*vnop_fsync_t)     (struct vnode *, struct vfscore_file *);
  typedef       int (*vnop_readdir_t)   (struct vnode *, struct vfscore_file *, 
struct dirent *);
@@ -167,7 +169,7 @@ typedef     int (*vnop_truncate_t)  (struct vnode *, off_t);
  typedef       int (*vnop_link_t)      (struct vnode *, struct vnode *, char 
*);
  typedef int (*vnop_cache_t) (struct vnode *, struct vfscore_file *, struct 
uio *);
  typedef int (*vnop_fallocate_t) (struct vnode *, int, off_t, off_t);
-typedef ssize_t (*vnop_readlink_t)  (struct vnode *, struct uio *);
+typedef int (*vnop_readlink_t)  (struct vnode *, struct uio *);
  typedef int (*vnop_symlink_t)   (struct vnode *, char *, char *);
/*
diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c
index 40288bb3..8bde152d 100644
--- a/lib/vfscore/stdio.c
+++ b/lib/vfscore/stdio.c
@@ -57,7 +57,7 @@ static int __coutk_wrapper(void *dst __unused, void *src, 
size_t *cnt)
  }
/* One function for stderr and stdout */
-static ssize_t stdio_write(struct vnode *vp __unused,
+static int stdio_write(struct vnode *vp __unused,
                           struct uio *uio,
                           int ioflag __unused)
  {
@@ -100,7 +100,7 @@ static int __read_fn(void *dst, void *src __unused, size_t 
*cnt)
        return 0;
  }
-static ssize_t stdio_read(struct vnode *vp __unused,
+static int stdio_read(struct vnode *vp __unused,
                      struct vfscore_file *file __unused,
                      struct uio *uio,
                      int ioflag __unused)


--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.