| 1 | // | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo | 
|---|
| 3 | // | 
|---|
| 4 | // The contents of this file are covered under the licence agreement in the | 
|---|
| 5 | // file "LICENCE" distributed with Cforall. | 
|---|
| 6 | // | 
|---|
| 7 | // iofwd.hfa -- | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Thierry Delisle | 
|---|
| 10 | // Created On       : Thu Apr 23 17:31:00 2020 | 
|---|
| 11 | // Last Modified By : | 
|---|
| 12 | // Last Modified On : | 
|---|
| 13 | // Update Count     : | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include <unistd.h> | 
|---|
| 19 | extern "C" { | 
|---|
| 20 | #include <sys/types.h> | 
|---|
| 21 | #if CFA_HAVE_LINUX_IO_URING_H | 
|---|
| 22 | #include <linux/io_uring.h> | 
|---|
| 23 | #endif | 
|---|
| 24 | } | 
|---|
| 25 | #include "bits/defs.hfa" | 
|---|
| 26 | #include "time.hfa" | 
|---|
| 27 |  | 
|---|
| 28 | #if defined(CFA_HAVE_IOSQE_FIXED_FILE) | 
|---|
| 29 | #define CFA_IO_FIXED_FD1 IOSQE_FIXED_FILE | 
|---|
| 30 | #endif | 
|---|
| 31 | #if defined(CFA_HAVE_SPLICE_F_FD_IN_FIXED) | 
|---|
| 32 | #define CFA_IO_FIXED_FD2 SPLICE_F_FD_IN_FIXED | 
|---|
| 33 | #endif | 
|---|
| 34 | #if defined(CFA_HAVE_IOSQE_IO_DRAIN) | 
|---|
| 35 | #define CFA_IO_DRAIN IOSQE_IO_DRAIN | 
|---|
| 36 | #endif | 
|---|
| 37 | #if defined(CFA_HAVE_IOSQE_ASYNC) | 
|---|
| 38 | #define CFA_IO_ASYNC IOSQE_ASYNC | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|
| 41 | struct cluster; | 
|---|
| 42 | struct io_context; | 
|---|
| 43 | struct io_cancellation; | 
|---|
| 44 |  | 
|---|
| 45 | struct iovec; | 
|---|
| 46 | struct msghdr; | 
|---|
| 47 | struct sockaddr; | 
|---|
| 48 | struct statx; | 
|---|
| 49 |  | 
|---|
| 50 | extern ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 51 | extern ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 52 | extern int cfa_fsync(int fd, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 53 | extern int cfa_sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 54 | extern ssize_t cfa_sendmsg(int sockfd, const struct msghdr *msg, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 55 | extern ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 56 | extern ssize_t cfa_send(int sockfd, const void *buf, size_t len, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 57 | extern ssize_t cfa_recv(int sockfd, void *buf, size_t len, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 58 | extern int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 59 | extern int cfa_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 60 | extern int cfa_fallocate(int fd, int mode, uint64_t offset, uint64_t len, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 61 | extern int cfa_fadvise(int fd, uint64_t offset, uint64_t len, int advice, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 62 | extern int cfa_madvise(void *addr, size_t length, int advice, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 63 | extern int cfa_openat(int dirfd, const char *pathname, int flags, mode_t mode, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 64 | extern int cfa_close(int fd, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 65 | extern int cfa_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 66 | extern ssize_t cfa_read(int fd, void *buf, size_t count, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 67 | extern ssize_t cfa_write(int fd, void *buf, size_t count, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 68 | extern ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 69 | extern ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags, int submit_flags = 0, Duration timeout = -1`s, io_cancellation * cancellation = 0p, io_context * context = 0p); | 
|---|
| 70 |  | 
|---|
| 71 | //----------------------------------------------------------------------------- | 
|---|
| 72 | // Check if a function is blocks a only the user thread | 
|---|
| 73 | bool has_user_level_blocking( fptr_t func ); | 
|---|
| 74 |  | 
|---|
| 75 | //----------------------------------------------------------------------------- | 
|---|
| 76 | void register_fixed_files( io_context & ctx , int * files, unsigned count ); | 
|---|
| 77 | void register_fixed_files( cluster    & cltr, int * files, unsigned count ); | 
|---|