Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Oct 31, 2024
1 parent e38e7d6 commit 8ced1f5
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 257 deletions.
13 changes: 2 additions & 11 deletions include/swoole_iouring.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,9 @@ class Iouring {
Iouring(Reactor *reactor_);
bool ready();
bool submit(IouringEvent *event);
bool dispatch(IouringEvent *event);
bool wakeup();

bool submit_event_open(IouringEvent *event);
bool submit_event_close(IouringEvent *event);
bool submit_event_wr(IouringEvent *event);
bool submit_event_statx(IouringEvent *event);
bool submit_event_mkdir(IouringEvent *event);
bool submit_event_unlink(IouringEvent *event);
bool submit_event_rename(IouringEvent *event);
bool submit_event_fsync(IouringEvent *event);

struct io_uring_sqe *get_iouring_sqe() {
struct io_uring_sqe *sqe = io_uring_get_sqe(&ring);
// We need to reset the values of each sqe structure so that they can be used in a loop.
Expand All @@ -65,8 +57,7 @@ class Iouring {
return sqe;
}

static Iouring *create();
static int dispatch(IouringEvent *event);
static ssize_t execute(IouringEvent *event);

public:
~Iouring();
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if [ "${SWOOLE_BRANCH}" = "valgrind" ]; then
elif [ "$SWOOLE_THREAD" = 1 ]; then
dir="swoole_thread"
elif [ "$SWOOLE_USE_IOURING" = 1 ]; then
dir="swoole_runtime/file_hook"
dir="swoole_runtime/file_hook swoole_iouring"
else
dir="swoole_*"
fi
Expand Down
14 changes: 7 additions & 7 deletions src/coroutine/hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ using swoole::coroutine::async;
using swoole::coroutine::PollSocket;
using swoole::coroutine::Socket;
using swoole::coroutine::System;
using swoole::coroutine::translate_events_to_poll;
using swoole::coroutine::translate_events_from_poll;
using swoole::coroutine::translate_events_to_poll;

#ifdef SW_USE_IOURING
using swoole::Iouring;
Expand Down Expand Up @@ -627,18 +627,18 @@ int swoole_coroutine_iouring_close_file(int fd) {
return Iouring::close(fd);
}

ssize_t swoole_coroutine_iouring_read(int sockfd, void *buf, size_t count) {
ssize_t swoole_coroutine_iouring_read(int sockfd, void *buf, size_t size) {
if (sw_unlikely(is_no_coro())) {
return read(sockfd, buf, count);
return read(sockfd, buf, size);
}
return Iouring::read(sockfd, buf, count);
return Iouring::read(sockfd, buf, size);
}

ssize_t swoole_coroutine_iouring_write(int sockfd, const void *buf, size_t count) {
ssize_t swoole_coroutine_iouring_write(int sockfd, const void *buf, size_t size) {
if (sw_unlikely(is_no_coro())) {
return write(sockfd, buf, count);
return write(sockfd, buf, size);
}
return Iouring::write(sockfd, buf, count);
return Iouring::write(sockfd, buf, size);
}

int swoole_coroutine_iouring_rename(const char *oldpath, const char *newpath) {
Expand Down
Loading

0 comments on commit 8ced1f5

Please sign in to comment.