X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=libvirt%2Flibvirt_c_oneoffs.c;h=29a1c05f6781082a5dc97f93f0151a71d90e1399;hb=4c713977ca6e6b2daf1b860f42d40e2ef1ef98b2;hp=14045f643decd5ae74f8d4a81128fdfa0abf8f74;hpb=3b39f65412f3583fb4a3c7c833da09e7c22a64a9;p=ocaml-libvirt.git diff --git a/libvirt/libvirt_c_oneoffs.c b/libvirt/libvirt_c_oneoffs.c index 14045f6..29a1c05 100644 --- a/libvirt/libvirt_c_oneoffs.c +++ b/libvirt/libvirt_c_oneoffs.c @@ -199,15 +199,14 @@ ocaml_libvirt_domain_get_id (value domv) { CAMLparam1 (domv); virDomainPtr dom = Domain_val (domv); - virConnectPtr conn = Connect_domv (domv); + /*virConnectPtr conn = Connect_domv (domv);*/ unsigned int r; NONBLOCKING (r = virDomainGetID (dom)); - /* There's a bug in libvirt which means that if you try to get - * the ID of a defined-but-not-running domain, it returns -1, - * and there's no way to distinguish that from an error. + /* In theory this could return -1 on error, but in practice + * libvirt never does this unless you call it with a corrupted + * or NULL dom object. So ignore errors here. */ - CHECK_ERROR (r == (unsigned int) -1, conn, "virDomainGetID"); CAMLreturn (Val_int ((int) r)); } @@ -549,7 +548,7 @@ ocaml_libvirt_domain_migrate_native (value domv, value dconnv, value flagsv, val for (; flagsv != Val_int (0); flagsv = Field (flagsv, 1)) { flagv = Field (flagsv, 0); - if (flagv == Int_val(0)) + if (flagv == Val_int (0)) flags |= VIR_MIGRATE_LIVE; } @@ -713,7 +712,7 @@ ocaml_libvirt_domain_block_peek_bytecode (value *argv, int argn) #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRDOMAINMEMORYPEEK extern int virDomainMemoryPeek (virDomainPtr domain, - unsigned long long offset, + unsigned long long start, size_t size, void *buffer, unsigned int flags) @@ -722,7 +721,7 @@ extern int virDomainMemoryPeek (virDomainPtr domain, #endif CAMLprim value -ocaml_libvirt_domain_memory_peek_native (value domv, int flagsv, value offsetv, value sizev, value bufferv, value boffv) +ocaml_libvirt_domain_memory_peek_native (value domv, value flagsv, value offsetv, value sizev, value bufferv, value boffv) { #ifdef HAVE_VIRDOMAINMEMORYPEEK CAMLparam5 (domv, flagsv, offsetv, sizev, bufferv); @@ -739,13 +738,13 @@ ocaml_libvirt_domain_memory_peek_native (value domv, int flagsv, value offsetv, /* Check that the return buffer is big enough. */ if (caml_string_length (bufferv) < boff + size) - caml_failwith ("virDomainBlockPeek: return buffer too short"); + caml_failwith ("virDomainMemoryPeek: return buffer too short"); /* Do flags. */ for (; flagsv != Val_int (0); flagsv = Field (flagsv, 1)) { flagv = Field (flagsv, 0); - if (flagv == Int_val (0)) + if (flagv == Val_int (0)) flags |= VIR_MEMORY_VIRTUAL; } @@ -835,41 +834,6 @@ ocaml_libvirt_storage_vol_get_info (value volv) #endif } -#ifdef HAVE_WEAK_SYMBOLS -#ifdef HAVE_VIRJOBGETINFO -extern int virJobGetInfo(virJobPtr job, virJobInfoPtr info) - __attribute__((weak)); -#endif -#endif - -CAMLprim value -ocaml_libvirt_job_get_info (value jobv) -{ -#if HAVE_VIRJOBGETINFO - CAMLparam1 (jobv); - CAMLlocal1 (rv); - virJobPtr job = Job_val (jobv); - virConnectPtr conn = Connect_jobv (jobv); - virJobInfo info; - int r; - - WEAK_SYMBOL_CHECK (virJobGetInfo); - NONBLOCKING (r = virJobGetInfo (job, &info)); - CHECK_ERROR (r == -1, conn, "virJobGetInfo"); - - rv = caml_alloc (5, 0); - Store_field (rv, 0, Val_int (info.type)); - Store_field (rv, 1, Val_int (info.state)); - Store_field (rv, 2, Val_int (info.runningTime)); - Store_field (rv, 3, Val_int (info.remainingTime)); - Store_field (rv, 4, Val_int (info.percentComplete)); - - CAMLreturn (rv); -#else - not_supported ("virJobGetInfo"); -#endif -} - /*----------------------------------------------------------------------*/ CAMLprim value