all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster 07/12] pmxcfs: server: move message handling to separate function
Date: Mon, 24 Aug 2026 10:56:06 +0200	[thread overview]
Message-ID: <20260824085610.111211-9-d.kral@proxmox.com> (raw)
In-Reply-To: <20260824085610.111211-2-d.kral@proxmox.com>

Move the handling of the different IPC request operations to a separate
function to make it more apparent, which input/output variables the
message handling part reads/writes (besides the global outbuf).

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 src/pmxcfs/server.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/pmxcfs/server.c b/src/pmxcfs/server.c
index 58689fd..c9fabb4 100644
--- a/src/pmxcfs/server.c
+++ b/src/pmxcfs/server.c
@@ -156,21 +156,9 @@ static int32_t s1_connection_closed_fn(qb_ipcs_connection_t *c) {
     return 0;
 }
 
-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);
-
+static int32_t s1_msg_handle_request(
+    struct s1_context *ctx, void *data, int32_t request_id, int32_t request_size
+) {
     g_string_truncate(outbuf, 0);
 
     int32_t result = -ECHRNG;
@@ -447,6 +435,25 @@ static int32_t s1_msg_process_fn(qb_ipcs_connection_t *c, void *data, size_t siz
         }
     }
 
+    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);
 
     int iov_len = 2;
-- 
2.47.3





  parent reply	other threads:[~2026-08-24  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:55 [PATCH-SERIES cluster 00/12] addressing large ipc message responses Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 01/12] buildsys: include pmxcfs tidy target in top-level tidy target Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 02/12] run make tidy Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 03/12] pmxcfs: server: simplify non-negative ipc message result responses Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 04/12] pmxcfs: server: simplify ipc message response logic Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 05/12] pmxcfs: server: report responses exceeding the maximum message size Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 06/12] pmxcfs: server: remove unnecessary local variable alignment attributes Daniel Kral
2026-08-24  8:56 ` Daniel Kral [this message]
2026-08-24  8:56 ` [PATCH cluster 08/12] pmxcfs: server: move message response sending to separate function Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 09/12] pmxcfs: server: simplify message response size calculation Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 10/12] ipcc: move the data pointer initialization up Daniel Kral
2026-08-24  8:56 ` [PATCH cluster 11/12] pmxcfs: server: do not forward qb_ipc_request_header to s1_msg_handle_request Daniel Kral
2026-08-24  8:56 ` [RFC PATCH cluster 12/12] allow large ipc responses by sending the response message in chunks Daniel Kral

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824085610.111211-9-d.kral@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal