mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
libvirtd: fix bug when shrinking number of clients
* daemon/libvirtd.c (qemudRunLoop): Pass allocation size, not current count, to VIR_SHRINK_N. * docs/hacking.html.in: Update doc example. * HACKING: Regenerate.
This commit is contained in:
parent
c73bd6f34a
commit
149c492137
5
HACKING
5
HACKING
@ -347,13 +347,14 @@ scales better, but requires tracking allocation separately from usage)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
- To trim an array of domains to have one less element:
|
- To trim an array of domains from its allocated size down to the actual used
|
||||||
|
size:
|
||||||
|
|
||||||
virDomainPtr domains;
|
virDomainPtr domains;
|
||||||
size_t ndomains = x;
|
size_t ndomains = x;
|
||||||
size_t ndomains_max = y;
|
size_t ndomains_max = y;
|
||||||
|
|
||||||
VIR_SHRINK_N(domains, ndomains_max, 1);
|
VIR_SHRINK_N(domains, ndomains_max, ndomains_max - ndomains);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2362,7 +2362,8 @@ static void *qemudRunLoop(void *opaque) {
|
|||||||
server->clients + i + 1,
|
server->clients + i + 1,
|
||||||
sizeof (*server->clients) * (server->nclients - i));
|
sizeof (*server->clients) * (server->nclients - i));
|
||||||
|
|
||||||
VIR_SHRINK_N(server->clients, server->nclients, 0);
|
VIR_SHRINK_N(server->clients, server->nclients_max,
|
||||||
|
server->nclients_max - server->nclients);
|
||||||
goto reprocess;
|
goto reprocess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,14 +426,15 @@
|
|||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><p>To trim an array of domains to have one less element:</p>
|
<li><p>To trim an array of domains from its allocated size down
|
||||||
|
to the actual used size:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
virDomainPtr domains;
|
virDomainPtr domains;
|
||||||
size_t ndomains = x;
|
size_t ndomains = x;
|
||||||
size_t ndomains_max = y;
|
size_t ndomains_max = y;
|
||||||
|
|
||||||
VIR_SHRINK_N(domains, ndomains_max, 1);
|
VIR_SHRINK_N(domains, ndomains_max, ndomains_max - ndomains);
|
||||||
</pre></li>
|
</pre></li>
|
||||||
|
|
||||||
<li><p>To free an array of domains:</p>
|
<li><p>To free an array of domains:</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user