[Libvir] Proposal: Block device and network stats

Richard W.M. Jones rjones at redhat.com
Fri Aug 10 14:41:54 UTC 2007


Daniel P. Berrange wrote:
> It is probably worthwhile though to
> ensure that we design the APIs so that the structs are always allocated by
> the internal driver and not the caller. This allows us to add more fields
> at a later date if needed.

Instead of the above, the caller has to pass in the size of the struct.

Pros to passing in the struct & size:

* New caller / old libvirt can be detected, rather than causing a segfault.
* Caller is less likely to forget to free the struct (because it is 
mostly likely on their stack, or they explicitly malloc'd it).

But yes, unsafe C linkage & lack of garbage collection sucks ...

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070810/356e7c8d/attachment-0001.bin>


More information about the libvir-list mailing list