Skip to content
Snippets Groups Projects
Commit 27648ede authored by Florian Fischer's avatar Florian Fischer
Browse files

[IO] define methods and functions implemented in header files as inline

parent c854aa6e
No related branches found
No related tags found
No related merge requests found
Pipeline #53903 failed
......@@ -33,7 +33,7 @@ namespace emper::io {
*
* @return Future object which signals the completion of the recv request
*/
auto recv(int socket, void *buffer, size_t length, int flags) -> std::unique_ptr<Future> {
inline auto recv(int socket, void *buffer, size_t length, int flags) -> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->recv(socket, buffer, length, flags);
}
......@@ -51,7 +51,7 @@ auto recv(int socket, void *buffer, size_t length, int flags) -> std::unique_ptr
* @return -1 on error, 0 when receiving from a closed socket, otherwise the received bytes
*/
auto recv_and_wait(int socket, void *buffer, size_t length, int flags) -> ssize_t {
inline auto recv_and_wait(int socket, void *buffer, size_t length, int flags) -> ssize_t {
IoContext *io = IoContext::getCurrentIo();
return io->recv_and_wait(socket, buffer, length, flags);
}
......@@ -71,7 +71,7 @@ auto recv_and_wait(int socket, void *buffer, size_t length, int flags) -> ssize_
*
* @return Future object which signals the completion of the send request
*/
auto send(int socket, const void *buffer, size_t length, int flags, bool send_all = true)
inline auto send(int socket, const void *buffer, size_t length, int flags, bool send_all = true)
-> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->send(socket, buffer, length, flags, send_all);
......@@ -92,7 +92,7 @@ auto send(int socket, const void *buffer, size_t length, int flags, bool send_al
*
* @return -1 on error, otherwise the number of sent bytes
*/
auto send_and_wait(int socket, const void *buffer, size_t length, int flags, bool send_all = true)
inline auto send_and_wait(int socket, const void *buffer, size_t length, int flags, bool send_all = true)
-> ssize_t {
IoContext *io = IoContext::getCurrentIo();
return io->send_and_wait(socket, buffer, length, flags, send_all);
......@@ -116,7 +116,7 @@ auto send_and_wait(int socket, const void *buffer, size_t length, int flags, boo
*
* @return Future object which signals the completion of the connect request
*/
auto connect(int socket, const struct sockaddr *address, socklen_t address_len)
inline auto connect(int socket, const struct sockaddr *address, socklen_t address_len)
-> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->connect(socket, address, address_len);
......@@ -140,7 +140,7 @@ auto connect(int socket, const struct sockaddr *address, socklen_t address_len)
*
* @return -1 on error, 0 otherwise
*/
auto connect_and_wait(int socket, const struct sockaddr *address, socklen_t address_len) -> int {
inline auto connect_and_wait(int socket, const struct sockaddr *address, socklen_t address_len) -> int {
IoContext *io = IoContext::getCurrentIo();
return io->connect_and_wait(socket, address, address_len);
}
......@@ -167,7 +167,7 @@ auto connect_and_wait(int socket, const struct sockaddr *address, socklen_t addr
*
* @return Future object which signals the completion of the accept request
*/
auto accept(int socket, struct sockaddr *address, socklen_t *address_len)
inline auto accept(int socket, struct sockaddr *address, socklen_t *address_len)
-> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->accept(socket, address, address_len);
......@@ -195,7 +195,7 @@ auto accept(int socket, struct sockaddr *address, socklen_t *address_len)
*
* @return -1 on error, otherwise the non-negative file descriptor of the accepted socket.
*/
auto accept_and_wait(int socket, struct sockaddr *address, socklen_t *address_len) -> int {
inline auto accept_and_wait(int socket, struct sockaddr *address, socklen_t *address_len) -> int {
IoContext *io = IoContext::getCurrentIo();
return io->accept_and_wait(socket, address, address_len);
}
......@@ -215,7 +215,7 @@ auto accept_and_wait(int socket, struct sockaddr *address, socklen_t *address_le
*
* @return Future object which signals the completion of the read request
*/
auto read_file(int fildes, void *buf, size_t nbyte, off_t offset = 0, bool read_all = false)
inline auto read_file(int fildes, void *buf, size_t nbyte, off_t offset = 0, bool read_all = false)
-> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->read_file(fildes, buf, nbyte, offset, read_all);
......@@ -236,7 +236,7 @@ auto read_file(int fildes, void *buf, size_t nbyte, off_t offset = 0, bool read_
*
* @return -1 on error, otherwise the number of bytes read
*/
auto read_file_and_wait(int fildes, void *buf, size_t nbyte, off_t offset = 0,
inline auto read_file_and_wait(int fildes, void *buf, size_t nbyte, off_t offset = 0,
bool read_all = false) -> ssize_t {
IoContext *io = IoContext::getCurrentIo();
return io->read_file_and_wait(fildes, buf, nbyte, offset, read_all);
......@@ -260,7 +260,7 @@ auto read_file_and_wait(int fildes, void *buf, size_t nbyte, off_t offset = 0,
*
* @return Future object which signals the completion of the write request
*/
auto write_file(int fildes, const void *buf, size_t nbyte, off_t offset = 0, bool write_all = true)
inline auto write_file(int fildes, const void *buf, size_t nbyte, off_t offset = 0, bool write_all = true)
-> std::unique_ptr<Future> {
IoContext *io = IoContext::getCurrentIo();
return io->write_file(fildes, buf, nbyte, offset, write_all);
......@@ -284,7 +284,7 @@ auto write_file(int fildes, const void *buf, size_t nbyte, off_t offset = 0, boo
*
* @return -1 on error, otherwise the number of bytes written
*/
auto write_file_and_wait(int fildes, const void *buf, size_t nbyte, off_t offset = 0,
inline auto write_file_and_wait(int fildes, const void *buf, size_t nbyte, off_t offset = 0,
bool write_all = false) -> ssize_t {
IoContext *io = IoContext::getCurrentIo();
return io->write_file_and_wait(fildes, buf, nbyte, offset, write_all);
......
......@@ -160,7 +160,7 @@ class Future : public Logger<LogSubsystem::IO> {
* @brief Equivalent to calling wait() after calling submit()
*/
template <CallerEnvironment callerEnvironment = CallerEnvironment::EMPER>
auto submit_and_wait() -> size_t {
inline auto submit_and_wait() -> size_t {
submit<callerEnvironment>();
return wait();
}
......@@ -169,7 +169,7 @@ class Future : public Logger<LogSubsystem::IO> {
* @brief Equivalent to calling wait(partial_completion) after calling submit()
*/
template <CallerEnvironment callerEnvironment = CallerEnvironment::EMPER>
auto submit_and_wait(ssize_t &partial_completion) -> size_t {
inline auto submit_and_wait(ssize_t &partial_completion) -> size_t {
submit<callerEnvironment>();
return wait(partial_completion);
}
......
......@@ -51,7 +51,7 @@ class IoContext : public Logger<LogSubsystem::IO> {
public:
SubmitActor(IoContext &c, Runtime &runtime) : Actor(runtime), io(c) {}
void stop() { Actor::stop(); }
inline void stop() { Actor::stop(); }
};
/* Actor submitting Futures into the io_uring_sq */
......@@ -80,8 +80,8 @@ class IoContext : public Logger<LogSubsystem::IO> {
IoContext(Runtime &runtime) : IoContext(runtime, EMPER_IO_URING_ENTRIES){};
~IoContext();
static auto getCurrentIo() -> IoContext * { return currentIo; }
void setCurrentIo() { currentIo = this; }
static inline auto getCurrentIo() -> IoContext * { return currentIo; }
inline void setCurrentIo() { currentIo = this; }
/**
* @brief Request a recv operation mimicking POSIX recv(3) from this IoContext
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment