From ff272552c297966ace3492aefe91fc830152251a Mon Sep 17 00:00:00 2001 From: David Allan Date: Tue, 19 May 2009 16:26:12 -0400 Subject: [PATCH] Step 5 of 8 Implement the RPC client --- src/remote_internal.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/src/remote_internal.c b/src/remote_internal.c index 4b3afb0..e665ef8 100644 --- a/src/remote_internal.c +++ b/src/remote_internal.c @@ -4978,6 +4978,59 @@ done: } +static virNodeDevicePtr +remoteNodeDeviceCreateXML(virConnectPtr conn, + const char *xmlDesc, + unsigned int flags) +{ + remote_node_device_create_xml_args args; + remote_node_device_create_xml_ret ret; + virNodeDevicePtr dev = NULL; + struct private_data *priv = conn->privateData; + + remoteDriverLock(priv); + + memset(&ret, 0, sizeof ret); + args.xml_desc = (char *)xmlDesc; + args.flags = flags; + + if (call(conn, priv, 0, REMOTE_PROC_NODE_DEVICE_CREATE_XML, + (xdrproc_t) xdr_remote_node_device_create_xml_args, (char *) &args, + (xdrproc_t) xdr_remote_node_device_create_xml_ret, (char *) &ret) == -1) + goto done; + + dev = get_nonnull_node_device(conn, ret.dev); + xdr_free ((xdrproc_t) xdr_remote_node_device_create_xml_ret, (char *) &ret); + +done: + remoteDriverUnlock(priv); + return dev; +} + +static int +remoteNodeDeviceDestroy(virNodeDevicePtr dev) +{ + int rv = -1; + remote_node_device_destroy_args args; + struct private_data *priv = dev->conn->privateData; + + remoteDriverLock(priv); + + args.name = dev->name; + + if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DESTROY, + (xdrproc_t) xdr_remote_node_device_destroy_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) + goto done; + + rv = 0; + +done: + remoteDriverUnlock(priv); + return rv; +} + + /*----------------------------------------------------------------------*/ static int @@ -6982,6 +7035,8 @@ static virDeviceMonitor dev_monitor = { .deviceGetParent = remoteNodeDeviceGetParent, .deviceNumOfCaps = remoteNodeDeviceNumOfCaps, .deviceListCaps = remoteNodeDeviceListCaps, + .deviceCreateXML = remoteNodeDeviceCreateXML, + .deviceDestroy = remoteNodeDeviceDestroy }; -- 1.6.0.6