| /* |
| * Copyright (C) 2017-2018 Baidu, Inc. All Rights Reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * |
| * * Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * * Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in |
| * the documentation and/or other materials provided with the |
| * distribution. |
| * * Neither the name of Baidu, Inc., nor the names of its |
| * contributors may be used to endorse or promote products derived |
| * from this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| * |
| */ |
| |
| enclave { |
| |
| include "inc/stat.h" |
| |
| trusted { |
| /* define ECALLs here. */ |
| }; |
| |
| untrusted { |
| |
| int u_fs_open64_ocall([out] int *error, [in, string] const char *path, int oflag, int mode); |
| |
| size_t u_fs_read_ocall([out] int *error, int fd, [out, size=count] void *buf, size_t count); |
| size_t u_fs_pread64_ocall([out] int *error, int fd, [out, size=count] void *buf, size_t count, int64_t offset); |
| |
| size_t u_fs_write_ocall([out] int *error, int fd, [in, size=count] const void *buf, size_t count); |
| size_t u_fs_pwrite64_ocall([out] int *error, int fd, [in, size=count] const void *buf, size_t count, int64_t offset); |
| |
| int u_fs_close_ocall([out] int *error, int fd); |
| |
| int u_fs_fcntl_arg0_ocall([out] int *error, int fd, int cmd); |
| int u_fs_fcntl_arg1_ocall([out] int *error, int fd, int cmd, int arg); |
| int u_fs_ioctl_arg0_ocall([out] int *error, int fd, int request); |
| int u_fs_ioctl_arg1_ocall([out] int *error, int fd, int request, [in] int *arg); |
| |
| int u_fs_fstat64_ocall([out] int *error, int fd, [out] struct stat64_t *buf); |
| int u_fs_fsync_ocall([out] int *error, int fd); |
| int u_fs_fdatasync_ocall([out] int *error, int fd); |
| int u_fs_ftruncate64_ocall([out] int *error, int fd, int64_t length); |
| int64_t u_fs_lseek64_ocall([out] int *error, int fd, int64_t offset, int whence); |
| int u_fs_fchmod_ocall([out] int *error, int fd, uint32_t mode); |
| |
| int u_fs_unlink_ocall([out] int *error, [in, string] const char *pathname); |
| int u_fs_link_ocall([out] int *error, [in, string] const char *oldpath, [in, string] const char *newpath); |
| int u_fs_rename_ocall([out] int *error, [in, string] const char *oldpath, [in, string] const char *newpath); |
| int u_fs_chmod_ocall([out] int *error, [in, string] const char *path, uint32_t mode); |
| size_t u_fs_readlink_ocall([out] int *error, [in, string] const char *path, [out, size=bufsz] char *buf, size_t bufsz); |
| int u_fs_symlink_ocall([out] int *error, [in, string] const char *path1, [in, string] const char *path2); |
| int u_fs_stat64_ocall([out] int *error, [in, string] const char *path, [out] struct stat64_t *buf); |
| int u_fs_lstat64_ocall([out] int *error, [in, string] const char *path, [out] struct stat64_t *buf); |
| char * u_fs_realpath_ocall([out] int *error, [in, string] const char *pathname); |
| void u_fs_free_ocall([user_check] void *p); |
| }; |
| }; |