qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michal Privoznik <mprivozn@redhat.com>
To: qemu-devel@nongnu.org
Cc: kkostiuk@redhat.com, michael.roth@amd.com, jtomko@redhat.com
Subject: [PATCH v2 4/4] qga: Make run_agent() and run_agent_once() return no value
Date: Thu,  5 Dec 2024 17:18:48 +0100	[thread overview]
Message-ID: <8f4469febaaf5c48afdf13a6c88e959956c0f204.1733414906.git.mprivozn@redhat.com> (raw)
In-Reply-To: <cover.1733414906.git.mprivozn@redhat.com>

After previous commits, run_agent_once() can't return anything
else but EXIT_SUCCESS. Transitionally, run_agent() can't return
anything else but EXIT_SUCCESS too. There's not much value in
having these function return an integer. Make them return void.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 qga/main.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/qga/main.c b/qga/main.c
index 35f061b5ea..346274f114 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -145,7 +145,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data,
 DWORD WINAPI handle_serial_device_events(DWORD type, LPVOID data);
 VOID WINAPI service_main(DWORD argc, TCHAR *argv[]);
 #endif
-static int run_agent(GAState *s);
+static void run_agent(GAState *s);
 static void stop_agent(GAState *s, bool requested);
 
 static void
@@ -1521,7 +1521,7 @@ static void cleanup_agent(GAState *s)
     ga_state = NULL;
 }
 
-static int run_agent_once(GAState *s)
+static void run_agent_once(GAState *s)
 {
     if (!s->channel &&
         channel_init(s, s->config->method, s->config->channel_path,
@@ -1536,8 +1536,6 @@ static int run_agent_once(GAState *s)
         ga_channel_free(s->channel);
         s->channel = NULL;
     }
-
-    return EXIT_SUCCESS;
 }
 
 static void wait_for_channel_availability(GAState *s)
@@ -1561,21 +1559,17 @@ static void wait_for_channel_availability(GAState *s)
 #endif
 }
 
-static int run_agent(GAState *s)
+static void run_agent(GAState *s)
 {
-    int ret = EXIT_SUCCESS;
-
     s->force_exit = false;
 
     do {
-        ret = run_agent_once(s);
+        run_agent_once(s);
         if (s->config->retry_path && !s->force_exit) {
             g_warning("agent stopped unexpectedly, restarting...");
             wait_for_channel_availability(s);
         }
     } while (s->config->retry_path && !s->force_exit);
-
-    return ret;
 }
 
 static void stop_agent(GAState *s, bool requested)
@@ -1674,14 +1668,15 @@ int main(int argc, char **argv)
         SERVICE_TABLE_ENTRY service_table[] = {
             { (char *)QGA_SERVICE_NAME, service_main }, { NULL, NULL } };
         StartServiceCtrlDispatcher(service_table);
-        ret = EXIT_SUCCESS;
     } else {
-        ret = run_agent(s);
+        run_agent(s);
     }
 #else
-    ret = run_agent(s);
+    run_agent(s);
 #endif
 
+    ret = EXIT_SUCCESS;
+
     cleanup_agent(s);
 
 end:
-- 
2.45.2



  parent reply	other threads:[~2024-12-05 16:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-05 16:18 [PATCH v2 0/4] qga: Open channel before going daemon Michal Privoznik
2024-12-05 16:18 ` [PATCH v2 1/4] qga: Don't access global variable in run_agent_once() Michal Privoznik
2024-12-18 12:05   ` Konstantin Kostiuk
2024-12-05 16:18 ` [PATCH v2 2/4] qga: Invert logic on return value in main() Michal Privoznik
2024-12-05 16:18 ` [PATCH v2 3/4] qga: Don't daemonize before channel is initialized Michal Privoznik
2024-12-05 16:18 ` Michal Privoznik [this message]
2024-12-16 15:52   ` [PATCH v2 4/4] qga: Make run_agent() and run_agent_once() return no value Konstantin Kostiuk
     [not found]     ` <CAPMcbCoibsbysQLj_LRmuJUZ=ZM2ATP03dbo5zWzPxyyFfycMA@mail.gmail.com>
2025-01-07 13:09       ` Michal Prívozník

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=8f4469febaaf5c48afdf13a6c88e959956c0f204.1733414906.git.mprivozn@redhat.com \
    --to=mprivozn@redhat.com \
    --cc=jtomko@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).