提交 ba194861 编写于 作者: I Ilias Stamatis 提交者: Michal Privoznik

virNetworkGetDHCPLeases: fix docstring format

The docstring of virNetworkGetDHCPLeases is not correctly formatted and
as a result the example code snippet appears as normal text under the
"Returns:" section. This patch fixes the problem.
Signed-off-by: NIlias Stamatis <stamatis.iliass@gmail.com>
上级 37cca334
...@@ -1156,8 +1156,7 @@ virConnectNetworkEventDeregisterAny(virConnectPtr conn, ...@@ -1156,8 +1156,7 @@ virConnectNetworkEventDeregisterAny(virConnectPtr conn,
* lease info about a specific guest interface with @mac. There can be * lease info about a specific guest interface with @mac. There can be
* multiple leases for a single @mac because this API supports DHCPv6 too. * multiple leases for a single @mac because this API supports DHCPv6 too.
* *
* Returns the number of leases found or -1 and sets @leases to NULL in * On success, the array stored into @leases is guaranteed to
* case of error. On success, the array stored into @leases is guaranteed to
* have an extra allocated element set to NULL but not included in the return * have an extra allocated element set to NULL but not included in the return
* count, to make iteration easier. The caller is responsible for calling * count, to make iteration easier. The caller is responsible for calling
* virNetworkDHCPLeaseFree() on each array element, then calling free() on @leases. * virNetworkDHCPLeaseFree() on each array element, then calling free() on @leases.
...@@ -1167,30 +1166,33 @@ virConnectNetworkEventDeregisterAny(virConnectPtr conn, ...@@ -1167,30 +1166,33 @@ virConnectNetworkEventDeregisterAny(virConnectPtr conn,
* *
* Example of usage: * Example of usage:
* *
* virNetworkDHCPLeasePtr *leases = NULL; * virNetworkDHCPLeasePtr *leases = NULL;
* virNetworkPtr network = ... obtain a network pointer here ...; * virNetworkPtr network = ... obtain a network pointer here ...;
* size_t i; * size_t i;
* int nleases; * int nleases;
* unsigned int flags = 0; * unsigned int flags = 0;
*
* nleases = virNetworkGetDHCPLeases(network, NULL, &leases, flags);
* if (nleases < 0)
* error();
* *
* nleases = virNetworkGetDHCPLeases(network, NULL, &leases, flags); * ... do something with returned values, for example:
* if (nleases < 0)
* error();
* *
* ... do something with returned values, for example: * for (i = 0; i < nleases; i++) {
* virNetworkDHCPLeasePtr lease = leases[i];
* *
* for (i = 0; i < nleases; i++) { * printf("Time(epoch): %lu, MAC address: %s, "
* virNetworkDHCPLeasePtr lease = leases[i]; * "IP address: %s, Hostname: %s, ClientID: %s\n",
* lease->expirytime, lease->mac, lease->ipaddr,
* lease->hostname, lease->clientid);
* *
* printf("Time(epoch): %lu, MAC address: %s, " * virNetworkDHCPLeaseFree(leases[i]);
* "IP address: %s, Hostname: %s, ClientID: %s\n", * }
* lease->expirytime, lease->mac, lease->ipaddr,
* lease->hostname, lease->clientid);
* *
* virNetworkDHCPLeaseFree(leases[i]); * free(leases);
* }
* *
* free(leases); * Returns the number of leases found or -1 and sets @leases to NULL in
* case of error.
* *
*/ */
int int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册