[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/30] qga: remove need for QEMU atomic.h
From: |
marcandre . lureau |
Subject: |
[PULL 28/30] qga: remove need for QEMU atomic.h |
Date: |
Thu, 21 Apr 2022 17:49:38 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Since the introduction of guest-exec in/out/err redirections in commit
a1853dca74 ("qga: guest-exec simple stdin/stdout/stderr redirection"),
some execution state variables are handled with atomic ops. However,
there are no threads involved in this code (and glib sources are
dispatched in the same thread), and no other obvious reason to use them.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-40-marcandre.lureau@redhat.com>
---
qga/commands.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/qga/commands.c b/qga/commands.c
index 690da0073d6e..7ff551d092a1 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -18,7 +18,6 @@
#include "qapi/qmp/qerror.h"
#include "qemu/base64.h"
#include "qemu/cutils.h"
-#include "qemu/atomic.h"
#include "commands-common.h"
/* Maximum captured guest-exec out_data/err_data - 16MB */
@@ -162,13 +161,12 @@ GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error
**errp)
ges = g_new0(GuestExecStatus, 1);
- bool finished = qatomic_mb_read(&gei->finished);
+ bool finished = gei->finished;
/* need to wait till output channels are closed
* to be sure we captured all output at this point */
if (gei->has_output) {
- finished = finished && qatomic_mb_read(&gei->out.closed);
- finished = finished && qatomic_mb_read(&gei->err.closed);
+ finished &= gei->out.closed && gei->err.closed;
}
ges->exited = finished;
@@ -270,7 +268,7 @@ static void guest_exec_child_watch(GPid pid, gint status,
gpointer data)
(int32_t)gpid_to_int64(pid), (uint32_t)status);
gei->status = status;
- qatomic_mb_set(&gei->finished, true);
+ gei->finished = true;
g_spawn_close_pid(pid);
}
@@ -326,7 +324,7 @@ static gboolean guest_exec_input_watch(GIOChannel *ch,
done:
g_io_channel_shutdown(ch, true, NULL);
g_io_channel_unref(ch);
- qatomic_mb_set(&p->closed, true);
+ p->closed = true;
g_free(p->data);
return false;
@@ -380,7 +378,7 @@ static gboolean guest_exec_output_watch(GIOChannel *ch,
close:
g_io_channel_shutdown(ch, true, NULL);
g_io_channel_unref(ch);
- qatomic_mb_set(&p->closed, true);
+ p->closed = true;
return false;
}
--
2.36.0
- [PULL 19/30] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}, (continued)
- [PULL 19/30] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}, marcandre . lureau, 2022/04/21
- [PULL 18/30] tests: remove block/qdict checks from check-qobject.c, marcandre . lureau, 2022/04/21
- [PULL 20/30] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/21
- [PULL 21/30] Move error_printf_unless_qmp() with monitor unit, marcandre . lureau, 2022/04/21
- [PULL 22/30] qga: move qga_get_host_name(), marcandre . lureau, 2022/04/21
- [PULL 24/30] util: simplify write in signal handler, marcandre . lureau, 2022/04/21
- [PULL 23/30] qtest: simplify socket_send(), marcandre . lureau, 2022/04/21
- [PULL 25/30] util: use qemu_write_full() in qemu_write_pidfile(), marcandre . lureau, 2022/04/21
- [PULL 26/30] util: use qemu_create() in qemu_write_pidfile(), marcandre . lureau, 2022/04/21
- [PULL 27/30] util: replace qemu_get_local_state_pathname(), marcandre . lureau, 2022/04/21
- [PULL 28/30] qga: remove need for QEMU atomic.h,
marcandre . lureau <=
- [PULL 29/30] tests/fuzz: fix warning, marcandre . lureau, 2022/04/21
- [PULL 30/30] qga: use fixed-length and GDateTime for log timestamp, marcandre . lureau, 2022/04/21
- Re: [PULL 00/30] Misc patches, Richard Henderson, 2022/04/21