search for: set_event_callback

Displaying 20 results from an estimated 34 matches for "set_event_callback".

2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...t/src/bin/event.rs @@ -0,0 +1,29 @@ +extern crate guestfs; +use guestfs::*; + +fn main() { + for _ in 0..256 { + let mut g = match Handle::create() { + Ok(g) => g, + Err(e) => panic!(format!(" could not create handle {:?}", e)), + }; + g.set_event_callback( + |e, _, _, _| match e { + Event::Close => print!("c"), + _ => print!("o"), + }, + &EVENT_ALL, + ) + .unwrap(); + let eh = g + .set_event_callback(|_, _, _, _| print!("...
2015 Feb 10
3
[PATCH 1/3] generator: add a simple HTML escaping function
--- generator/utils.ml | 8 +++++++- generator/utils.mli | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/generator/utils.ml b/generator/utils.ml index b24ba8c..3a62084 100644 --- a/generator/utils.ml +++ b/generator/utils.ml @@ -360,4 +360,10 @@ let args_of_optargs optargs = | OInt64 n -> Int64 n | OString n -> String n | OStringList n ->
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
...t close_invoked = Arc::new(Mutex::new(0)); > > Maybe a thread-safe Arc is not needed for this test -- it's just a > single-threaded test with just one handle. > > > + { > > + let mut g = guestfs::Handle::create().expect("create"); > > + g.set_event_callback( > > + |_, _, _, _| { > > + let mut data = (&close_invoked).lock().unwrap(); > > + *data += 1; > > + }, > > + &[guestfs::Event::Close], > > + ) > > + .unwrap(); > > C...
2015 Oct 06
6
[PATCH 0/4] ocaml: Allow Guestfs.t handle to be garbage collected.
Allow Guestfs.t handle to be garbage collected, and add a regression test.
2019 Jul 30
4
[PATCH] Rust bindings: Implement Event features
...::slice; +use std::sync; + +type GuestfsEventCallback = extern "C" fn( + *const base::guestfs_h, + *const c_void, + u64, + i32, + i32, + *const i8, + usize, + *const u64, + usize, +); + +#[link(name = "guestfs")] +extern "C" { + fn guestfs_set_event_callback( + g: *const base::guestfs_h, + cb: GuestfsEventCallback, + event_bitmask: u64, + flags: i32, + opaque: *const c_void, + ) -> i32; + fn guestfs_delete_event_callback(g: *const base::guestfs_h, eh: i32); + fn guestfs_event_to_string(bitmask: u64) ->...
2017 Mar 03
2
[PATCH] generator: Allow actions to be deprecated with no replacement.
...f /* GUESTFS_WARN_DEPRECATED */ @@ -562,17 +565,17 @@ typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque, int proc_nr, in #endif extern GUESTFS_DLL_PUBLIC void guestfs_set_log_message_callback (guestfs_h *g, guestfs_log_message_cb cb, void *opaque) - GUESTFS_DEPRECATED_BY(\"set_event_callback\"); + GUESTFS_DEPRECATED_REPLACED_BY(\"set_event_callback\"); extern GUESTFS_DLL_PUBLIC void guestfs_set_subprocess_quit_callback (guestfs_h *g, guestfs_subprocess_quit_cb cb, void *opaque) - GUESTFS_DEPRECATED_BY(\"set_event_callback\"); + GUESTFS_DEPRECATED_REPLACED_B...
2012 Jan 18
4
[PATCH 1/4] ocaml: Add -Wno-missing-field-initializers to avoid a warning.
From: "Richard W.M. Jones" <rjones at redhat.com> --- configure.ac | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index fa97479..6e42423 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,10 @@ if test "$gl_gcc_warnings" = yes; then # Work around warning in src/inspect.c. This seems to be a bug in gcc
2019 Jul 31
0
Re: [PATCH] Rust bindings: Implement Event features
...+fn close_event() { > + let close_invoked = Arc::new(Mutex::new(0)); Maybe a thread-safe Arc is not needed for this test -- it's just a single-threaded test with just one handle. > + { > + let mut g = guestfs::Handle::create().expect("create"); > + g.set_event_callback( > + |_, _, _, _| { > + let mut data = (&close_invoked).lock().unwrap(); > + *data += 1; > + }, > + &[guestfs::Event::Close], > + ) > + .unwrap(); Check that the close_invoked count is still 0...
2015 Sep 30
0
[PATCH 2/2] ocaml: Improve ocamldoc.
...need_doc then - pr "(**/**)\n"; - pr "\n"; ) external_functions_sorted; @@ -223,23 +230,30 @@ end class guestfs : ?environment:bool -> ?close_on_exit:bool -> unit -> object method close : unit -> unit + (** See {!Guestfs.close} *) method set_event_callback : event_callback -> event list -> event_handle + (** See {!Guestfs.set_event_callback} *) method delete_event_callback : event_handle -> unit + (** See {!Guestfs.delete_event_callback} *) method last_errno : unit -> int + (** See {!Guestfs.last_errno} *) method ocaml_handle...
2015 Sep 30
3
[PATCH 1/2] ocaml: Use ocamlfind to run ocamldoc.
Using 'ocamlfind ocamldoc' is much faster than running 'ocamldoc' directly, because ocamlfind will run the native code program 'ocamldoc.opt' if it is available. This change approximately halves the time taken to compile the ocaml bindings. --- ocaml/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index
2016 Feb 23
2
[PATCH 1/2] Revert "ruby: Run tests one at a time, instead of in parallel."
It seems the default behaviour of rake is to run tests sequentially, and not in parallel (there are separate gems to achieve that behaviour). Hence just invoke "rake test" to run all the available tests at once. This reverts commit 8f30c3c3f8c063f7c5ff8c6154d881e07a820251. --- ruby/run-ruby-tests | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git
2016 May 04
9
[PATCH 0/8] python: PEP 8 fixes
Hi, this series cleans up the Python sources, either static or generated, including also tests, to make them PEP 8 compliant; see https://www.python.org/dev/peps/pep-0008/ and tools like pep8. Almost all the issues reported by pep8 are fixed, reducing the issues from 3818 to 7. The changes should have no effect on the actual code, while it will help Python users with consistency with other
2012 Dec 13
3
Lua improvements
Here are a few patches I applied to get the Lua bindings to build correctly with different versions of Lua. I am not particularly happy with generating all the test scripts just for the shebang line. Since it has been a while since I had to edit autoconf/automake, this was the best I could come up with. Cheers, -Hilko
2015 Oct 02
1
[PATCH] ruby: improve rdoc markup
...le) * g.close() -> nil * * Call - * +guestfs_close+[http://libguestfs.org/guestfs.3.html#guestfs_close] + * {guestfs_close}[http://libguestfs.org/guestfs.3.html#guestfs_close] * to close the libguestfs handle. */ static VALUE @@ -258,7 +258,7 @@ ruby_guestfs_close (VALUE gv) * g.set_event_callback(cb, event_bitmask) -> event_handle * * Call - * +guestfs_set_event_callback+[http://libguestfs.org/guestfs.3.html#guestfs_set_event_callback] + * {guestfs_set_event_callback}[http://libguestfs.org/guestfs.3.html#guestfs_set_event_callback] * to register an event callback. This returns an...
2019 Apr 03
1
[PATCH] Add missing python bindings tests
...class Test430ProgressMessages(unittest.TestCase): + def test_progress_messages(self): + global callback_invoked + g = guestfs.GuestFS(python_return_dict=True) + g.add_drive('/dev/null') + g.launch() + + events = guestfs.EVENT_PROGRESS + + eh = g.set_event_callback(callback, events) + g.debug('progress', ['5']) + self.assertTrue(callback_invoked > 0) + + callback_invoked = 0 + g.delete_event_callback(eh) + g.debug('progress', ['5']) + self.assertEqual(callback_invoked, 0) + +...
2017 May 21
3
[PATCH 0/2] python: improved UTF8 decoding error handling
The Python 3 bindings currently are unable to deal with non UTF8 characters. This series continues what proposed in RHBZ#1406906. A new function 'set_decode_error_handler' allows the User to specify how to deal with decoding errors. The default behaviour will be raising a UnicodeDecodeError. If the handler is changed to 'surrogateescape', non UTF8 characters will be escaped in a
2023 Feb 14
1
Issue with downloading files whose path contains multi-byte utf-8 characters
...ring features, net stats, disk stats, logging, etc. > http://people.redhat.com/~rjones/virt-top > > > import guestfs > from guestfs import GuestFS > > g = GuestFS(python_return_dict=True) > def callback(event, _event_handle, buf: str, array): > pass > > g.set_event_callback(callback, guestfs.EVENT_ALL) > g.set_verbose(True) > path = '/tmp/tmp_disk' > g.disk_create(path, format='raw', size=32*1024*1024) > g.add_drive(path) > g.launch() > g.mkfs('ext4', '/dev/sda') > g.mount('/dev/sda', '/') > for _...
2015 Oct 06
0
[PATCH 1/4] ocaml: Use generational global roots.
...nerational, but we cannot rely on every - * user having the OCaml 3.11 version which supports this. - */ - caml_register_global_root (v); + caml_register_generational_global_root (v); guestfs_set_private (g, "_ocaml_g", v); CAMLreturn (gv); @@ -255,10 +252,7 @@ ocaml_guestfs_set_event_callback (value gv, value closure, value events) ocaml_guestfs_raise_error (g, "set_event_callback"); } - /* XXX This global root is generational, but we cannot rely on every - * user having the OCaml 3.11 version which supports this. - */ - caml_register_global_root (root); + cam...
2016 Feb 23
0
[PATCH 2/2] ruby: tests: use more asserts instead of manual checks
...c() end diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb index c547613..be62b91 100644 --- a/ruby/t/tc_410_close_event.rb +++ b/ruby/t/tc_410_close_event.rb @@ -29,12 +29,8 @@ class TestLoad < MiniTest::Unit::TestCase # Check that the close event is called. g.set_event_callback(close, Guestfs::EVENT_CLOSE) - if close_invoked != 0 - raise "close_invoked should be 0" - end + assert_equal 0, close_invoked g.close() - if close_invoked != 1 - raise "close_invoked should be 1" - end + assert_equal 1, close_invoked end e...
2017 May 21
0
[PATCH 2/2] python: unicode decode handler error scheme setter
...tfs_int_py_set_decode_error_handler, METH_VARARGS, NULL },\n"; pr " { (char *) \"create\", guestfs_int_py_create, METH_VARARGS, NULL },\n"; pr " { (char *) \"close\", guestfs_int_py_close, METH_VARARGS, NULL },\n"; pr " { (char *) \"set_event_callback\",\n"; @@ -728,6 +731,19 @@ class ClosedHandle(ValueError): pass +def set_decode_error_handler(handler): + \"\"\"Set the error handling scheme to use for the handling + of decoding errors. + The default is 'strict' meaning that decoding errors raise...