From b549cb36134996b0c9264611ed2d3c84605c7ec1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Fix some bugs in the implementation of virDomainMemoryPeek --- libvirt/libvirt.ml | 2 +- libvirt/libvirt.mli | 4 ++-- libvirt/libvirt_c_oneoffs.c | 10 +++++----- mlvirsh/mlvirsh.ml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libvirt/libvirt.ml b/libvirt/libvirt.ml index 044d4a2..e475e5d 100644 --- a/libvirt/libvirt.ml +++ b/libvirt/libvirt.ml @@ -198,7 +198,7 @@ struct external block_stats : [>`R] t -> string -> block_stats = "ocaml_libvirt_domain_block_stats" external interface_stats : [>`R] t -> string -> interface_stats = "ocaml_libvirt_domain_interface_stats" external block_peek : [>`R] t -> string -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_block_peek_bytecode" "ocaml_libvirt_domain_block_peek_native" - external memory_peek : [>`R] t -> memory_flag -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_memory_peek_bytecode" "ocaml_libvirt_domain_memory_peek_native" + external memory_peek : [>`R] t -> memory_flag list -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_memory_peek_bytecode" "ocaml_libvirt_domain_memory_peek_native" external const : [>`R] t -> ro t = "%identity" end diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli index f08158d..988f0a0 100644 --- a/libvirt/libvirt.mli +++ b/libvirt/libvirt.mli @@ -567,8 +567,8 @@ sig If successful then the data is written into [buf] starting at offset [boff], for [size] bytes. *) - val memory_peek : [>`R] t -> memory_flag -> int64 -> int -> string -> int -> - unit + val memory_peek : [>`R] t -> memory_flag list -> int64 -> int -> + string -> int -> unit (** [memory_peek dom Virtual offset size] reads [size] bytes at [offset] in the domain's virtual memory. diff --git a/libvirt/libvirt_c_oneoffs.c b/libvirt/libvirt_c_oneoffs.c index 14045f6..ff69105 100644 --- a/libvirt/libvirt_c_oneoffs.c +++ b/libvirt/libvirt_c_oneoffs.c @@ -549,7 +549,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 +713,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 +722,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 +739,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; } diff --git a/mlvirsh/mlvirsh.ml b/mlvirsh/mlvirsh.ml index c074bc6..6bf695a 100644 --- a/mlvirsh/mlvirsh.ml +++ b/mlvirsh/mlvirsh.ml @@ -494,7 +494,7 @@ let do_command = cmd3 print_string (fun dom offset size -> let buf = String.create size in - D.memory_peek dom D.Virtual offset size buf 0; + D.memory_peek dom [D.Virtual] offset size buf 0; buf) (arg_readonly_connection domain_of_string) Int64.of_string int_of_string, -- 1.8.3.1