mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 03:21:19 +00:00
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.
This commit is contained in:
parent
585ad00b5b
commit
016b63bdf0
@ -11523,34 +11523,35 @@ virDomainFSInfoFree(virDomainFSInfoPtr info)
|
|||||||
* The caller *must* free @ifaces when no longer needed. Usual use case
|
* The caller *must* free @ifaces when no longer needed. Usual use case
|
||||||
* looks like this:
|
* looks like this:
|
||||||
*
|
*
|
||||||
* virDomainInterfacePtr *ifaces = NULL;
|
* virDomainInterfacePtr *ifaces = NULL;
|
||||||
* int ifaces_count = 0;
|
* int ifaces_count = 0;
|
||||||
* size_t i, j;
|
* size_t i, j;
|
||||||
* virDomainPtr dom = ... obtain a domain here ...;
|
* virDomainPtr dom = ... obtain a domain here ...;
|
||||||
*
|
*
|
||||||
* if ((ifaces_count = virDomainInterfaceAddresses(dom, &ifaces,
|
* if ((ifaces_count = virDomainInterfaceAddresses(dom, &ifaces,
|
||||||
* VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)) < 0)
|
* VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)) < 0)
|
||||||
* goto cleanup;
|
* goto cleanup;
|
||||||
*
|
*
|
||||||
* ... do something with returned values, for example:
|
* ... 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++) {
|
* for (i = 0; i < ifaces_count; i++) {
|
||||||
* virDomainIPAddressPtr ip_addr = ifaces[i]->addrs + j;
|
* printf("name: %s", ifaces[i]->name);
|
||||||
* printf("[addr: %s prefix: %d type: %d]",
|
* if (ifaces[i]->hwaddr)
|
||||||
* ip_addr->addr, ip_addr->prefix, ip_addr->type);
|
* printf(" hwaddr: %s", ifaces[i]->hwaddr);
|
||||||
* }
|
|
||||||
* printf("\n");
|
|
||||||
* }
|
|
||||||
*
|
*
|
||||||
* cleanup:
|
* for (j = 0; j < ifaces[i]->naddrs; j++) {
|
||||||
* if (ifaces && ifaces_count > 0)
|
* virDomainIPAddressPtr ip_addr = ifaces[i]->addrs + j;
|
||||||
* for (i = 0; i < ifaces_count; i++)
|
* printf("[addr: %s prefix: %d type: %d]",
|
||||||
* virDomainInterfaceFree(ifaces[i]);
|
* ip_addr->addr, ip_addr->prefix, ip_addr->type);
|
||||||
* free(ifaces);
|
* }
|
||||||
|
* 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.
|
* Returns the number of interfaces on success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user