* [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
@ 2015-05-27 17:52 Markus Armbruster
2015-06-16 6:37 ` Markus Armbruster
2015-06-17 6:27 ` Thomas Huth
0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2015-05-27 17:52 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, agraf
Since we now require GLib 2.22+ (commit f40685c), we don't have to
work around lack of g_hash_table_iter_init() & friends anymore.
This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/ppc/spapr_pci.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 05f4fac..e2b9e60 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -962,34 +962,28 @@ static const VMStateDescription vmstate_spapr_pci_msi = {
},
};
-static void spapr_pci_fill_msi_devs(gpointer key, gpointer value,
- gpointer opaque)
-{
- sPAPRPHBState *sphb = opaque;
-
- sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key;
- sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value;
- sphb->msi_devs_num++;
-}
-
static void spapr_pci_pre_save(void *opaque)
{
sPAPRPHBState *sphb = opaque;
- int msi_devs_num;
+ GHashTableIter iter;
+ gpointer key, value;
+ int i;
if (sphb->msi_devs) {
g_free(sphb->msi_devs);
sphb->msi_devs = NULL;
}
- sphb->msi_devs_num = 0;
- msi_devs_num = g_hash_table_size(sphb->msi);
- if (!msi_devs_num) {
+ sphb->msi_devs_num = g_hash_table_size(sphb->msi);
+ if (!sphb->msi_devs_num) {
return;
}
- sphb->msi_devs = g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mig));
+ sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
- g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb);
- assert(sphb->msi_devs_num == msi_devs_num);
+ g_hash_table_iter_init(&iter, sphb->msi);
+ for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {
+ sphb->msi_devs[i].key = *(uint32_t *) key;
+ sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
+ }
}
static int spapr_pci_post_load(void *opaque, int version_id)
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
2015-05-27 17:52 [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)" Markus Armbruster
@ 2015-06-16 6:37 ` Markus Armbruster
2015-06-18 6:24 ` David Gibson
2015-06-17 6:27 ` Thomas Huth
1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2015-06-16 6:37 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, agraf, david
MAINTAINERS grew since I posted this patch, copy the new guy.
Markus Armbruster <armbru@redhat.com> writes:
> Since we now require GLib 2.22+ (commit f40685c), we don't have to
> work around lack of g_hash_table_iter_init() & friends anymore.
>
> This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/ppc/spapr_pci.c | 28 +++++++++++-----------------
> 1 file changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 05f4fac..e2b9e60 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -962,34 +962,28 @@ static const VMStateDescription vmstate_spapr_pci_msi = {
> },
> };
>
> -static void spapr_pci_fill_msi_devs(gpointer key, gpointer value,
> - gpointer opaque)
> -{
> - sPAPRPHBState *sphb = opaque;
> -
> - sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key;
> - sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value;
> - sphb->msi_devs_num++;
> -}
> -
> static void spapr_pci_pre_save(void *opaque)
> {
> sPAPRPHBState *sphb = opaque;
> - int msi_devs_num;
> + GHashTableIter iter;
> + gpointer key, value;
> + int i;
>
> if (sphb->msi_devs) {
> g_free(sphb->msi_devs);
> sphb->msi_devs = NULL;
> }
> - sphb->msi_devs_num = 0;
> - msi_devs_num = g_hash_table_size(sphb->msi);
> - if (!msi_devs_num) {
> + sphb->msi_devs_num = g_hash_table_size(sphb->msi);
> + if (!sphb->msi_devs_num) {
> return;
> }
> - sphb->msi_devs = g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mig));
> + sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
>
> - g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb);
> - assert(sphb->msi_devs_num == msi_devs_num);
> + g_hash_table_iter_init(&iter, sphb->msi);
> + for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {
> + sphb->msi_devs[i].key = *(uint32_t *) key;
> + sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
> + }
> }
>
> static int spapr_pci_post_load(void *opaque, int version_id)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
2015-05-27 17:52 [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)" Markus Armbruster
2015-06-16 6:37 ` Markus Armbruster
@ 2015-06-17 6:27 ` Thomas Huth
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2015-06-17 6:27 UTC (permalink / raw)
To: Markus Armbruster; +Cc: david, qemu-ppc, qemu-devel, agraf
On Wed, 27 May 2015 19:52:56 +0200
Markus Armbruster <armbru@redhat.com> wrote:
> Since we now require GLib 2.22+ (commit f40685c), we don't have to
> work around lack of g_hash_table_iter_init() & friends anymore.
>
> This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/ppc/spapr_pci.c | 28 +++++++++++-----------------
> 1 file changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 05f4fac..e2b9e60 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -962,34 +962,28 @@ static const VMStateDescription vmstate_spapr_pci_msi = {
> },
> };
>
> -static void spapr_pci_fill_msi_devs(gpointer key, gpointer value,
> - gpointer opaque)
> -{
> - sPAPRPHBState *sphb = opaque;
> -
> - sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key;
> - sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value;
> - sphb->msi_devs_num++;
> -}
> -
> static void spapr_pci_pre_save(void *opaque)
> {
> sPAPRPHBState *sphb = opaque;
> - int msi_devs_num;
> + GHashTableIter iter;
> + gpointer key, value;
> + int i;
>
> if (sphb->msi_devs) {
> g_free(sphb->msi_devs);
> sphb->msi_devs = NULL;
> }
> - sphb->msi_devs_num = 0;
> - msi_devs_num = g_hash_table_size(sphb->msi);
> - if (!msi_devs_num) {
> + sphb->msi_devs_num = g_hash_table_size(sphb->msi);
> + if (!sphb->msi_devs_num) {
> return;
> }
> - sphb->msi_devs = g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mig));
> + sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
>
> - g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb);
> - assert(sphb->msi_devs_num == msi_devs_num);
> + g_hash_table_iter_init(&iter, sphb->msi);
> + for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {
> + sphb->msi_devs[i].key = *(uint32_t *) key;
> + sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
> + }
> }
>
> static int spapr_pci_post_load(void *opaque, int version_id)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
2015-06-16 6:37 ` Markus Armbruster
@ 2015-06-18 6:24 ` David Gibson
0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2015-06-18 6:24 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-ppc, qemu-devel, agraf
[-- Attachment #1: Type: text/plain, Size: 2704 bytes --]
On Tue, Jun 16, 2015 at 08:37:46AM +0200, Markus Armbruster wrote:
> MAINTAINERS grew since I posted this patch, copy the new guy.
Thanks, applied to spapr-next.
>
> Markus Armbruster <armbru@redhat.com> writes:
>
> > Since we now require GLib 2.22+ (commit f40685c), we don't have to
> > work around lack of g_hash_table_iter_init() & friends anymore.
> >
> > This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.
> >
> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
> > ---
> > hw/ppc/spapr_pci.c | 28 +++++++++++-----------------
> > 1 file changed, 11 insertions(+), 17 deletions(-)
> >
> > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> > index 05f4fac..e2b9e60 100644
> > --- a/hw/ppc/spapr_pci.c
> > +++ b/hw/ppc/spapr_pci.c
> > @@ -962,34 +962,28 @@ static const VMStateDescription vmstate_spapr_pci_msi = {
> > },
> > };
> >
> > -static void spapr_pci_fill_msi_devs(gpointer key, gpointer value,
> > - gpointer opaque)
> > -{
> > - sPAPRPHBState *sphb = opaque;
> > -
> > - sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key;
> > - sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value;
> > - sphb->msi_devs_num++;
> > -}
> > -
> > static void spapr_pci_pre_save(void *opaque)
> > {
> > sPAPRPHBState *sphb = opaque;
> > - int msi_devs_num;
> > + GHashTableIter iter;
> > + gpointer key, value;
> > + int i;
> >
> > if (sphb->msi_devs) {
> > g_free(sphb->msi_devs);
> > sphb->msi_devs = NULL;
> > }
> > - sphb->msi_devs_num = 0;
> > - msi_devs_num = g_hash_table_size(sphb->msi);
> > - if (!msi_devs_num) {
> > + sphb->msi_devs_num = g_hash_table_size(sphb->msi);
> > + if (!sphb->msi_devs_num) {
> > return;
> > }
> > - sphb->msi_devs = g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mig));
> > + sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
> >
> > - g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb);
> > - assert(sphb->msi_devs_num == msi_devs_num);
> > + g_hash_table_iter_init(&iter, sphb->msi);
> > + for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {
> > + sphb->msi_devs[i].key = *(uint32_t *) key;
> > + sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
> > + }
> > }
> >
> > static int spapr_pci_post_load(void *opaque, int version_id)
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-18 6:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 17:52 [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)" Markus Armbruster
2015-06-16 6:37 ` Markus Armbruster
2015-06-18 6:24 ` David Gibson
2015-06-17 6:27 ` Thomas Huth
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).