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

[UNIKRAFT PATCH 03/10] lib/vfscore: Register `fallocate` to syscall_shim



Registers `fallocate` system call to syscall_shim library.

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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index da45140..1cae643 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -36,3 +36,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 41c8f3c..b897aa7 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -98,6 +98,8 @@ readlink
 uk_syscall_e_readlink
 uk_syscall_r_readlink
 fallocate
+uk_syscall_e_fallocate
+uk_syscall_r_fallocate
 lseek
 uk_syscall_e_lseek
 uk_syscall_r_lseek
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 588c4eb..eb007b9 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1785,7 +1785,7 @@ UK_TRACEPOINT(trace_vfs_fallocate, "%d %d 0x%x 0x%x", 
int, int, loff_t, loff_t);
 UK_TRACEPOINT(trace_vfs_fallocate_ret, "");
 UK_TRACEPOINT(trace_vfs_fallocate_err, "%d", int);
 
-int fallocate(int fd, int mode, loff_t offset, loff_t len)
+UK_SYSCALL_R_DEFINE(int, fallocate, int, fd, int, mode, loff_t, offset, 
loff_t, len)
 {
        struct vfscore_file *fp;
        int error;
@@ -1793,20 +1793,19 @@ int fallocate(int fd, int mode, loff_t offset, loff_t 
len)
        trace_vfs_fallocate(fd, mode, offset, len);
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = sys_fallocate(fp, mode, offset, len);
        fdrop(fp);
 
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_fallocate_ret();
        return 0;
 
-       out_errno:
+       out_error:
        trace_vfs_fallocate_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 
 LFS64(fallocate);
-- 
2.17.1




 


Rackspace

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