| /* |
| * Copyright (C) 2017-2019 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" |
| include "inc/dirent.h" |
| |
| trusted { |
| /* define ECALLs here. */ |
| }; |
| |
| untrusted { |
| int u_open_ocall([out] int *error, [in, string] const char *pathname, int flags); |
| int u_open64_ocall([out] int *error, [in, string] const char *path, int oflag, int mode); |
| |
| int u_fstat_ocall([out] int *error, int fd, [out] struct stat_t *buf); |
| int u_fstat64_ocall([out] int *error, int fd, [out] struct stat64_t *buf); |
| int u_stat_ocall([out] int *error, [in, string] const char *path, [out] struct stat_t *buf); |
| int u_stat64_ocall([out] int *error, [in, string] const char *path, [out] struct stat64_t *buf); |
| int u_lstat_ocall([out] int *error, [in, string] const char *path, [out] struct stat_t *buf); |
| int u_lstat64_ocall([out] int *error, [in, string] const char *path, [out] struct stat64_t *buf); |
| uint64_t u_lseek_ocall([out] int *error, int fd, int64_t offset, int whence); |
| int64_t u_lseek64_ocall([out] int *error, int fd, int64_t offset, int whence); |
| int u_ftruncate_ocall([out] int *error, int fd, int64_t length); |
| int u_ftruncate64_ocall([out] int *error, int fd, int64_t length); |
| int u_truncate_ocall([out] int *error, [in, string] const char *path, int64_t length); |
| int u_truncate64_ocall([out] int *error, [in, string] const char *path, int64_t length); |
| |
| int u_fsync_ocall([out] int *error, int fd); |
| int u_fdatasync_ocall([out] int *error, int fd); |
| int u_fchmod_ocall([out] int *error, int fd, uint32_t mode); |
| int u_unlink_ocall([out] int *error, [in, string] const char *pathname); |
| int u_link_ocall([out] int *error, [in, string] const char *oldpath, [in, string] const char *newpath); |
| int u_rename_ocall([out] int *error, [in, string] const char *oldpath, [in, string] const char *newpath); |
| int u_chmod_ocall([out] int *error, [in, string] const char *path, uint32_t mode); |
| size_t u_readlink_ocall([out] int *error, [in, string] const char *path, [out, size=bufsz] char *buf, size_t bufsz); |
| int u_symlink_ocall([out] int *error, [in, string] const char *path1, [in, string] const char *path2); |
| char * u_realpath_ocall([out] int *error, [in, string] const char *pathname); |
| int u_mkdir_ocall([out] int *error, [in, string] const char *pathname, uint32_t mode); |
| int u_rmdir_ocall([out] int *error, [in, string] const char *pathname); |
| void * u_opendir_ocall([out] int *error, [in, string] const char *pathname); |
| int u_readdir64_r_ocall([out] int *error, [user_check] void *dirp, [in, out] struct dirent64_t *entry, [out] struct dirent64_t **result); |
| int u_closedir_ocall([out] int *error, [user_check] void *dirp); |
| int u_dirfd_ocall([out] int *error, [user_check] void *dirp); |
| int u_fstatat64_ocall([out] int *error, int dirfd, [in, string] const char *pathname, [out] struct stat64_t *buf, int flags); |
| }; |
| }; |