Skip to content
Permalink
Browse files
MDEV-16264: Minor cleanup
aio_linux::m_max_io_count: Unused data member; remove.

aiocb::m_ret_len: Declare as the more compatible type size_t.
Unfortunately, ssize_t is not available on Microsoft Visual Studio.
  • Loading branch information
dr-m committed Dec 3, 2019
1 parent cd92c6c commit 57444a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
@@ -39,7 +39,6 @@ namespace tpool

class aio_linux : public aio
{
int m_max_io_count;
thread_pool* m_pool;
io_context_t m_io_ctx;
bool m_in_shutdown;
@@ -62,7 +61,7 @@ class aio_linux : public aio
long long res = event.res;
if (res < 0)
{
iocb->m_err = -res;
iocb->m_err = static_cast<int>(-res);
iocb->m_ret_len = 0;
}
else
@@ -93,8 +92,8 @@ class aio_linux : public aio
}

public:
aio_linux(io_context_t ctx, thread_pool* pool, size_t max_count)
: m_max_io_count(max_count), m_pool(pool), m_io_ctx(ctx),
aio_linux(io_context_t ctx, thread_pool* pool)
: m_pool(pool), m_io_ctx(ctx),
m_in_shutdown(), m_getevent_thread(getevent_thread_routine, this)
{
}
@@ -146,7 +145,7 @@ aio* create_linux_aio(thread_pool* pool, int max_io)
fprintf(stderr, "io_setup(%d) returned %d\n", max_io, ret);
return nullptr;
}
return new aio_linux(ctx, pool, max_io);
return new aio_linux(ctx, pool);
}
#else
aio* create_linux_aio(thread_pool* pool, int max_aio)
@@ -133,7 +133,11 @@ class simulated_aio : public aio
static void simulated_aio_callback(void *param)
{
aiocb *cb= (aiocb *) param;
int ret_len;
#ifdef _WIN32
size_t ret_len;
#else
ssize_t ret_len;
#endif
int err= 0;
switch (cb->m_opcode)
{
@@ -146,14 +150,13 @@ class simulated_aio : public aio
default:
abort();
}
if (ret_len < 0)
{
#ifdef _WIN32
if (static_cast<int>(ret_len) < 0)
err= GetLastError();
#else
if (ret_len < 0)
err= errno;
#endif
}
cb->m_ret_len = ret_len;
cb->m_err = err;
cb->m_callback(cb);
@@ -110,7 +110,6 @@ enum class aio_opcode
AIO_PWRITE
};
const int MAX_AIO_USERDATA_LEN= 40;
struct aiocb;

/** IO control block, includes parameters for the IO, and the callback*/

@@ -129,7 +128,7 @@ struct aiocb
callback_func m_callback;
task_group* m_group;
/* Returned length and error code*/
int m_ret_len;
size_t m_ret_len;
int m_err;
void *m_internal;
task m_internal_task;

0 comments on commit 57444a3

Please sign in to comment.