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

Re: [UNIKRAFT PATCH 3/5] lib/vfscore: Register `link` to syscall_shim



Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@xxxxxxxxx>

On 17.04.2020 22:41, Constantin Raducanu wrote:
Registers `link` system call to syscall_shim library.

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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index ec415f4..3986676 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -30,4 +30,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 5ad97c2..57413d6 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -45,6 +45,8 @@ vfscore_mount_dump
  umount
  umount2
  link
+uk_syscall_e_link
+uk_syscall_r_link
  unlink
  getcwd
  chown
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 8bbce80..b5b7e40 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1070,7 +1070,7 @@ UK_TRACEPOINT(trace_vfs_link, "\"%s\" \"%s\"", const 
char*, const char*);
  UK_TRACEPOINT(trace_vfs_link_ret, "");
  UK_TRACEPOINT(trace_vfs_link_err, "%d", int);
-int link(const char *oldpath, const char *newpath)
+UK_SYSCALL_R_DEFINE(int, link, const char*, oldpath, const char*, newpath)
  {
        struct task *t = main_task;
        char path1[PATH_MAX];
@@ -1081,21 +1081,22 @@ int link(const char *oldpath, const char *newpath)
error = ENOENT;
        if (oldpath == NULL || newpath == NULL)
-               goto out_errno;
+               goto out_error;
        if ((error = task_conv(t, oldpath, VWRITE, path1)) != 0)
-               goto out_errno;
+               goto out_error;
        if ((error = task_conv(t, newpath, VWRITE, path2)) != 0)
-               goto out_errno;
+               goto out_error;
error = sys_link(path1, path2);
        if (error)
-               goto out_errno;
+               goto out_error;
+
        trace_vfs_link_ret();
        return 0;
-       out_errno:
+
+       out_error:
        trace_vfs_link_err(error);
-       errno = error;
-       return -1;
+       return -error;
  }



 


Rackspace

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