if ($_ eq "conn") {
"virConnectPtr conn = Connect_val (connv);"
} elsif ($_ eq "dom") {
- "virDomainPtr dom = Domain_val (domv);\n".
- " virConnectPtr conn = Connect_domv (domv);"
+ "virDomainPtr dom = Domain_val (domv);"
} elsif ($_ eq "net") {
- "virNetworkPtr net = Network_val (netv);\n".
- " virConnectPtr conn = Connect_netv (netv);"
+ "virNetworkPtr net = Network_val (netv);"
} elsif ($_ eq "pool") {
- "virStoragePoolPtr pool = Pool_val (poolv);\n".
- " virConnectPtr conn = Connect_polv (poolv);"
+ "virStoragePoolPtr pool = Pool_val (poolv);"
} elsif ($_ eq "vol") {
- "virStorageVolPtr vol = Volume_val (volv);\n".
- " virConnectPtr conn = Connect_volv (volv);"
+ "virStorageVolPtr vol = Volume_val (volv);"
} else {
die "unknown short name $_"
}
char *r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
rv = caml_copy_string (r);
free (r);
const char *r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
rv = caml_copy_string (r);
CAMLreturn (rv);
int r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_int (r));
"
int r;
NONBLOCKING (r = $c_name ($1, uuid));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
/* UUIDs are byte arrays with a fixed length. */
rv = caml_alloc_string (VIR_UUID_BUFLEN);
int r;
NONBLOCKING (r = $c_name ($1, uuid));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
rv = caml_copy_string (uuid);
CAMLreturn (rv);
int r, b;
NONBLOCKING (r = $c_name ($1, &b));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (b ? Val_true : Val_false);
"
b = bv == Val_true ? 1 : 0;
NONBLOCKING (r = $c_name ($1, b));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_unit);
"
}
NONBLOCKING (r = $c_name (conn, ids, i));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i)
}
NONBLOCKING (r = $c_name ($1, names, i));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
char *r;
NONBLOCKING (r = $c_name ($1, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
rv = caml_copy_string (r);
free (r);
int r;
NONBLOCKING (r = $c_name ($1, 0));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_unit);
"
int r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_unit);
"
int r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
/* So that we don't double-free in the finalizer: */
" . gen_free_arg ($1) . "
int r;
NONBLOCKING (r = $c_name ($1, str));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_unit);
"
int r;
NONBLOCKING (r = $c_name ($1, str, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
CAMLreturn (Val_unit);
"
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, str));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, str, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, str, u));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
int r;
NONBLOCKING (r = $c_name ($1, i));
- CHECK_ERROR (r == -1, conn, \"$c_name\");
+ CHECK_ERROR (r == -1, \"$c_name\");
CAMLreturn (Val_unit);
"
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, i));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($3) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, uuid));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, str));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
connv = Field ($3v, 1);
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, str, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
connv = Field ($3v, 1);
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, 0));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
connv = Field ($3v, 1);
" . gen_pack_result ($2) . "
$c_ret_type r;
NONBLOCKING (r = $c_name ($1));
- CHECK_ERROR (!r, conn, \"$c_name\");
+ CHECK_ERROR (!r, \"$c_name\");
connv = Field ($3v, 1);
" . gen_pack_result ($2) . "
int r;
NONBLOCKING (r = virConnectClose (conn));
- CHECK_ERROR (r == -1, conn, "virConnectClose");
+ CHECK_ERROR (r == -1, "virConnectClose");
/* So that we don't double-free in the finalizer: */
Connect_val (connv) = NULL;
char *r;
NONBLOCKING (r = virConnectGetHostname (conn));
- CHECK_ERROR (!r, conn, "virConnectGetHostname");
+ CHECK_ERROR (!r, "virConnectGetHostname");
rv = caml_copy_string (r);
free (r);
char *r;
NONBLOCKING (r = virConnectGetURI (conn));
- CHECK_ERROR (!r, conn, "virConnectGetURI");
+ CHECK_ERROR (!r, "virConnectGetURI");
rv = caml_copy_string (r);
free (r);
const char *r;
NONBLOCKING (r = virConnectGetType (conn));
- CHECK_ERROR (!r, conn, "virConnectGetType");
+ CHECK_ERROR (!r, "virConnectGetType");
rv = caml_copy_string (r);
CAMLreturn (rv);
int r;
NONBLOCKING (r = virConnectNumOfDomains (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
+ CHECK_ERROR (r == -1, "virConnectNumOfDomains");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListDomains (conn, ids, i));
- CHECK_ERROR (r == -1, conn, "virConnectListDomains");
+ CHECK_ERROR (r == -1, "virConnectListDomains");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i)
int r;
NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
+ CHECK_ERROR (r == -1, "virConnectNumOfDefinedDomains");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
- CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
+ CHECK_ERROR (r == -1, "virConnectListDefinedDomains");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
int r;
NONBLOCKING (r = virConnectNumOfNetworks (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
+ CHECK_ERROR (r == -1, "virConnectNumOfNetworks");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListNetworks (conn, names, i));
- CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
+ CHECK_ERROR (r == -1, "virConnectListNetworks");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
int r;
NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
+ CHECK_ERROR (r == -1, "virConnectNumOfDefinedNetworks");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
- CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
+ CHECK_ERROR (r == -1, "virConnectListDefinedNetworks");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
int r;
NONBLOCKING (r = virConnectNumOfStoragePools (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
+ CHECK_ERROR (r == -1, "virConnectNumOfStoragePools");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
- CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
+ CHECK_ERROR (r == -1, "virConnectListStoragePools");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
int r;
NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
- CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
+ CHECK_ERROR (r == -1, "virConnectNumOfDefinedStoragePools");
CAMLreturn (Val_int (r));
}
}
NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
- CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
+ CHECK_ERROR (r == -1, "virConnectListDefinedStoragePools");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
char *r;
NONBLOCKING (r = virConnectGetCapabilities (conn));
- CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
+ CHECK_ERROR (!r, "virConnectGetCapabilities");
rv = caml_copy_string (r);
free (r);
int r;
NONBLOCKING (r = virConnectDomainEventDeregisterAny (conn, i));
- CHECK_ERROR (r == -1, conn, "virConnectDomainEventDeregisterAny");
+ CHECK_ERROR (r == -1, "virConnectDomainEventDeregisterAny");
CAMLreturn (Val_unit);
}
virDomainPtr r;
NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
- CHECK_ERROR (!r, conn, "virDomainCreateLinux");
+ CHECK_ERROR (!r, "virDomainCreateLinux");
rv = Val_domain (r, connv);
virDomainPtr r;
NONBLOCKING (r = virDomainCreateXML (conn, str, u));
- CHECK_ERROR (!r, conn, "virDomainCreateXML");
+ CHECK_ERROR (!r, "virDomainCreateXML");
rv = Val_domain (r, connv);
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainFree (dom));
- CHECK_ERROR (r == -1, conn, "virDomainFree");
+ CHECK_ERROR (r == -1, "virDomainFree");
/* So that we don't double-free in the finalizer: */
Domain_val (domv) = NULL;
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainDestroy (dom));
- CHECK_ERROR (r == -1, conn, "virDomainDestroy");
+ CHECK_ERROR (r == -1, "virDomainDestroy");
/* So that we don't double-free in the finalizer: */
Domain_val (domv) = NULL;
virDomainPtr r;
NONBLOCKING (r = virDomainLookupByName (conn, str));
- CHECK_ERROR (!r, conn, "virDomainLookupByName");
+ CHECK_ERROR (!r, "virDomainLookupByName");
rv = Val_domain (r, connv);
virDomainPtr r;
NONBLOCKING (r = virDomainLookupByID (conn, i));
- CHECK_ERROR (!r, conn, "virDomainLookupByID");
+ CHECK_ERROR (!r, "virDomainLookupByID");
rv = Val_domain (r, connv);
virDomainPtr r;
NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
- CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
+ CHECK_ERROR (!r, "virDomainLookupByUUID");
rv = Val_domain (r, connv);
virDomainPtr r;
NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
- CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
+ CHECK_ERROR (!r, "virDomainLookupByUUIDString");
rv = Val_domain (r, connv);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
const char *r;
NONBLOCKING (r = virDomainGetName (dom));
- CHECK_ERROR (!r, conn, "virDomainGetName");
+ CHECK_ERROR (!r, "virDomainGetName");
rv = caml_copy_string (r);
CAMLreturn (rv);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *r;
NONBLOCKING (r = virDomainGetOSType (dom));
- CHECK_ERROR (!r, conn, "virDomainGetOSType");
+ CHECK_ERROR (!r, "virDomainGetOSType");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *r;
NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
- CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
+ CHECK_ERROR (!r, "virDomainGetXMLDesc");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
unsigned char uuid[VIR_UUID_BUFLEN];
int r;
NONBLOCKING (r = virDomainGetUUID (dom, uuid));
- CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
+ CHECK_ERROR (r == -1, "virDomainGetUUID");
/* UUIDs are byte arrays with a fixed length. */
rv = caml_alloc_string (VIR_UUID_BUFLEN);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char uuid[VIR_UUID_STRING_BUFLEN];
int r;
NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
- CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
+ CHECK_ERROR (r == -1, "virDomainGetUUIDString");
rv = caml_copy_string (uuid);
CAMLreturn (rv);
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainGetMaxVcpus (dom));
- CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
+ CHECK_ERROR (r == -1, "virDomainGetMaxVcpus");
CAMLreturn (Val_int (r));
}
CAMLparam2 (domv, strv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
int r;
NONBLOCKING (r = virDomainSave (dom, str));
- CHECK_ERROR (r == -1, conn, "virDomainSave");
+ CHECK_ERROR (r == -1, "virDomainSave");
CAMLreturn (Val_unit);
}
int r;
NONBLOCKING (r = virDomainRestore (conn, str));
- CHECK_ERROR (r == -1, conn, "virDomainRestore");
+ CHECK_ERROR (r == -1, "virDomainRestore");
CAMLreturn (Val_unit);
}
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
int r;
NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
- CHECK_ERROR (!r, conn, "virDomainCoreDump");
+ CHECK_ERROR (!r, "virDomainCoreDump");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainSuspend (dom));
- CHECK_ERROR (r == -1, conn, "virDomainSuspend");
+ CHECK_ERROR (r == -1, "virDomainSuspend");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainResume (dom));
- CHECK_ERROR (r == -1, conn, "virDomainResume");
+ CHECK_ERROR (r == -1, "virDomainResume");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainShutdown (dom));
- CHECK_ERROR (r == -1, conn, "virDomainShutdown");
+ CHECK_ERROR (r == -1, "virDomainShutdown");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainReboot (dom, 0));
- CHECK_ERROR (r == -1, conn, "virDomainReboot");
+ CHECK_ERROR (r == -1, "virDomainReboot");
CAMLreturn (Val_unit);
}
virDomainPtr r;
NONBLOCKING (r = virDomainDefineXML (conn, str));
- CHECK_ERROR (!r, conn, "virDomainDefineXML");
+ CHECK_ERROR (!r, "virDomainDefineXML");
rv = Val_domain (r, connv);
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainUndefine (dom));
- CHECK_ERROR (r == -1, conn, "virDomainUndefine");
+ CHECK_ERROR (r == -1, "virDomainUndefine");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r;
NONBLOCKING (r = virDomainCreate (dom));
- CHECK_ERROR (r == -1, conn, "virDomainCreate");
+ CHECK_ERROR (r == -1, "virDomainCreate");
CAMLreturn (Val_unit);
}
CAMLparam2 (domv, strv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
int r;
NONBLOCKING (r = virDomainAttachDevice (dom, str));
- CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
+ CHECK_ERROR (r == -1, "virDomainAttachDevice");
CAMLreturn (Val_unit);
}
CAMLparam2 (domv, strv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
int r;
NONBLOCKING (r = virDomainDetachDevice (dom, str));
- CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
+ CHECK_ERROR (r == -1, "virDomainDetachDevice");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r, b;
NONBLOCKING (r = virDomainGetAutostart (dom, &b));
- CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
+ CHECK_ERROR (r == -1, "virDomainGetAutostart");
CAMLreturn (b ? Val_true : Val_false);
}
CAMLparam2 (domv, bv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r, b;
b = bv == Val_true ? 1 : 0;
NONBLOCKING (r = virDomainSetAutostart (dom, b));
- CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
+ CHECK_ERROR (r == -1, "virDomainSetAutostart");
CAMLreturn (Val_unit);
}
CAMLparam1 (netv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r;
NONBLOCKING (r = virNetworkFree (net));
- CHECK_ERROR (r == -1, conn, "virNetworkFree");
+ CHECK_ERROR (r == -1, "virNetworkFree");
/* So that we don't double-free in the finalizer: */
Network_val (netv) = NULL;
CAMLparam1 (netv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r;
NONBLOCKING (r = virNetworkDestroy (net));
- CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
+ CHECK_ERROR (r == -1, "virNetworkDestroy");
/* So that we don't double-free in the finalizer: */
Network_val (netv) = NULL;
virNetworkPtr r;
NONBLOCKING (r = virNetworkLookupByName (conn, str));
- CHECK_ERROR (!r, conn, "virNetworkLookupByName");
+ CHECK_ERROR (!r, "virNetworkLookupByName");
rv = Val_network (r, connv);
virNetworkPtr r;
NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
- CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
+ CHECK_ERROR (!r, "virNetworkLookupByUUID");
rv = Val_network (r, connv);
virNetworkPtr r;
NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
- CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
+ CHECK_ERROR (!r, "virNetworkLookupByUUIDString");
rv = Val_network (r, connv);
CAMLlocal1 (rv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
const char *r;
NONBLOCKING (r = virNetworkGetName (net));
- CHECK_ERROR (!r, conn, "virNetworkGetName");
+ CHECK_ERROR (!r, "virNetworkGetName");
rv = caml_copy_string (r);
CAMLreturn (rv);
CAMLlocal1 (rv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
char *r;
NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
- CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
+ CHECK_ERROR (!r, "virNetworkGetXMLDesc");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
char *r;
NONBLOCKING (r = virNetworkGetBridgeName (net));
- CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
+ CHECK_ERROR (!r, "virNetworkGetBridgeName");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
unsigned char uuid[VIR_UUID_BUFLEN];
int r;
NONBLOCKING (r = virNetworkGetUUID (net, uuid));
- CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
+ CHECK_ERROR (r == -1, "virNetworkGetUUID");
/* UUIDs are byte arrays with a fixed length. */
rv = caml_alloc_string (VIR_UUID_BUFLEN);
CAMLlocal1 (rv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
char uuid[VIR_UUID_STRING_BUFLEN];
int r;
NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
- CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
+ CHECK_ERROR (r == -1, "virNetworkGetUUIDString");
rv = caml_copy_string (uuid);
CAMLreturn (rv);
CAMLparam1 (netv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r;
NONBLOCKING (r = virNetworkUndefine (net));
- CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
+ CHECK_ERROR (r == -1, "virNetworkUndefine");
CAMLreturn (Val_unit);
}
virNetworkPtr r;
NONBLOCKING (r = virNetworkCreateXML (conn, str));
- CHECK_ERROR (!r, conn, "virNetworkCreateXML");
+ CHECK_ERROR (!r, "virNetworkCreateXML");
rv = Val_network (r, connv);
virNetworkPtr r;
NONBLOCKING (r = virNetworkDefineXML (conn, str));
- CHECK_ERROR (!r, conn, "virNetworkDefineXML");
+ CHECK_ERROR (!r, "virNetworkDefineXML");
rv = Val_network (r, connv);
CAMLparam1 (netv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r;
NONBLOCKING (r = virNetworkCreate (net));
- CHECK_ERROR (r == -1, conn, "virNetworkCreate");
+ CHECK_ERROR (r == -1, "virNetworkCreate");
CAMLreturn (Val_unit);
}
CAMLparam1 (netv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r, b;
NONBLOCKING (r = virNetworkGetAutostart (net, &b));
- CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
+ CHECK_ERROR (r == -1, "virNetworkGetAutostart");
CAMLreturn (b ? Val_true : Val_false);
}
CAMLparam2 (netv, bv);
virNetworkPtr net = Network_val (netv);
- virConnectPtr conn = Connect_netv (netv);
int r, b;
b = bv == Val_true ? 1 : 0;
NONBLOCKING (r = virNetworkSetAutostart (net, b));
- CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
+ CHECK_ERROR (r == -1, "virNetworkSetAutostart");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolFree (pool));
- CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
+ CHECK_ERROR (r == -1, "virStoragePoolFree");
/* So that we don't double-free in the finalizer: */
Pool_val (poolv) = NULL;
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolDestroy (pool));
- CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
+ CHECK_ERROR (r == -1, "virStoragePoolDestroy");
/* So that we don't double-free in the finalizer: */
Pool_val (poolv) = NULL;
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
- CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
+ CHECK_ERROR (!r, "virStoragePoolLookupByName");
rv = Val_pool (r, connv);
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
- CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
+ CHECK_ERROR (!r, "virStoragePoolLookupByUUID");
rv = Val_pool (r, connv);
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
- CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
+ CHECK_ERROR (!r, "virStoragePoolLookupByUUIDString");
rv = Val_pool (r, connv);
CAMLlocal1 (rv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
const char *r;
NONBLOCKING (r = virStoragePoolGetName (pool));
- CHECK_ERROR (!r, conn, "virStoragePoolGetName");
+ CHECK_ERROR (!r, "virStoragePoolGetName");
rv = caml_copy_string (r);
CAMLreturn (rv);
CAMLlocal1 (rv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
char *r;
NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
- CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
+ CHECK_ERROR (!r, "virStoragePoolGetXMLDesc");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
unsigned char uuid[VIR_UUID_BUFLEN];
int r;
NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
- CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
+ CHECK_ERROR (r == -1, "virStoragePoolGetUUID");
/* UUIDs are byte arrays with a fixed length. */
rv = caml_alloc_string (VIR_UUID_BUFLEN);
CAMLlocal1 (rv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
char uuid[VIR_UUID_STRING_BUFLEN];
int r;
NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
- CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
+ CHECK_ERROR (r == -1, "virStoragePoolGetUUIDString");
rv = caml_copy_string (uuid);
CAMLreturn (rv);
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
- CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
+ CHECK_ERROR (!r, "virStoragePoolCreateXML");
rv = Val_pool (r, connv);
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
- CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
+ CHECK_ERROR (!r, "virStoragePoolDefineXML");
rv = Val_pool (r, connv);
CAMLparam2 (poolv, iv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
unsigned int i = Int_val (iv);
int r;
NONBLOCKING (r = virStoragePoolBuild (pool, i));
- CHECK_ERROR (r == -1, conn, "virStoragePoolBuild");
+ CHECK_ERROR (r == -1, "virStoragePoolBuild");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolUndefine (pool));
- CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
+ CHECK_ERROR (r == -1, "virStoragePoolUndefine");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolCreate (pool, 0));
- CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
+ CHECK_ERROR (r == -1, "virStoragePoolCreate");
CAMLreturn (Val_unit);
}
CAMLparam2 (poolv, iv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
unsigned int i = Int_val (iv);
int r;
NONBLOCKING (r = virStoragePoolDelete (pool, i));
- CHECK_ERROR (r == -1, conn, "virStoragePoolDelete");
+ CHECK_ERROR (r == -1, "virStoragePoolDelete");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
- CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
+ CHECK_ERROR (r == -1, "virStoragePoolRefresh");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r, b;
NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
- CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
+ CHECK_ERROR (r == -1, "virStoragePoolGetAutostart");
CAMLreturn (b ? Val_true : Val_false);
}
CAMLparam2 (poolv, bv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r, b;
b = bv == Val_true ? 1 : 0;
NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
- CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
+ CHECK_ERROR (r == -1, "virStoragePoolSetAutostart");
CAMLreturn (Val_unit);
}
CAMLparam1 (poolv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int r;
NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
- CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
+ CHECK_ERROR (r == -1, "virStoragePoolNumOfVolumes");
CAMLreturn (Val_int (r));
}
CAMLlocal2 (rv, strv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
int i = Int_val (iv);
char *names[i];
int r;
}
NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
- CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
+ CHECK_ERROR (r == -1, "virStoragePoolListVolumes");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
CAMLparam1 (volv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
int r;
NONBLOCKING (r = virStorageVolFree (vol));
- CHECK_ERROR (r == -1, conn, "virStorageVolFree");
+ CHECK_ERROR (r == -1, "virStorageVolFree");
/* So that we don't double-free in the finalizer: */
Volume_val (volv) = NULL;
CAMLparam2 (volv, iv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
unsigned int i = Int_val (iv);
int r;
NONBLOCKING (r = virStorageVolDelete (vol, i));
- CHECK_ERROR (r == -1, conn, "virStorageVolDelete");
+ CHECK_ERROR (r == -1, "virStorageVolDelete");
CAMLreturn (Val_unit);
}
CAMLlocal2 (rv, connv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
char *str = String_val (strv);
virStorageVolPtr r;
NONBLOCKING (r = virStorageVolLookupByName (pool, str));
- CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
+ CHECK_ERROR (!r, "virStorageVolLookupByName");
connv = Field (poolv, 1);
rv = Val_volume (r, connv);
virStorageVolPtr r;
NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
- CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
+ CHECK_ERROR (!r, "virStorageVolLookupByKey");
rv = Val_volume (r, connv);
virStorageVolPtr r;
NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
- CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
+ CHECK_ERROR (!r, "virStorageVolLookupByPath");
rv = Val_volume (r, connv);
CAMLlocal2 (rv, connv);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
char *str = String_val (strv);
virStorageVolPtr r;
NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
- CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
+ CHECK_ERROR (!r, "virStorageVolCreateXML");
connv = Field (poolv, 1);
rv = Val_volume (r, connv);
CAMLlocal1 (rv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
char *r;
NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
- CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
+ CHECK_ERROR (!r, "virStorageVolGetXMLDesc");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
char *r;
NONBLOCKING (r = virStorageVolGetPath (vol));
- CHECK_ERROR (!r, conn, "virStorageVolGetPath");
+ CHECK_ERROR (!r, "virStorageVolGetPath");
rv = caml_copy_string (r);
free (r);
CAMLlocal1 (rv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
const char *r;
NONBLOCKING (r = virStorageVolGetKey (vol));
- CHECK_ERROR (!r, conn, "virStorageVolGetKey");
+ CHECK_ERROR (!r, "virStorageVolGetKey");
rv = caml_copy_string (r);
CAMLreturn (rv);
CAMLlocal1 (rv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
const char *r;
NONBLOCKING (r = virStorageVolGetName (vol));
- CHECK_ERROR (!r, conn, "virStorageVolGetName");
+ CHECK_ERROR (!r, "virStorageVolGetName");
rv = caml_copy_string (r);
CAMLreturn (rv);
CAMLlocal2 (rv, connv);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
virStoragePoolPtr r;
NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
- CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
+ CHECK_ERROR (!r, "virStoragePoolLookupByVolume");
connv = Field (volv, 1);
rv = Val_pool (r, connv);
typeVer_ptr = driver ? &typeVer : NULL;
NONBLOCKING (r = virGetVersion (&libVer, driver, typeVer_ptr));
- CHECK_ERROR (r == -1, NULL, "virGetVersion");
+ CHECK_ERROR (r == -1, "virGetVersion");
rv = caml_alloc_tuple (2);
Store_field (rv, 0, Val_int (libVer));
virConnectPtr conn;
NONBLOCKING (conn = virConnectOpen (name));
- CHECK_ERROR (!conn, NULL, "virConnectOpen");
+ CHECK_ERROR (!conn, "virConnectOpen");
rv = Val_connect (conn);
virConnectPtr conn;
NONBLOCKING (conn = virConnectOpenReadOnly (name));
- CHECK_ERROR (!conn, NULL, "virConnectOpen");
+ CHECK_ERROR (!conn, "virConnectOpen");
rv = Val_connect (conn);
int r;
NONBLOCKING (r = virConnectGetVersion (conn, &hvVer));
- CHECK_ERROR (r == -1, conn, "virConnectGetVersion");
+ CHECK_ERROR (r == -1, "virConnectGetVersion");
CAMLreturn (Val_int (hvVer));
}
int r;
NONBLOCKING (r = virConnectGetMaxVcpus (conn, type));
- CHECK_ERROR (r == -1, conn, "virConnectGetMaxVcpus");
+ CHECK_ERROR (r == -1, "virConnectGetMaxVcpus");
CAMLreturn (Val_int (r));
}
int r;
NONBLOCKING (r = virNodeGetInfo (conn, &info));
- CHECK_ERROR (r == -1, conn, "virNodeGetInfo");
+ CHECK_ERROR (r == -1, "virNodeGetInfo");
rv = caml_alloc (8, 0);
v = caml_copy_string (info.model); Store_field (rv, 0, v);
unsigned long long r;
NONBLOCKING (r = virNodeGetFreeMemory (conn));
- CHECK_ERROR (r == 0, conn, "virNodeGetFreeMemory");
+ CHECK_ERROR (r == 0, "virNodeGetFreeMemory");
rv = caml_copy_int64 ((int64_t) r);
CAMLreturn (rv);
unsigned long long freemems[max];
NONBLOCKING (r = virNodeGetCellsFreeMemory (conn, freemems, start, max));
- CHECK_ERROR (r == -1, conn, "virNodeGetCellsFreeMemory");
+ CHECK_ERROR (r == -1, "virNodeGetCellsFreeMemory");
rv = caml_alloc (r, 0);
for (i = 0; i < r; ++i) {
int r;
NONBLOCKING(r = virConnectSetKeepAlive(conn, interval, count));
- CHECK_ERROR (r == -1, conn, "virConnectSetKeepAlive");
+ CHECK_ERROR (r == -1, "virConnectSetKeepAlive");
CAMLreturn(Val_unit);
}
{
CAMLparam1 (domv);
virDomainPtr dom = Domain_val (domv);
- /*virConnectPtr conn = Connect_domv (domv);*/
unsigned int r;
NONBLOCKING (r = virDomainGetID (dom));
CAMLparam1 (domv);
CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
unsigned long r;
NONBLOCKING (r = virDomainGetMaxMemory (dom));
- CHECK_ERROR (r == 0 /* [sic] */, conn, "virDomainGetMaxMemory");
+ CHECK_ERROR (r == 0 /* [sic] */, "virDomainGetMaxMemory");
rv = caml_copy_int64 (r);
CAMLreturn (rv);
{
CAMLparam2 (domv, memv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
unsigned long mem = Int64_val (memv);
int r;
NONBLOCKING (r = virDomainSetMaxMemory (dom, mem));
- CHECK_ERROR (r == -1, conn, "virDomainSetMaxMemory");
+ CHECK_ERROR (r == -1, "virDomainSetMaxMemory");
CAMLreturn (Val_unit);
}
{
CAMLparam2 (domv, memv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
unsigned long mem = Int64_val (memv);
int r;
NONBLOCKING (r = virDomainSetMemory (dom, mem));
- CHECK_ERROR (r == -1, conn, "virDomainSetMemory");
+ CHECK_ERROR (r == -1, "virDomainSetMemory");
CAMLreturn (Val_unit);
}
CAMLparam1 (domv);
CAMLlocal2 (rv, v);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
virDomainInfo info;
int r;
NONBLOCKING (r = virDomainGetInfo (dom, &info));
- CHECK_ERROR (r == -1, conn, "virDomainGetInfo");
+ CHECK_ERROR (r == -1, "virDomainGetInfo");
rv = caml_alloc (5, 0);
Store_field (rv, 0, Val_int (info.state)); // These flags are compatible.
CAMLparam1 (domv);
CAMLlocal2 (rv, strv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *r;
int nparams;
NONBLOCKING (r = virDomainGetSchedulerType (dom, &nparams));
- CHECK_ERROR (!r, conn, "virDomainGetSchedulerType");
+ CHECK_ERROR (!r, "virDomainGetSchedulerType");
rv = caml_alloc_tuple (2);
strv = caml_copy_string (r); Store_field (rv, 0, strv);
CAMLparam2 (domv, nparamsv);
CAMLlocal4 (rv, v, v2, v3);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int nparams = Int_val (nparamsv);
virSchedParameter params[nparams];
int r, i;
NONBLOCKING (r = virDomainGetSchedulerParameters (dom, params, &nparams));
- CHECK_ERROR (r == -1, conn, "virDomainGetSchedulerParameters");
+ CHECK_ERROR (r == -1, "virDomainGetSchedulerParameters");
rv = caml_alloc (nparams, 0);
for (i = 0; i < nparams; ++i) {
CAMLparam2 (domv, paramsv);
CAMLlocal1 (v);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int nparams = Wosize_val (paramsv);
virSchedParameter params[nparams];
int r, i;
}
NONBLOCKING (r = virDomainSetSchedulerParameters (dom, params, nparams));
- CHECK_ERROR (r == -1, conn, "virDomainSetSchedulerParameters");
+ CHECK_ERROR (r == -1, "virDomainSetSchedulerParameters");
CAMLreturn (Val_unit);
}
{
CAMLparam2 (domv, nvcpusv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int r, nvcpus = Int_val (nvcpusv);
NONBLOCKING (r = virDomainSetVcpus (dom, nvcpus));
- CHECK_ERROR (r == -1, conn, "virDomainSetVcpus");
+ CHECK_ERROR (r == -1, "virDomainSetVcpus");
CAMLreturn (Val_unit);
}
{
CAMLparam3 (domv, vcpuv, cpumapv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int maplen = caml_string_length (cpumapv);
unsigned char *cpumap = (unsigned char *) String_val (cpumapv);
int vcpu = Int_val (vcpuv);
int r;
NONBLOCKING (r = virDomainPinVcpu (dom, vcpu, cpumap, maplen));
- CHECK_ERROR (r == -1, conn, "virDomainPinVcpu");
+ CHECK_ERROR (r == -1, "virDomainPinVcpu");
CAMLreturn (Val_unit);
}
CAMLparam3 (domv, maxinfov, maplenv);
CAMLlocal5 (rv, infov, strv, v, v2);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int maxinfo = Int_val (maxinfov);
int maplen = Int_val (maplenv);
virVcpuInfo info[maxinfo];
memset (cpumaps, 0, maxinfo * maplen);
NONBLOCKING (r = virDomainGetVcpus (dom, info, maxinfo, cpumaps, maplen));
- CHECK_ERROR (r == -1, conn, "virDomainPinVcpu");
+ CHECK_ERROR (r == -1, "virDomainPinVcpu");
/* Copy the virVcpuInfo structures. */
infov = caml_alloc (maxinfo, 0);
CAMLlocal5 (cpustats, param_head, param_node, typed_param, typed_param_value);
CAMLlocal1 (v);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
virTypedParameterPtr params;
int r, cpu, ncpus, nparams, i, j, pos;
int nr_pcpus;
/* get number of pcpus */
NONBLOCKING (nr_pcpus = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0));
- CHECK_ERROR (nr_pcpus < 0, conn, "virDomainGetCPUStats");
+ CHECK_ERROR (nr_pcpus < 0, "virDomainGetCPUStats");
/* get percpu information */
NONBLOCKING (nparams = virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0));
- CHECK_ERROR (nparams < 0, conn, "virDomainGetCPUStats");
+ CHECK_ERROR (nparams < 0, "virDomainGetCPUStats");
if ((params = malloc(sizeof(*params) * nparams * 128)) == NULL)
caml_failwith ("virDomainGetCPUStats: malloc");
ncpus = nr_pcpus - cpu > 128 ? 128 : nr_pcpus - cpu;
NONBLOCKING (r = virDomainGetCPUStats(dom, params, nparams, cpu, ncpus, 0));
- CHECK_ERROR (r < 0, conn, "virDomainGetCPUStats");
+ CHECK_ERROR (r < 0, "virDomainGetCPUStats");
for (i = 0; i < ncpus; i++) {
/* list of typed_param: single linked list of param_nodes */
CAMLxparam2 (optbandwidthv, unitv);
CAMLlocal2 (flagv, rv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
virConnectPtr dconn = Connect_val (dconnv);
int flags = 0;
const char *dname = Optstring_val (optdnamev);
bandwidth = Int_val (Field (optbandwidthv, 0));
NONBLOCKING (r = virDomainMigrate (dom, dconn, flags, dname, uri, bandwidth));
- CHECK_ERROR (!r, conn, "virDomainMigrate");
+ CHECK_ERROR (!r, "virDomainMigrate");
rv = Val_domain (r, dconnv);
CAMLparam2 (domv, pathv);
CAMLlocal2 (rv,v);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *path = String_val (pathv);
struct _virDomainBlockStats stats;
int r;
NONBLOCKING (r = virDomainBlockStats (dom, path, &stats, sizeof stats));
- CHECK_ERROR (r == -1, conn, "virDomainBlockStats");
+ CHECK_ERROR (r == -1, "virDomainBlockStats");
rv = caml_alloc (5, 0);
v = caml_copy_int64 (stats.rd_req); Store_field (rv, 0, v);
CAMLparam2 (domv, pathv);
CAMLlocal2 (rv,v);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
char *path = String_val (pathv);
struct _virDomainInterfaceStats stats;
int r;
NONBLOCKING (r = virDomainInterfaceStats (dom, path, &stats, sizeof stats));
- CHECK_ERROR (r == -1, conn, "virDomainInterfaceStats");
+ CHECK_ERROR (r == -1, "virDomainInterfaceStats");
rv = caml_alloc (8, 0);
v = caml_copy_int64 (stats.rx_bytes); Store_field (rv, 0, v);
CAMLparam5 (domv, pathv, offsetv, sizev, bufferv);
CAMLxparam1 (boffv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
const char *path = String_val (pathv);
unsigned long long offset = Int64_val (offsetv);
size_t size = Int_val (sizev);
/* NB. not NONBLOCKING because buffer might move (XXX) */
r = virDomainBlockPeek (dom, path, offset, size, buffer+boff, 0);
- CHECK_ERROR (r == -1, conn, "virDomainBlockPeek");
+ CHECK_ERROR (r == -1, "virDomainBlockPeek");
CAMLreturn (Val_unit);
}
CAMLxparam1 (boffv);
CAMLlocal1 (flagv);
virDomainPtr dom = Domain_val (domv);
- virConnectPtr conn = Connect_domv (domv);
int flags = 0;
unsigned long long offset = Int64_val (offsetv);
size_t size = Int_val (sizev);
/* NB. not NONBLOCKING because buffer might move (XXX) */
r = virDomainMemoryPeek (dom, offset, size, buffer+boff, flags);
- CHECK_ERROR (r == -1, conn, "virDomainMemoryPeek");
+ CHECK_ERROR (r == -1, "virDomainMemoryPeek");
CAMLreturn (Val_unit);
}
ocaml_libvirt_event_add_timeout (value connv, value ms, value callback_id)
{
CAMLparam3 (connv, ms, callback_id);
- virConnectPtr conn = Connect_val (connv);
void *opaque;
virFreeCallback freecb = free;
virEventTimeoutCallback cb = timeout_callback;
caml_failwith ("virEventAddTimeout: malloc");
*((long*)opaque) = Int64_val(callback_id);
NONBLOCKING(r = virEventAddTimeout(Int_val(ms), cb, opaque, freecb));
- CHECK_ERROR(r == -1, conn, "virEventAddTimeout");
+ CHECK_ERROR(r == -1, "virEventAddTimeout");
CAMLreturn(Val_int(r));
}
ocaml_libvirt_event_remove_timeout (value connv, value timer_id)
{
CAMLparam2 (connv, timer_id);
- virConnectPtr conn = Connect_val (connv);
int r;
NONBLOCKING(r = virEventRemoveTimeout(Int_val(timer_id)));
- CHECK_ERROR(r == -1, conn, "virEventRemoveTimeout");
+ CHECK_ERROR(r == -1, "virEventRemoveTimeout");
CAMLreturn(Val_int(r));
}
caml_failwith ("virConnectDomainEventRegisterAny: malloc");
*((long*)opaque) = Int64_val(callback_id);
NONBLOCKING(r = virConnectDomainEventRegisterAny(conn, dom, eventID, cb, opaque, freecb));
- CHECK_ERROR(r == -1, conn, "virConnectDomainEventRegisterAny");
+ CHECK_ERROR(r == -1, "virConnectDomainEventRegisterAny");
CAMLreturn(Val_int(r));
}
CAMLparam1 (poolv);
CAMLlocal2 (rv, v);
virStoragePoolPtr pool = Pool_val (poolv);
- virConnectPtr conn = Connect_polv (poolv);
virStoragePoolInfo info;
int r;
NONBLOCKING (r = virStoragePoolGetInfo (pool, &info));
- CHECK_ERROR (r == -1, conn, "virStoragePoolGetInfo");
+ CHECK_ERROR (r == -1, "virStoragePoolGetInfo");
rv = caml_alloc (4, 0);
Store_field (rv, 0, Val_int (info.state));
CAMLparam1 (volv);
CAMLlocal2 (rv, v);
virStorageVolPtr vol = Volume_val (volv);
- virConnectPtr conn = Connect_volv (volv);
virStorageVolInfo info;
int r;
NONBLOCKING (r = virStorageVolGetInfo (vol, &info));
- CHECK_ERROR (r == -1, conn, "virStorageVolGetInfo");
+ CHECK_ERROR (r == -1, "virStorageVolGetInfo");
rv = caml_alloc (3, 0);
Store_field (rv, 0, Val_int (info.type));
/*----------------------------------------------------------------------*/
+static void
+ignore_errors (void *user_data, virErrorPtr error)
+{
+ /* do nothing */
+}
+
/* Initialise the library. */
CAMLprim value
ocaml_libvirt_init (value unit)
CAMLlocal1 (rv);
int r;
+ virSetErrorFunc (NULL, ignore_errors);
r = virInitialize ();
- CHECK_ERROR (r == -1, NULL, "virInitialize");
+ CHECK_ERROR (r == -1, "virInitialize");
CAMLreturn (Val_unit);
}