From c4af33a497eeff30ea57ead224d0553df9ce4e97 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Tue, 4 Nov 2025 15:55:33 +0800 Subject: [PATCH] declare use_io_uring correctly --- src/sf_global.c | 10 ++++++++-- src/sf_types.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sf_global.c b/src/sf_global.c index 4b4d1dc..45c875e 100644 --- a/src/sf_global.c +++ b/src/sf_global.c @@ -47,9 +47,9 @@ SFGlobalVariables g_sf_global_vars = { {0, 0}, NULL, {NULL, 0} }; -SFContext g_sf_context = {{'\0'}, NULL, 0, false, +SFContext g_sf_context = {{'\0'}, NULL, 0, false, false, #if IOEVENT_USE_URING - false, false, + false, #endif sf_address_family_auto, {{AF_UNSPEC, {{true, fc_comm_type_sock}, {false, fc_comm_type_rdma}}}, @@ -673,8 +673,10 @@ int sf_load_context_from_config_ex(SFContext *sf_context, int inner_port; int outer_port; int port; +#if IOEVENT_USE_URING bool global_use_send_zc; bool use_send_zc; +#endif int i; int result; @@ -711,6 +713,7 @@ int sf_load_context_from_config_ex(SFContext *sf_context, outer_port = config->default_outer_port; } +#if IOEVENT_USE_URING global_use_send_zc = iniGetBoolValue(NULL, "use_send_zc", config->ini_ctx.context, true); if (config->ini_ctx.section_name == NULL) { @@ -719,6 +722,7 @@ int sf_load_context_from_config_ex(SFContext *sf_context, use_send_zc = iniGetBoolValue(config->ini_ctx.section_name, "use_send_zc", config->ini_ctx.context, global_use_send_zc); } +#endif for (i=0; ihandlers + i; @@ -767,6 +771,8 @@ int sf_load_context_from_config_ex(SFContext *sf_context, #if IOEVENT_USE_URING sf_context->use_io_uring = (config->comm_type == fc_comm_type_sock); sf_context->use_send_zc = use_send_zc; +#else + sf_context->use_io_uring = false; #endif sf_context->accept_threads = iniGetIntValue( diff --git a/src/sf_types.h b/src/sf_types.h index 35bfaf3..b4491b4 100644 --- a/src/sf_types.h +++ b/src/sf_types.h @@ -181,8 +181,8 @@ typedef struct sf_context { volatile int thread_count; bool is_client; //since v1.2.5 -#if IOEVENT_USE_URING bool use_io_uring; //since v1.2.9 +#if IOEVENT_USE_URING bool use_send_zc; //since v1.2.9 #endif SFAddressFamily address_family;