* [PULL 0/4] QAPI patches patches for 2021-03-05
@ 2021-03-05 15:11 Markus Armbruster
2021-03-05 15:11 ` [PULL 1/4] error: Fix "Converting to ERRP_GUARD()" doc on "valid at return" Markus Armbruster
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Markus Armbruster @ 2021-03-05 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
The following changes since commit fe352f5c0056b4d21ae033ec49acc0bce9897e53:
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20210304-pull-request' into staging (2021-03-04 12:58:50 +0000)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.git tags/pull-qapi-2021-03-05
for you to fetch changes up to 0e92a19b8c3b269dee377b76898c8bd7cadc1273:
qapi: Fix parse errors for removal of null from schema language (2021-03-05 15:40:50 +0100)
----------------------------------------------------------------
QAPI patches patches for 2021-03-05
----------------------------------------------------------------
Eric Blake (1):
qga: Utilize QAPI_LIST_APPEND in qmp_guest_network_get_interfaces
Markus Armbruster (2):
error: Fix "Converting to ERRP_GUARD()" doc on "valid at return"
qapi: Fix parse errors for removal of null from schema language
Philippe Mathieu-Daudé (1):
qapi: Remove QMP events and commands from user-mode builds
include/qapi/error.h | 2 +-
qga/commands-posix.c | 75 +++++++++++++------------------
qapi/meson.build | 12 +++--
scripts/qapi/parser.py | 8 ++--
tests/qapi-schema/leading-comma-list.err | 2 +-
tests/qapi-schema/trailing-comma-list.err | 2 +-
6 files changed, 45 insertions(+), 56 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PULL 1/4] error: Fix "Converting to ERRP_GUARD()" doc on "valid at return"
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
@ 2021-03-05 15:11 ` Markus Armbruster
2021-03-05 15:11 ` [PULL 2/4] qga: Utilize QAPI_LIST_APPEND in qmp_guest_network_get_interfaces Markus Armbruster
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2021-03-05 15:11 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, Vladimir Sementsov-Ogievskiy, Philippe Mathieu-Daudé
Setting errp = NULL is wrong: the automatic error propagation still
propagates the dangling pointer _auto_errp_prop.local_err. We need to
set *errp = NULL to clear the dangling pointer.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210125132635.1253219-1-armbru@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/qapi/error.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/qapi/error.h b/include/qapi/error.h
index eaa05c4837..4a9260b0cc 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -235,7 +235,7 @@
* error_propagate_prepend(errp, *errp, ...) by error_prepend(errp, ...)
*
* 4. Ensure @errp is valid at return: when you destroy *errp, set
- * errp = NULL.
+ * *errp = NULL.
*
* Example:
*
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 2/4] qga: Utilize QAPI_LIST_APPEND in qmp_guest_network_get_interfaces
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
2021-03-05 15:11 ` [PULL 1/4] error: Fix "Converting to ERRP_GUARD()" doc on "valid at return" Markus Armbruster
@ 2021-03-05 15:11 ` Markus Armbruster
2021-03-05 15:11 ` [PULL 3/4] qapi: Remove QMP events and commands from user-mode builds Markus Armbruster
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2021-03-05 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
From: Eric Blake <eblake@redhat.com>
I found another spot that can benefit from using our macros instead of
open-coding qapi list creation.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210205171634.1491258-1-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qga/commands-posix.c | 75 ++++++++++++++++++--------------------------
1 file changed, 30 insertions(+), 45 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 8dd94a3314..3f18df1bb6 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2153,17 +2153,17 @@ void qmp_guest_suspend_hybrid(Error **errp)
guest_suspend(SUSPEND_MODE_HYBRID, errp);
}
-static GuestNetworkInterfaceList *
+static GuestNetworkInterface *
guest_find_interface(GuestNetworkInterfaceList *head,
const char *name)
{
for (; head; head = head->next) {
if (strcmp(head->value->name, name) == 0) {
- break;
+ return head->value;
}
}
- return head;
+ return NULL;
}
static int guest_get_network_stats(const char *name,
@@ -2232,7 +2232,7 @@ static int guest_get_network_stats(const char *name,
*/
GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
{
- GuestNetworkInterfaceList *head = NULL, *cur_item = NULL;
+ GuestNetworkInterfaceList *head = NULL, **tail = &head;
struct ifaddrs *ifap, *ifa;
if (getifaddrs(&ifap) < 0) {
@@ -2241,9 +2241,10 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
}
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
- GuestNetworkInterfaceList *info;
- GuestIpAddressList **address_list = NULL, *address_item = NULL;
- GuestNetworkInterfaceStat *interface_stat = NULL;
+ GuestNetworkInterface *info;
+ GuestIpAddressList **address_tail;
+ GuestIpAddress *address_item = NULL;
+ GuestNetworkInterfaceStat *interface_stat = NULL;
char addr4[INET_ADDRSTRLEN];
char addr6[INET6_ADDRSTRLEN];
int sock;
@@ -2257,19 +2258,12 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
if (!info) {
info = g_malloc0(sizeof(*info));
- info->value = g_malloc0(sizeof(*info->value));
- info->value->name = g_strdup(ifa->ifa_name);
+ info->name = g_strdup(ifa->ifa_name);
- if (!cur_item) {
- head = cur_item = info;
- } else {
- cur_item->next = info;
- cur_item = info;
- }
+ QAPI_LIST_APPEND(tail, info);
}
- if (!info->value->has_hardware_address &&
- ifa->ifa_flags & SIOCGIFHWADDR) {
+ if (!info->has_hardware_address && ifa->ifa_flags & SIOCGIFHWADDR) {
/* we haven't obtained HW address yet */
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock == -1) {
@@ -2278,7 +2272,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
}
memset(&ifr, 0, sizeof(ifr));
- pstrcpy(ifr.ifr_name, IF_NAMESIZE, info->value->name);
+ pstrcpy(ifr.ifr_name, IF_NAMESIZE, info->name);
if (ioctl(sock, SIOCGIFHWADDR, &ifr) == -1) {
error_setg_errno(errp, errno,
"failed to get MAC address of %s",
@@ -2290,13 +2284,13 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
close(sock);
mac_addr = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
- info->value->hardware_address =
+ info->hardware_address =
g_strdup_printf("%02x:%02x:%02x:%02x:%02x:%02x",
(int) mac_addr[0], (int) mac_addr[1],
(int) mac_addr[2], (int) mac_addr[3],
(int) mac_addr[4], (int) mac_addr[5]);
- info->value->has_hardware_address = true;
+ info->has_hardware_address = true;
}
if (ifa->ifa_addr &&
@@ -2309,15 +2303,14 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
}
address_item = g_malloc0(sizeof(*address_item));
- address_item->value = g_malloc0(sizeof(*address_item->value));
- address_item->value->ip_address = g_strdup(addr4);
- address_item->value->ip_address_type = GUEST_IP_ADDRESS_TYPE_IPV4;
+ address_item->ip_address = g_strdup(addr4);
+ address_item->ip_address_type = GUEST_IP_ADDRESS_TYPE_IPV4;
if (ifa->ifa_netmask) {
/* Count the number of set bits in netmask.
* This is safe as '1' and '0' cannot be shuffled in netmask. */
p = &((struct sockaddr_in *)ifa->ifa_netmask)->sin_addr;
- address_item->value->prefix = ctpop32(((uint32_t *) p)[0]);
+ address_item->prefix = ctpop32(((uint32_t *) p)[0]);
}
} else if (ifa->ifa_addr &&
ifa->ifa_addr->sa_family == AF_INET6) {
@@ -2329,15 +2322,14 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
}
address_item = g_malloc0(sizeof(*address_item));
- address_item->value = g_malloc0(sizeof(*address_item->value));
- address_item->value->ip_address = g_strdup(addr6);
- address_item->value->ip_address_type = GUEST_IP_ADDRESS_TYPE_IPV6;
+ address_item->ip_address = g_strdup(addr6);
+ address_item->ip_address_type = GUEST_IP_ADDRESS_TYPE_IPV6;
if (ifa->ifa_netmask) {
/* Count the number of set bits in netmask.
* This is safe as '1' and '0' cannot be shuffled in netmask. */
p = &((struct sockaddr_in6 *)ifa->ifa_netmask)->sin6_addr;
- address_item->value->prefix =
+ address_item->prefix =
ctpop32(((uint32_t *) p)[0]) +
ctpop32(((uint32_t *) p)[1]) +
ctpop32(((uint32_t *) p)[2]) +
@@ -2349,29 +2341,22 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
continue;
}
- address_list = &info->value->ip_addresses;
-
- while (*address_list && (*address_list)->next) {
- address_list = &(*address_list)->next;
+ address_tail = &info->ip_addresses;
+ while (*address_tail) {
+ address_tail = &(*address_tail)->next;
}
+ QAPI_LIST_APPEND(address_tail, address_item);
- if (!*address_list) {
- *address_list = address_item;
- } else {
- (*address_list)->next = address_item;
- }
+ info->has_ip_addresses = true;
- info->value->has_ip_addresses = true;
-
- if (!info->value->has_statistics) {
+ if (!info->has_statistics) {
interface_stat = g_malloc0(sizeof(*interface_stat));
- if (guest_get_network_stats(info->value->name,
- interface_stat) == -1) {
- info->value->has_statistics = false;
+ if (guest_get_network_stats(info->name, interface_stat) == -1) {
+ info->has_statistics = false;
g_free(interface_stat);
} else {
- info->value->statistics = interface_stat;
- info->value->has_statistics = true;
+ info->statistics = interface_stat;
+ info->has_statistics = true;
}
}
}
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 3/4] qapi: Remove QMP events and commands from user-mode builds
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
2021-03-05 15:11 ` [PULL 1/4] error: Fix "Converting to ERRP_GUARD()" doc on "valid at return" Markus Armbruster
2021-03-05 15:11 ` [PULL 2/4] qga: Utilize QAPI_LIST_APPEND in qmp_guest_network_get_interfaces Markus Armbruster
@ 2021-03-05 15:11 ` Markus Armbruster
2021-03-05 15:11 ` [PULL 4/4] qapi: Fix parse errors for removal of null from schema language Markus Armbruster
2021-03-05 19:04 ` [PULL 0/4] QAPI patches patches for 2021-03-05 Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2021-03-05 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Philippe Mathieu-Daudé, Paolo Bonzini
From: Philippe Mathieu-Daudé <philmd@redhat.com>
We removed the QMP loop in user-mode builds in commit 1935e0e4e09
("qapi/meson: Remove QMP from user-mode emulation"), now commands
and events code is unreachable.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210224171642.3242293-1-philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qapi/meson.build | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/qapi/meson.build b/qapi/meson.build
index 0652569bc4..fcb15a78f1 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -102,11 +102,15 @@ foreach module : qapi_all_modules
'qapi-types-@0@.h'.format(module),
'qapi-visit-@0@.c'.format(module),
'qapi-visit-@0@.h'.format(module),
- 'qapi-events-@0@.c'.format(module),
- 'qapi-events-@0@.h'.format(module),
- 'qapi-commands-@0@.c'.format(module),
- 'qapi-commands-@0@.h'.format(module),
]
+ if have_system or have_tools
+ qapi_module_outputs += [
+ 'qapi-events-@0@.c'.format(module),
+ 'qapi-events-@0@.h'.format(module),
+ 'qapi-commands-@0@.c'.format(module),
+ 'qapi-commands-@0@.h'.format(module),
+ ]
+ endif
if module.endswith('-target')
qapi_specific_outputs += qapi_module_outputs
else
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 4/4] qapi: Fix parse errors for removal of null from schema language
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
` (2 preceding siblings ...)
2021-03-05 15:11 ` [PULL 3/4] qapi: Remove QMP events and commands from user-mode builds Markus Armbruster
@ 2021-03-05 15:11 ` Markus Armbruster
2021-03-05 19:04 ` [PULL 0/4] QAPI patches patches for 2021-03-05 Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2021-03-05 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: John Snow, peter.maydell
Commit 9d55380b5a "qapi: Remove null from schema language" (v4.2.0)
neglected to update two error messages. Do that now.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210224101442.1837475-1-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 8 ++++----
tests/qapi-schema/leading-comma-list.err | 2 +-
tests/qapi-schema/trailing-comma-list.err | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index e7b9d670ad..116afe549a 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -236,9 +236,9 @@ def get_values(self):
if self.tok == ']':
self.accept()
return expr
- if self.tok not in "{['tfn":
+ if self.tok not in "{['tf":
raise QAPIParseError(
- self, "expected '{', '[', ']', string, boolean or 'null'")
+ self, "expected '{', '[', ']', string, or boolean")
while True:
expr.append(self.get_expr(True))
if self.tok == ']':
@@ -257,12 +257,12 @@ def get_expr(self, nested):
elif self.tok == '[':
self.accept()
expr = self.get_values()
- elif self.tok in "'tfn":
+ elif self.tok in "'tf":
expr = self.val
self.accept()
else:
raise QAPIParseError(
- self, "expected '{', '[', string, boolean or 'null'")
+ self, "expected '{', '[', string, or boolean")
return expr
def get_doc(self, info):
diff --git a/tests/qapi-schema/leading-comma-list.err b/tests/qapi-schema/leading-comma-list.err
index 76eed2b5b3..0725d6529f 100644
--- a/tests/qapi-schema/leading-comma-list.err
+++ b/tests/qapi-schema/leading-comma-list.err
@@ -1 +1 @@
-leading-comma-list.json:2:13: expected '{', '[', ']', string, boolean or 'null'
+leading-comma-list.json:2:13: expected '{', '[', ']', string, or boolean
diff --git a/tests/qapi-schema/trailing-comma-list.err b/tests/qapi-schema/trailing-comma-list.err
index ad2f2d7c97..bb5f8c3c90 100644
--- a/tests/qapi-schema/trailing-comma-list.err
+++ b/tests/qapi-schema/trailing-comma-list.err
@@ -1 +1 @@
-trailing-comma-list.json:2:36: expected '{', '[', string, boolean or 'null'
+trailing-comma-list.json:2:36: expected '{', '[', string, or boolean
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PULL 0/4] QAPI patches patches for 2021-03-05
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
` (3 preceding siblings ...)
2021-03-05 15:11 ` [PULL 4/4] qapi: Fix parse errors for removal of null from schema language Markus Armbruster
@ 2021-03-05 19:04 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2021-03-05 19:04 UTC (permalink / raw)
To: Markus Armbruster; +Cc: QEMU Developers
On Fri, 5 Mar 2021 at 15:11, Markus Armbruster <armbru@redhat.com> wrote:
>
> The following changes since commit fe352f5c0056b4d21ae033ec49acc0bce9897e53:
>
> Merge remote-tracking branch 'remotes/kraxel/tags/ui-20210304-pull-request' into staging (2021-03-04 12:58:50 +0000)
>
> are available in the Git repository at:
>
> git://repo.or.cz/qemu/armbru.git tags/pull-qapi-2021-03-05
>
> for you to fetch changes up to 0e92a19b8c3b269dee377b76898c8bd7cadc1273:
>
> qapi: Fix parse errors for removal of null from schema language (2021-03-05 15:40:50 +0100)
>
> ----------------------------------------------------------------
> QAPI patches patches for 2021-03-05
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-05 19:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 15:11 [PULL 0/4] QAPI patches patches for 2021-03-05 Markus Armbruster
2021-03-05 15:11 ` [PULL 1/4] error: Fix "Converting to ERRP_GUARD()" doc on "valid at return" Markus Armbruster
2021-03-05 15:11 ` [PULL 2/4] qga: Utilize QAPI_LIST_APPEND in qmp_guest_network_get_interfaces Markus Armbruster
2021-03-05 15:11 ` [PULL 3/4] qapi: Remove QMP events and commands from user-mode builds Markus Armbruster
2021-03-05 15:11 ` [PULL 4/4] qapi: Fix parse errors for removal of null from schema language Markus Armbruster
2021-03-05 19:04 ` [PULL 0/4] QAPI patches patches for 2021-03-05 Peter Maydell
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.