[libvirt] [PATCH 27/34] conf: Add helper to return a bitmap of active iothread ids
John Ferlan
jferlan at redhat.com
Mon Jan 18 23:05:38 UTC 2016
On 01/14/2016 11:27 AM, Peter Krempa wrote:
> ---
> src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 3 +++
> src/libvirt_private.syms | 1 +
> 3 files changed, 33 insertions(+)
>
Could be closer to usage in 30/34, but I understand the current order
after reading ahead...
Does the function really need to be added to libvirt_private.syms? It's
only used in domain_conf.c. I also have similar question and concern
about virDomainDefGetVcpuSched in patch 29.
John
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b18ce8d..14b6c80 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -18335,6 +18335,35 @@ virDomainIOThreadIDAdd(virDomainDefPtr def,
> return NULL;
> }
>
> +
> +/*
> + * virDomainIOThreadIDMap:
> + * @def: domain definition
> + *
> + * Returns a map of active iothreads for @def.
> + */
> +virBitmapPtr
> +virDomainIOThreadIDMap(virDomainDefPtr def)
> +{
> + unsigned int max = 0;
> + size_t i;
> + virBitmapPtr ret = NULL;
> +
> + for (i = 0; i < def->niothreadids; i++) {
> + if (def->iothreadids[i]->iothread_id > max)
> + max = def->iothreadids[i]->iothread_id;
> + }
> +
> + if (!(ret = virBitmapNew(max)))
> + return NULL;
> +
> + for (i = 0; i < def->niothreadids; i++)
> + ignore_value(virBitmapSetBit(ret, def->iothreadids[i]->iothread_id));
> +
> + return ret;
> +}
> +
> +
> void
> virDomainIOThreadIDDel(virDomainDefPtr def,
> unsigned int iothread_id)
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index b12eeca..a2c8eac 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2700,6 +2700,9 @@ virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def,
> unsigned int iothread_id);
> virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def,
> unsigned int iothread_id);
> +
> +virBitmapPtr virDomainIOThreadIDMap(virDomainDefPtr def)
> + ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
> void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id);
> void virDomainIOThreadSchedDelId(virDomainDefPtr def, unsigned int iothread_id);
>
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 8213ff3..0c84672 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -342,6 +342,7 @@ virDomainIOThreadIDAdd;
> virDomainIOThreadIDDefFree;
> virDomainIOThreadIDDel;
> virDomainIOThreadIDFind;
> +virDomainIOThreadIDMap;
> virDomainIOThreadSchedDelId;
> virDomainKeyWrapCipherNameTypeFromString;
> virDomainKeyWrapCipherNameTypeToString;
>
More information about the libvir-list
mailing list