From 2d54c385902ef411f9329d72bc26910d768937d6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Add Domain.max_peek function to determine maximum size of peek requests. --- libvirt/libvirt.ml | 6 ++++++ libvirt/libvirt.mli | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/libvirt/libvirt.ml b/libvirt/libvirt.ml index 5e1a5f2..daf7f38 100644 --- a/libvirt/libvirt.ml +++ b/libvirt/libvirt.ml @@ -152,6 +152,12 @@ struct tx_drop : int64; } + (* The maximum size for Domain.memory_peek and Domain.block_peek + * supported by libvirt. This may change with different versions + * of libvirt in the future, hence it's a function. + *) + let max_peek _ = 65536 + external create_linux : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_domain_create_linux" external create_linux_job : [>`W] Connect.t -> xml -> ([`Domain], rw) job_t = "ocaml_libvirt_domain_create_linux_job" external lookup_by_id : 'a Connect.t -> int -> 'a t = "ocaml_libvirt_domain_lookup_by_id" diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli index 89c6d90..ec945b7 100644 --- a/libvirt/libvirt.mli +++ b/libvirt/libvirt.mli @@ -440,6 +440,11 @@ sig tx_drop : int64; } + val max_peek : [>`R] t -> int + (** Maximum size supported by the {!block_peek} and {!memory_peek} + functions. If you want to peek more than this then you must + break your request into chunks. *) + val create_linux : [>`W] Connect.t -> xml -> rw t (** Create a new guest domain (not necessarily a Linux one) from the given XML. @@ -567,14 +572,18 @@ sig [offset] in the domain's [path] block device. If successful then the data is written into [buf] starting - at offset [boff], for [size] bytes. *) + at offset [boff], for [size] bytes. + + See also {!max_peek}. *) 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. If successful then the data is written into [buf] starting - at offset [boff], for [size] bytes. *) + at offset [boff], for [size] bytes. + + See also {!max_peek}. *) external const : [>`R] t -> ro t = "%identity" (** [const dom] turns a read/write domain handle into a read-only -- 1.8.3.1