[libvirt] [PATCHv2 3/9] virNodeGetCPUMapFlags: Implement public API.
Eric Blake
eblake at redhat.com
Tue Oct 23 19:41:52 UTC 2012
On 10/16/2012 08:05 AM, Viktor Mihajlovski wrote:
> Added implementation of virNodeGetCPUMapFlags to libvirt.c
>
> Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
> src/libvirt.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 56 insertions(+), 0 deletions(-)
Ah, and here we finally get the documentation for the new API; hence,
this should also be squashed in with 1/9.
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 3c6d67d..25c37d3 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -20098,3 +20098,59 @@ error:
> virDispatchError(domain->conn);
> return NULL;
> }
> +
> +/**
> + * virNodeGetCPUMapFlags:
Again, I'm dropping Flags.
> +int
> +virNodeGetCPUMapFlags (virConnectPtr conn,
Although it isn't (yet) enforced, our style uses no space before ( in
function definitions. Dan has a patch in the wings which would flag this.
> + unsigned char **cpumap,
> + unsigned int *online,
> + unsigned int flags)
> +{
> + VIR_DEBUG("conn=%p, cpumap=%p, online=%p, flags=%x",
> + conn, cpumap, online, flags);
> +
> + virResetLastError();
> +
> + if (!VIR_IS_CONNECT (conn)) {
Again, no space before ( in macro calls.
> + virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
> + virDispatchError(NULL);
> + return -1;
> + }
> +
> + if (conn->driver->nodeGetCPUMapFlags) {
> + int ret = conn->driver->nodeGetCPUMapFlags (conn,
And again.
> + cpumap,
> + online,
> + flags);
> + if (ret < 0)
> + goto error;
> + VIR_DEBUG("conn=%p, cpumap=%p, online=%u, flags=%x, ret=%d",
> + conn, cpumap, online ? *online : 0 , flags, ret);
None of the other functions have a debug point here.
> + return ret;
> + }
> +
> + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> +
> +error:
> + virDispatchError(conn);
> + return -1;
> +}
>
ACK with this squashed in:
diff --git i/src/libvirt.c w/src/libvirt.c
index 2415be3..dfab6ae 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -20108,7 +20108,7 @@ error:
}
/**
- * virNodeGetCPUMapFlags:
+ * virNodeGetCPUMap:
* @conn: pointer to the hypervisor connection
* @cpumap: optional pointer to a bit map of real CPUs on the host node
* (in 8-bit bytes) (OUT)
@@ -20128,31 +20128,26 @@ error:
* or -1 if there was an error.
*/
int
-virNodeGetCPUMapFlags (virConnectPtr conn,
- unsigned char **cpumap,
- unsigned int *online,
- unsigned int flags)
+virNodeGetCPUMap(virConnectPtr conn,
+ unsigned char **cpumap,
+ unsigned int *online,
+ unsigned int flags)
{
VIR_DEBUG("conn=%p, cpumap=%p, online=%p, flags=%x",
conn, cpumap, online, flags);
virResetLastError();
- if (!VIR_IS_CONNECT (conn)) {
+ if (!VIR_IS_CONNECT(conn)) {
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
virDispatchError(NULL);
return -1;
}
- if (conn->driver->nodeGetCPUMapFlags) {
- int ret = conn->driver->nodeGetCPUMapFlags (conn,
- cpumap,
- online,
- flags);
+ if (conn->driver->nodeGetCPUMap) {
+ int ret = conn->driver->nodeGetCPUMap(conn, cpumap, online, flags);
if (ret < 0)
goto error;
- VIR_DEBUG("conn=%p, cpumap=%p, online=%u, flags=%x, ret=%d",
- conn, cpumap, online ? *online : 0 , flags, ret);
return ret;
}
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121023/11c96337/attachment-0001.sig>
More information about the libvir-list
mailing list