mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
resize: Mark progress bar functions as "noalloc".
Avoids GC overhead and turns these into simple C calls. See: http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html
This commit is contained in:
@@ -80,27 +80,27 @@ virt_resize_progress_bar_init (value machine_readablev)
|
||||
CAMLreturn (barv);
|
||||
}
|
||||
|
||||
/* NB: "noalloc" function. */
|
||||
value
|
||||
virt_resize_progress_bar_reset (value barv)
|
||||
{
|
||||
CAMLparam1 (barv);
|
||||
struct progress_bar *bar = Bar_val (barv);
|
||||
|
||||
progress_bar_reset (bar);
|
||||
|
||||
CAMLreturn (Val_unit);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* NB: "noalloc" function. */
|
||||
value
|
||||
virt_resize_progress_bar_set (value barv,
|
||||
value positionv, value totalv)
|
||||
{
|
||||
CAMLparam3 (barv, positionv, totalv);
|
||||
struct progress_bar *bar = Bar_val (barv);
|
||||
uint64_t position = Int64_val (positionv);
|
||||
uint64_t total = Int64_val (totalv);
|
||||
|
||||
progress_bar_set (bar, position, total);
|
||||
|
||||
CAMLreturn (Val_unit);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ type progress_bar
|
||||
external progress_bar_init : machine_readable:bool -> progress_bar
|
||||
= "virt_resize_progress_bar_init"
|
||||
external progress_bar_reset : progress_bar -> unit
|
||||
= "virt_resize_progress_bar_reset"
|
||||
= "virt_resize_progress_bar_reset" "noalloc"
|
||||
external progress_bar_set : progress_bar -> int64 -> int64 -> unit
|
||||
= "virt_resize_progress_bar_set"
|
||||
= "virt_resize_progress_bar_set" "noalloc"
|
||||
|
||||
let set_up_progress_bar ?(machine_readable = false) (g : Guestfs.guestfs) =
|
||||
(* Only display progress bars if the machine_readable flag is set or
|
||||
|
||||
Reference in New Issue
Block a user