[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 60/78] qga: add fallthrough pseudo-keyword
|
From: |
Emmanouil Pitsidianakis |
|
Subject: |
[RFC PATCH v2 60/78] qga: add fallthrough pseudo-keyword |
|
Date: |
Fri, 13 Oct 2023 10:57:27 +0300 |
In preparation of raising -Wimplicit-fallthrough to 5, replace all
fall-through comments with the fallthrough attribute pseudo-keyword.
Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
---
qga/main.c | 2 +-
qga/vss-win32/requester.cpp | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/qga/main.c b/qga/main.c
index 8668b9f3d3..40471e8a0b 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -644,37 +644,37 @@ end:
/* false return signals GAChannel to close the current client connection */
static gboolean channel_event_cb(GIOCondition condition, gpointer data)
{
GAState *s = data;
gchar buf[QGA_READ_COUNT_DEFAULT + 1];
gsize count;
GIOStatus status = ga_channel_read(s->channel, buf,
QGA_READ_COUNT_DEFAULT, &count);
switch (status) {
case G_IO_STATUS_ERROR:
g_warning("error reading channel");
stop_agent(s, false);
return false;
case G_IO_STATUS_NORMAL:
buf[count] = 0;
g_debug("read data, count: %d, data: %s", (int)count, buf);
json_message_parser_feed(&s->parser, (char *)buf, (int)count);
break;
case G_IO_STATUS_EOF:
g_debug("received EOF");
if (!s->virtio) {
return false;
}
- /* fall through */
+ fallthrough;
case G_IO_STATUS_AGAIN:
/* virtio causes us to spin here when no process is attached to
* host-side chardev. sleep a bit to mitigate this
*/
if (s->virtio) {
g_usleep(G_USEC_PER_SEC / 10);
}
return true;
default:
g_warning("unknown channel read status, closing");
return false;
}
return true;
}
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 9884c65e70..36fa4fdf28 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -563,72 +563,73 @@ out1:
void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset)
{
qga_debug_begin;
COMPointer<IVssAsync> pAsync;
if (!vss_ctx.hEventThaw) {
/*
* In this case, DoSnapshotSet is aborted or not started,
* and no volumes must be frozen. We return without an error.
*/
*num_vols = 0;
qga_debug("finished, no volumes were frozen");
return;
}
/* Tell the provider that the snapshot is finished. */
SetEvent(vss_ctx.hEventThaw);
assert(vss_ctx.pVssbc);
assert(vss_ctx.pAsyncSnapshot);
HRESULT hr = WaitForAsync(vss_ctx.pAsyncSnapshot);
switch (hr) {
case VSS_S_ASYNC_FINISHED:
hr = vss_ctx.pVssbc->BackupComplete(pAsync.replace());
if (SUCCEEDED(hr)) {
hr = WaitForAsync(pAsync);
}
if (FAILED(hr)) {
err_set(errset, hr, "failed to complete backup");
}
break;
case (HRESULT)VSS_E_OBJECT_NOT_FOUND:
/*
* On Windows earlier than 2008 SP2 which does not support
* VSS_VOLSNAP_ATTR_NO_AUTORECOVERY context, the final commit is not
* skipped and VSS is aborted by VSS_E_OBJECT_NOT_FOUND. However, as
* the system had been frozen until fsfreeze-thaw command was issued,
* we ignore this error.
*/
vss_ctx.pVssbc->AbortBackup();
break;
case VSS_E_UNEXPECTED_PROVIDER_ERROR:
if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) != WAIT_OBJECT_0) {
err_set(errset, hr, "unexpected error in VSS provider");
break;
}
/* fall through if hEventTimeout is signaled */
+ fallthrough;
case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
err_set(errset, hr, "couldn't hold writes: "
"fsfreeze is limited up to 10 seconds");
break;
default:
err_set(errset, hr, "failed to do snapshot set");
}
if (err_is_set(errset)) {
vss_ctx.pVssbc->AbortBackup();
}
*num_vols = vss_ctx.cFrozenVols;
requester_cleanup();
CoUninitialize();
StopService();
qga_debug_end;
}
--
2.39.2
- [RFC PATCH v2 50/78] hw/audio: add fallthrough pseudo-keyword, (continued)
- [RFC PATCH v2 50/78] hw/audio: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 53/78] nbd: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 55/78] hw/display: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 56/78] hw/input: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 57/78] hw/net: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 58/78] hw/ppc: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 62/78] hw/gpio: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 61/78] semihosting: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 63/78] hw/ipmi: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 60/78] qga: add fallthrough pseudo-keyword,
Emmanouil Pitsidianakis <=
- [RFC PATCH v2 64/78] hw/mips: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 59/78] hw/intc: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 68/78] hw/pci: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 69/78] hw/rdma/rdma_backend.c: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 75/78] migration: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 66/78] hw/nvram/eeprom_at24c.c: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 65/78] hw/nvme: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 67/78] hw/pci-host/pnv_phb3.c: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13
- [RFC PATCH v2 77/78] tests/unit/test-char.c: add fallthrough pseudo-keyword, Emmanouil Pitsidianakis, 2023/10/13