提交 016b63bd 编写于 作者: J John Ferlan

docs: Fix code example formatting for virDomainInterfaceAddresses

Adjust the spacing so that the code examples are display in the code/text
box rather than just as paragraph text.
上级 585ad00b
......@@ -11523,34 +11523,35 @@ virDomainFSInfoFree(virDomainFSInfoPtr info)
* The caller *must* free @ifaces when no longer needed. Usual use case
* looks like this:
*
* virDomainInterfacePtr *ifaces = NULL;
* int ifaces_count = 0;
* size_t i, j;
* virDomainPtr dom = ... obtain a domain here ...;
* virDomainInterfacePtr *ifaces = NULL;
* int ifaces_count = 0;
* size_t i, j;
* virDomainPtr dom = ... obtain a domain here ...;
*
* if ((ifaces_count = virDomainInterfaceAddresses(dom, &ifaces,
* VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)) < 0)
* goto cleanup;
* if ((ifaces_count = virDomainInterfaceAddresses(dom, &ifaces,
* VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)) < 0)
* goto cleanup;
*
* ... do something with returned values, for example:
* for (i = 0; i < ifaces_count; i++) {
* printf("name: %s", ifaces[i]->name);
* if (ifaces[i]->hwaddr)
* printf(" hwaddr: %s", ifaces[i]->hwaddr);
*
* for (j = 0; j < ifaces[i]->naddrs; j++) {
* virDomainIPAddressPtr ip_addr = ifaces[i]->addrs + j;
* printf("[addr: %s prefix: %d type: %d]",
* ip_addr->addr, ip_addr->prefix, ip_addr->type);
* }
* printf("\n");
* }
*
* cleanup:
* if (ifaces && ifaces_count > 0)
* for (i = 0; i < ifaces_count; i++)
* virDomainInterfaceFree(ifaces[i]);
* free(ifaces);
*
* for (i = 0; i < ifaces_count; i++) {
* printf("name: %s", ifaces[i]->name);
* if (ifaces[i]->hwaddr)
* printf(" hwaddr: %s", ifaces[i]->hwaddr);
*
* for (j = 0; j < ifaces[i]->naddrs; j++) {
* virDomainIPAddressPtr ip_addr = ifaces[i]->addrs + j;
* printf("[addr: %s prefix: %d type: %d]",
* ip_addr->addr, ip_addr->prefix, ip_addr->type);
* }
* printf("\n");
* }
*
* cleanup:
* if (ifaces && ifaces_count > 0)
* for (i = 0; i < ifaces_count; i++)
* virDomainInterfaceFree(ifaces[i]);
* free(ifaces);
*
* Returns the number of interfaces on success, -1 in case of error.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册