search for: event_to_string

Displaying 17 results from an estimated 17 matches for "event_to_string".

2019 Jul 30
4
[PATCH] Rust bindings: Implement Event features
...{ + 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) -> *const c_char; + fn free(buf: *const c_void); +} + +#[derive(Hash, PartialEq, Eq)] +pub struct EventHandle { + eh: i32, +} + +pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8], &[u64]); + +fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { + l...
2015 Sep 30
0
[PATCH 2/2] ocaml: Improve ocamldoc.
...e compact. *) +(** {3 Handles} *) + type t (** A [guestfs_h] handle. *) @@ -88,6 +90,8 @@ val close : t -> unit unreferenced, but callers can call this in order to provide predictable cleanup. *) +(** {3 Events} *) + type event = "; List.iter ( @@ -125,6 +129,8 @@ val event_to_string : event list -> string (** [event_to_string events] returns the event(s) as a printable string for debugging etc. *) +(** {3 Errors} *) + val last_errno : t -> int (** [last_errno g] returns the last errno that happened on the handle [g] (or [0] if there was no errno). Note th...
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
2019 Jul 30
0
Re: [PATCH] Rust bindings: Implement Event features
...back( >+ 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) -> *const c_char; >+ fn free(buf: *const c_void); >+} >+ >+#[derive(Hash, PartialEq, Eq)] >+pub struct EventHandle { >+ eh: i32, >+} >+ >+pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8], &[u64]); >+ >+fn events_to_bitmask(...
2019 Jul 31
0
Re: [PATCH] Rust bindings: Implement Event features
...Hiroyuki Katsura wrote: > This patch includes: > > - Event callback handlers > - Tests related to events(410-430) > --- Would it be possible to split the Handle -> Handle<'a> change in an own small patch? This way it can be documented why it was changed. > +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, error::Error> { > + let bitmask = events_to_bitmask(events); > + > + let r = unsafe { guestfs_event_to_string(bitmask) }; > + if r.is_null() { > + Err(error::unix_error("event_to_string")) > + }...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
...ncludes: > > > > - Event callback handlers > > - Tests related to events(410-430) > > --- > > Would it be possible to split the Handle -> Handle<'a> change in an own > small patch? This way it can be documented why it was changed. > > > +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, > error::Error> { > > + let bitmask = events_to_bitmask(events); > > + > > + let r = unsafe { guestfs_event_to_string(bitmask) }; > > + if r.is_null() { > > + Err(error::unix_error("event...
2015 Oct 02
1
[PATCH] ruby: improve rdoc markup
...tfs.3.html#guestfs_delete_event_callback] + * {guestfs_delete_event_callback}[http://libguestfs.org/guestfs.3.html#guestfs_delete_event_callback] * to delete an event callback. */ static VALUE @@ -328,7 +328,7 @@ ruby_delete_event_callback (VALUE gv, VALUE event_handlev) * Guestfs::Guestfs.event_to_string(events) -> string * * Call - * +guestfs_event_to_string+[http://libguestfs.org/guestfs.3.html#guestfs_event_to_string] + * {guestfs_event_to_string}[http://libguestfs.org/guestfs.3.html#guestfs_event_to_string] * to convert an event or event bitmask into a printable string. */ static VA...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...{ + 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) -> *const c_char; + fn free(buf: *const c_void); +} + #[derive(Hash, PartialEq, Eq)] pub struct EventHandle { eh: i32, } + +fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { + let mut r = 0u64; + for x in v.iter() { + r |= x.to_u64(); + } + r...
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
2019 Jul 30
1
Re: [PATCH] Rust bindings: Implement Event features
...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) -> *const c_char; > >+ fn free(buf: *const c_void); > >+} > >+ > >+#[derive(Hash, PartialEq, Eq)] > >+pub struct EventHandle { > >+ eh: i32, > >+} > >+ > >+pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8],...
2015 Jun 18
3
[PATCH v2 0/3] daemon: parted: Always use -s option even with -m.
version 2: - Turn the "unrecognised disk label" error into errno == EINVAL - Fix virt-alignment-scan - Rework the fix for virt-v2v bug 1232192 (see description of patch 3/3)
2015 Aug 24
3
[PATCH 1/3] ocaml: dynamically generate the content of Guestfs.Errno
...o}. *) module Errno : sig - val errno_EINVAL : int - val errno_ENOTSUP : int - val errno_EPERM : int - val errno_ESRCH : int +"; + List.iter ( + fun e -> + pr " val errno_%s : int\n" e + ) ocaml_errnos; + pr "\ end "; @@ -287,14 +297,15 @@ external event_to_string : event list -> string external last_errno : t -> int = \"ocaml_guestfs_last_errno\" module Errno = struct - external einval : unit -> int = \"ocaml_guestfs_get_EINVAL\" \"noalloc\" - let errno_EINVAL = einval () - external enotsup : unit -> int = \&...
2014 Mar 17
4
[PATCH 1/4] ocaml: Add Guestfs.Errno submodule exposing useful raw errno numbers.
...eration on [g]. *) +(** The [Guestfs.Errno] submodule exposes some raw errno numbers, + which you can use to test the return value of {!Guestfs.last_errno}. *) + +module Errno : sig + val errno_ENOTSUP : int +end + "; generate_ocaml_structure_decls (); @@ -253,6 +263,11 @@ external event_to_string : event list -> string external last_errno : t -> int = \"ocaml_guestfs_last_errno\" +module Errno = struct + external enotsup : unit -> int = \"ocaml_guestfs_get_ENOTSUP\" \"noalloc\" + let errno_ENOTSUP = enotsup () +end + (* Give the exceptions name...
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...initialize, -1); rb_define_method (c_guestfs, \"close\", ruby_guestfs_close, 0); rb_define_method (c_guestfs, \"set_event_callback\", ruby_set_event_callback, 2); @@ -719,6 +772,11 @@ Init__guestfs (void) rb_define_module_function (m_guestfs, \"event_to_string\", ruby_event_to_string, 1); + /* For backwards compatibility with older code, define a ::create + * module function. + */ + rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, -1); + "; (* Constants. *) diff --git a/ruby/t/t...
2016 Feb 22
3
[PATCH 1/3] python: tests: refactor to use unittest's discovery
...oked = 0 - -def log_callback (ev,eh,buf,array): - global log_invoked - log_invoked += 1 - - if ev == guestfs.EVENT_APPLIANCE: - buf = buf.rstrip() - - # Log what happened. - print ("python event logged: event=%s eh=%d buf='%s' array=%s" % - (guestfs.event_to_string (ev), eh, buf, array)) - -class Test420LogMessages (unittest.TestCase): - def test_log_messages (self): - g = guestfs.GuestFS (python_return_dict=True) - - # Register an event callback for all log messages. - events = guestfs.EVENT_APPLIANCE | guestfs.EVENT_LIBRARY \ -...
2017 Oct 04
0
[PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.
...arg_prefix } -> pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase_ascii c_name); pr "PyObject *\n"; pr "guestfs_int_py_%s (PyObject *self, PyObject *args)\n" name; @@ -585,7 +583,7 @@ and generate_python_module () = pr " { (char *) \"event_to_string\",\n"; pr " guestfs_int_py_event_to_string, METH_VARARGS, NULL },\n"; List.iter ( - fun { name = name; c_name = c_name } -> + fun { name; c_name } -> pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase_ascii c_name); pr " { (char *)...
2017 Oct 04
11
[PATCH 0/9] build: Require OCaml >= 4.02.
Per my previous email: https://www.redhat.com/archives/libguestfs/2017-September/msg00203.html I'd like to talk about requiring a more modern version of the OCaml compiler. These commits show some of the code changes which would be possible with OCaml >= 3.12 [which it turns out we already require by accident] and also with OCaml >= 4.02. The latter is my favoured option. Rich.