sgx_ipfs.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. int
  12. ipfs_init();
  13. void
  14. ipfs_destroy();
  15. int
  16. ipfs_posix_fallocate(int fd, off_t offset, size_t len);
  17. size_t
  18. ipfs_read(int fd, const struct iovec *iov, int iovcnt, bool has_offset,
  19. off_t offset);
  20. size_t
  21. ipfs_write(int fd, const struct iovec *iov, int iovcnt, bool has_offset,
  22. off_t offset);
  23. int
  24. ipfs_close(int fd);
  25. void *
  26. ipfs_fopen(int fd, int flags);
  27. int
  28. ipfs_fflush(int fd);
  29. off_t
  30. ipfs_lseek(int fd, off_t offset, int nwhence);
  31. int
  32. ipfs_ftruncate(int fd, off_t len);
  33. /**
  34. * Whether two file descriptors are equal.
  35. */
  36. inline static bool
  37. fd_equal(int left, int right)
  38. {
  39. return left == right ? true : false;
  40. }
  41. /**
  42. * Returns the file descriptor as a hash value.
  43. */
  44. inline static uint32
  45. fd_hash(int fd)
  46. {
  47. return (uint32)fd;
  48. }
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif /* end of _LIBC_WASI_SGX_PFS_H */