From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 90A191FF0B2 for ; Mon, 24 Aug 2026 10:58:42 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 886E621711; Mon, 24 Aug 2026 10:57:24 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH cluster 08/12] pmxcfs: server: move message response sending to separate function Date: Mon, 24 Aug 2026 10:56:07 +0200 Message-ID: <20260824085610.111211-10-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260824085610.111211-2-d.kral@proxmox.com> References: <20260824085610.111211-2-d.kral@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787561806480 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.903 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: Z2ZG3PAUYQNZ6QJ4DRH5IQOQIR7PCKSI X-Message-ID-Hash: Z2ZG3PAUYQNZ6QJ4DRH5IQOQIR7PCKSI X-MailFrom: d.kral@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Move the sending of IPC request responses to a separate function in preparation of an upcoming patch, which allows sending large responses as multiple chunks and therefore increases the complexity slightly. Signed-off-by: Daniel Kral --- src/pmxcfs/server.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/pmxcfs/server.c b/src/pmxcfs/server.c index c9fabb4..0af6745 100644 --- a/src/pmxcfs/server.c +++ b/src/pmxcfs/server.c @@ -438,24 +438,7 @@ static int32_t s1_msg_handle_request( return result; } -static int32_t s1_msg_process_fn(qb_ipcs_connection_t *c, void *data, size_t size) { - struct qb_ipc_request_header *req_pt = (struct qb_ipc_request_header *)data; - - struct s1_context *ctx = (struct s1_context *)qb_ipcs_context_get(c); - - if (!ctx) { - cfs_critical("qb_ipcs_context_get failed"); - qb_ipcs_disconnect(c); - return 0; - } - - int32_t request_id = req_pt->id; - int32_t request_size = req_pt->size; - cfs_debug("process msg:%d, size:%d", request_id, request_size); - - int32_t result = s1_msg_handle_request(ctx, data, request_id, request_size); - cfs_debug("process result %d", result); - +static void s1_msg_send_response(qb_ipcs_connection_t *c, int32_t request_id, int32_t result) { int iov_len = 2; struct iovec iov[iov_len]; struct qb_ipc_response_header res_header; @@ -487,6 +470,27 @@ static int32_t s1_msg_process_fn(qb_ipcs_connection_t *c, void *data, size_t siz cfs_critical("qb_ipcs_response_send: %s", strerror(errno)); qb_ipcs_disconnect(c); } +} + +static int32_t s1_msg_process_fn(qb_ipcs_connection_t *c, void *data, size_t size) { + struct qb_ipc_request_header *req_pt = (struct qb_ipc_request_header *)data; + + struct s1_context *ctx = (struct s1_context *)qb_ipcs_context_get(c); + + if (!ctx) { + cfs_critical("qb_ipcs_context_get failed"); + qb_ipcs_disconnect(c); + return 0; + } + + int32_t request_id = req_pt->id; + int32_t request_size = req_pt->size; + cfs_debug("process msg:%d, size:%d", request_id, request_size); + + int32_t result = s1_msg_handle_request(ctx, data, request_id, request_size); + cfs_debug("process result %d", result); + + s1_msg_send_response(c, request_id, result); return 0; } -- 2.47.3