sgx_ipfs.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2022 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _LIBC_WASI_SGX_PFS_H
  6. #define _LIBC_WASI_SGX_PFS_H
  7. #include "bh_hashmap.h"
  8. #include "wasmtime_ssp.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. int
  13. ipfs_init();
  14. void
  15. ipfs_destroy();
  16. int
  17. ipfs_posix_fallocate(int fd, off_t offset, size_t len);
  18. size_t
  19. ipfs_read(int fd, const struct iovec *iov, int iovcnt, bool has_offset,
  20. off_t offset);
  21. size_t
  22. ipfs_write(int fd, const struct iovec *iov, int iovcnt, bool has_offset,
  23. off_t offset);
  24. int
  25. ipfs_close(int fd);
  26. void *
  27. ipfs_fopen(int fd, const char *filename, int flags);
  28. int
  29. ipfs_fflush(int fd);
  30. off_t
  31. ipfs_lseek(int fd, off_t offset, int nwhence);
  32. int
  33. ipfs_ftruncate(int fd, off_t len);
  34. /**
  35. * Whether two file descriptors are equal.
  36. */
  37. inline static bool
  38. fd_equal(int left, int right)
  39. {
  40. return left == right ? true : false;
  41. }
  42. /**
  43. * Returns the file descriptor as a hash value.
  44. */
  45. inline static uint32
  46. fd_hash(int fd)
  47. {
  48. return (uint32)fd;
  49. }
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* end of _LIBC_WASI_SGX_PFS_H */