Index: xen_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xen_internal.c,v retrieving revision 1.43 diff -u -r1.43 xen_internal.c --- xen_internal.c 29 Sep 2006 16:12:08 -0000 1.43 +++ xen_internal.c 2 Oct 2006 19:25:01 -0000 @@ -145,7 +145,15 @@ domlist.v0[n].domain : \ domlist.v2[n].domain) +#define XEN_GETDOMAININFOLIST_DATA(domlist) \ + (hypervisor_version < 2 ? \ + (void*)(domlist->v0) : \ + (void*)(domlist->v2)) +#define XEN_GETDOMAININFO_SIZE \ + (hypervisor_version < 2 ? \ + sizeof(xen_v0_getdomaininfo) : \ + sizeof(xen_v2_getdomaininfo)) #define XEN_GETDOMAININFO_CLEAR(dominfo) \ (hypervisor_version < 2 ? \ @@ -645,7 +653,8 @@ { int ret = -1; - if (mlock(dominfos, sizeof(xen_v0_getdomaininfo) * maxids) < 0) { + if (mlock(XEN_GETDOMAININFOLIST_DATA(dominfos), + XEN_GETDOMAININFO_SIZE * maxids) < 0) { virXenError(VIR_ERR_XEN_CALL, " locking", sizeof(xen_v0_getdomaininfo) * maxids); return (-1); @@ -687,7 +696,8 @@ if (ret == 0) ret = op.u.getdomaininfolist.num_domains; } - if (munlock(dominfos, sizeof(xen_v0_getdomaininfo) * maxids) < 0) { + if (mlock(XEN_GETDOMAININFOLIST_DATA(dominfos), + XEN_GETDOMAININFO_SIZE * maxids) < 0) { virXenError(VIR_ERR_XEN_CALL, " release", sizeof(xen_v0_getdomaininfo)); ret = -1;