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

Re: [UNIKRAFT PATCH 07/11] lib/vfscore: Register `fsync` and `fdatasync` to syscall_shim



Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@xxxxxxxxx>

On 02.05.2020 21:18, Constantin Raducanu wrote:
Registers `fsync` and `fdatasync` system calls to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@xxxxxxxxx>
---
  lib/vfscore/Makefile.uk   |  4 +++-
  lib/vfscore/exportsyms.uk |  4 ++++
  lib/vfscore/main.c        | 13 ++++++-------
  3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 63fc806..a643c03 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -48,4 +48,6 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 4a8a4f4..d297957 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -25,6 +25,8 @@ uk_syscall_e_read
  uk_syscall_r_read
  mkdir
  fsync
+uk_syscall_e_fsync
+uk_syscall_r_fsync
  fstat
  uk_syscall_e_fstat
  uk_syscall_r_fstat
@@ -94,6 +96,8 @@ uk_syscall_r_mknod
  preadv
  ioctl
  fdatasync
+uk_syscall_e_fdatasync
+uk_syscall_r_fdatasync
  fdopendir
  dirfd
  rewinddir
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 41c81f5..25da26b 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -489,7 +489,7 @@ UK_TRACEPOINT(trace_vfs_fsync, "%d", int);
  UK_TRACEPOINT(trace_vfs_fsync_ret, "");
  UK_TRACEPOINT(trace_vfs_fsync_err, "%d", int);
-int fsync(int fd)
+UK_SYSCALL_R_DEFINE(int, fsync, int, fd)
  {
        struct vfscore_file *fp;
        int error;
@@ -497,23 +497,22 @@ int fsync(int fd)
        trace_vfs_fsync(fd);
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
error = sys_fsync(fp);
        fdrop(fp);
if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_fsync_ret();
        return 0;
- out_errno:
+       out_error:
        trace_vfs_fsync_err(error);
-       errno = error;
-       return -1;
+       return -error;
  }
-int fdatasync(int fd)
+UK_SYSCALL_R_DEFINE(int, fdatasync, int, fd)
  {
        // TODO: See if we can do less than fsync().
        return fsync(fd);




 


Rackspace

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