}
/*
- * If no URI is passed, then check for an environment string if not
- * available probe the compiled in drivers to find a default hypervisor
- * if detectable.
+ * If no URI is passed, then check for an environment string if not
+ * available probe the compiled in drivers to find a default hypervisor
+ * if detectable.
*/
if (!name &&
virConnectGetDefaultURI(conf, &name) < 0)
*
* Here is a sample code snippet:
*
- * if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) &&
- * (nparams != 0)) {
- * if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL)
- * goto error;
- * memset(params, 0, sizeof(virNodeCPUStats) * nparams);
- * if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
- * goto error;
- * }
+ * if (virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0 &&
+ * nparams != 0) {
+ * if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL)
+ * goto error;
+ * memset(params, 0, sizeof(virNodeCPUStats) * nparams);
+ * if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
+ * goto error;
+ * }
*
* This function doesn't require privileged access to the hypervisor.
* This function expects the caller to allocate the @params.
*
* Here is the sample code snippet:
*
- * if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) &&
- * (nparams != 0)) {
- * if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL)
- * goto error;
- * memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams);
- * if (virNodeGetMemoryStats(conn, params, &nparams, 0))
- * goto error;
- * }
+ * if (virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0 &&
+ * nparams != 0) {
+ * if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL)
+ * goto error;
+ * memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams);
+ * if (virNodeGetMemoryStats(conn, params, &nparams, 0))
+ * goto error;
+ * }
*
* This function doesn't require privileged access to the hypervisor.
* This function expects the caller to allocate the @params.
*
* Here is a sample code snippet:
*
- * char *ret = virDomainGetSchedulerType(dom, &nparams);
- * if (ret && nparams != 0) {
- * if ((params = malloc(sizeof(*params) * nparams)) == NULL)
- * goto error;
- * memset(params, 0, sizeof(*params) * nparams);
- * if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0))
- * goto error;
- * }
+ * char *ret = virDomainGetSchedulerType(dom, &nparams);
+ * if (ret && nparams != 0) {
+ * if ((params = malloc(sizeof(*params) * nparams)) == NULL)
+ * goto error;
+ * memset(params, 0, sizeof(*params) * nparams);
+ * if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0))
+ * goto error;
+ * }
*
* Returns -1 in case of error, 0 in case of success.
*/
* on each array element, then calling free() on @domains.
*
* Example of usage:
- * virDomainPtr *domains;
- * size_t i;
- * int ret;
- * unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |
- * VIR_CONNECT_LIST_DOMAINS_PERSISTENT;
- *
- * ret = virConnectListAllDomains(conn, &domains, flags);
- * if (ret < 0)
- * error();
*
- * for (i = 0; i < ret; i++) {
- * do_something_with_domain(domains[i]);
- *
- * //here or in a separate loop if needed
- * virDomainFree(domains[i]);
- * }
- *
- * free(domains);
+ * virDomainPtr *domains;
+ * size_t i;
+ * int ret;
+ * unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |
+ * VIR_CONNECT_LIST_DOMAINS_PERSISTENT;
+ * ret = virConnectListAllDomains(conn, &domains, flags);
+ * if (ret < 0)
+ * error();
+ * for (i = 0; i < ret; i++) {
+ * do_something_with_domain(domains[i]);
+ * //here or in a separate loop if needed
+ * virDomainFree(domains[i]);
+ * }
+ * free(domains);
*/
int
virConnectListAllDomains(virConnectPtr conn,
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_RDONLY)
+ * int fd = open("demo.iso", O_RDONLY);
*
* virConnectUploadFile(conn, "demo.iso", st);
*
* }
* int offset = 0;
* while (offset < got) {
- * int sent = virStreamSend(st, buf+offset, got-offset)
+ * int sent = virStreamSend(st, buf+offset, got-offset);
* if (sent < 0) {
* virStreamAbort(st);
* goto done;
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_WRONLY, 0600)
+ * int fd = open("demo.iso", O_WRONLY, 0600);
*
* virConnectDownloadFile(conn, "demo.iso", st);
*
* }
* int offset = 0;
* while (offset < got) {
- * int sent = write(fd, buf+offset, got-offset)
+ * int sent = write(fd, buf + offset, got - offset);
* if (sent < 0) {
* virStreamAbort(st);
* goto done;
* }
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_RDONLY)
+ * int fd = open("demo.iso", O_RDONLY);
*
* virConnectUploadFile(conn, st);
* if (virStreamSendAll(st, mysource, &fd) < 0) {
* }
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_WRONLY)
+ * int fd = open("demo.iso", O_WRONLY);
*
* virConnectUploadFile(conn, st);
* if (virStreamRecvAll(st, mysink, &fd) < 0) {