mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 03:17:20 +02:00
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.
This commit is contained in:
parent
cd92c6c83d
commit
57444a3b30
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 @@ public:
|
|||
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 @@ public:
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue