* src/libvirt.c: implement the main entry points
* src/libvirt_public.syms: add them to the exported symbols
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
src/libvirt.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++
2 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 85dfc58..15c5ddc 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5928,6 +5928,121 @@ error:
}
/**
+ * virDomainStreamDisk:
+ * @dom: pointer to the domain object
+ * @path: path to the block device
+ * @offset: when streaming a single disk unit, the offset of the unit to stream
+ * @flags: flags to control disk streaming behavior
+ *
+ * Returns: Next offset or 0 on success, -1 on failure.
+ */
+unsigned long long
+virDomainStreamDisk(virDomainPtr dom,
+ const char *path,
+ unsigned long long offset,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ unsigned long long ret = -1;
+
+ VIR_DOMAIN_DEBUG(dom, "path=%p, offset=%llu, flags=%u",
+ path, offset, flags);
+
+ if (path == NULL) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (flags == VIR_STREAM_DISK_START || flags == VIR_STREAM_DISK_STOP) {
+ if (offset != 0) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+ } else if (flags != VIR_STREAM_DISK_ONE) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ virResetLastError();
+ if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+ virLibDomainError (VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ return -1;
+ }
+
+ conn = dom->conn;
+ if (conn->driver->domainStreamDisk) {
+ ret = conn->driver->domainStreamDisk (dom, path, offset, flags);
+ if (ret == -1)
+ goto error;
+ return ret;
+ }
+
+ virLibDomainError (VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(dom->conn);
+ return -1;
+}
+
+/**
+ * virDomainStreamDiskInfo:
+ * @dom: pointer to the domain object
+ * @states: An array of virStreamDiskState structures to store stream info
+ * @nr_states: The maximimum number of stream states to report
+ * @flags: future flags, use 0 for now
+ *
+ * Returns: The number of streams reported or -1 on failure.
+ */
+int
+virDomainStreamDiskInfo(virDomainPtr dom,
+ virStreamDiskStatePtr states,
+ unsigned int nr_states,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ int ret = -1;
+
+ VIR_DOMAIN_DEBUG(dom, "states=%p, nr_states=%u, flags=%u",
+ states, nr_states, flags);
+
+ if (states == NULL) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (nr_states == 0) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (flags != 0) {
+ virLibDomainError (VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ virResetLastError();
+ if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+ virLibDomainError (VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ return -1;
+ }
+
+ conn = dom->conn;
+ if (conn->driver->domainStreamDiskInfo) {
+ ret = conn->driver->domainStreamDiskInfo (dom, states, nr_states,
+ flags);
+ if (ret == -1)
+ goto error;
+ return ret;
+ }
+
+ virLibDomainError (VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(dom->conn);
+ return -1;
+}
+
+/**
* virNodeGetCellsFreeMemory:
* @conn: pointer to the hypervisor connection
* @freeMems: pointer to the array of unsigned long long
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index b4aed41..185186a 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -437,3 +437,8 @@ LIBVIRT_0.9.0 {
} LIBVIRT_0.8.8;
# .... define new API here using predicted next version number ....
+LIBVIRT_0.9.1 {
+ global:
+ virDomainStreamDisk;
+ virDomainStreamDiskInfo;
+} LIBVIRT_0.9.0;
--
1.7.3