[libvirt-users] How to lookup the driver instance through virConnectPtr pointer

Dennis Chen dennis.chen at tnsoft.com.cn
Wed Nov 21 09:24:18 UTC 2012


I plan to use virCgroupSetCpuCfsPeriod() and virCgroupSetCpuCfsQuota() 
to control cpu bandwidth with help of cgroup,
so I need to instantiate the cgroup parameter first for the calling of 
virCgroupSetCpuCfsPeriod, below is my code piece:

1        virConnectPtr conn;
2        struct qemud_driver *driver;

3        conn = virConnectOpen("qemu:///system");
4        driver = conn->privateData;
5        virCgroupSetCpuCfsPeriod(driver->cgroup, cfs_period);

then I get an compiling error in line 4:
error: dereferencing pointer to incomplete type

I know the reason is the actual definition of virConnectPtr is in 
datatyps.h, but it's not reasonable or ugly to include this file in
my project.

So my question is, is there any API that I can get the driver instance 
from virConnectPtr conn in the libvirt?


More information about the libvirt-users mailing list