On 12/24/18 3:59 PM, Daniel P. Berrangé wrote:
Introduce a new virNetworPort object that will present an attachment
to
a virtual network from a VM.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
include/libvirt/libvirt-network.h | 49 +++++
include/libvirt/virterror.h | 3 +
src/datatypes.c | 60 +++++
src/datatypes.h | 41 ++++
src/driver-network.h | 27 +++
src/libvirt-network.c | 351 ++++++++++++++++++++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_public.syms | 14 ++
src/util/virerror.c | 9 +
9 files changed, 556 insertions(+)
+/**
+ * virNetworkPortFree:
+ * @port: a network port object
+ *
+ * Free the network port object.
+ * The data structure is freed and should not be used thereafter.
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virNetworkPortFree(virNetworkPortPtr port)
+{
+ VIR_DEBUG("port=%p", port);
+
+ virResetLastError();
+
+ virCheckNetworkPortReturn(port, -1);
+
+ virObjectUnref(port);
+ return 0;
Don't we want to make this accept NULL? I know we don't do it for some
other public free functions, but that was a mistake we can't fix (in
fact I think we could because one can argue that relying on
virDomainFree() returning -1 is a broken code anyway).
Michal