[Libvirt-cim] [PATCH 1 of 2] [CU] Add dup_instance function to libcmpiutil
Dan Smith
danms at us.ibm.com
Fri Feb 1 16:59:49 UTC 2008
JG> +CMPIStatus cu_dup_instance(const CMPIBroker *broker,
JG> + CMPIInstance *src,
JG> + CMPIInstance **dest)
JG> +{
JG> + CMPIStatus s = {CMPI_RC_OK, NULL};
JG> + CMPIObjectPath *ref;
JG> +
JG> + ref = CMGetObjectPath(src, NULL);
JG> + if ((s.rc != CMPI_RC_OK) || CMIsNullObject(ref)) {
JG> + cu_statusf(broker, &s,
JG> + CMPI_RC_ERR_FAILED,
JG> + "Could not get objectpath from instance");
JG> + goto out;
JG> + }
JG> +
JG> + *dest = NULL;
Why set it to NULL and then set it to the instance right after this?
JG> + *dest = CMNewInstance(broker, ref, &s);
JG> +
JG> + out:
JG> + return s;
JG> +}
What about all the properties of the instance? This gets a new
instance structure, yes, but all it has is an object path. Maybe that
is all you need at the moment, but I don't think this does what other
consumers of the library would think by the name :)
It should be easy to loop through all the properties and copy them
over. It will look similar to the array copy/filter code in Kaitlin's
libcmpiutil CO patch.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080201/0e8f1fdc/attachment.sig>
More information about the Libvirt-cim
mailing list