search for: guestfs_create_no_environment

Displaying 20 results from an estimated 29 matches for "guestfs_create_no_environment".

2016 May 05
1
[PATCH] python: use constants instead of raw values
...if (m != NULL) + guestfs_int_py_extend_module (m); + return m; /* m might be NULL if module init failed */ } @@ -719,9 +722,9 @@ class GuestFS(object): \"\"\" flags = 0 if not environment: - flags |= 1 + flags |= libguestfsmod.GUESTFS_CREATE_NO_ENVIRONMENT if not close_on_exit: - flags |= 2 + flags |= libguestfsmod.GUESTFS_CREATE_NO_CLOSE_ON_EXIT self._o = libguestfsmod.create(flags) self._python_return_dict = python_return_dict diff --git a/python/guestfs-py-byhand.c b/python/guestfs-py-byhand.c ind...
2013 Jul 17
2
Redirecting libguestfs error messages
Hi, When I register a callback for events with this function call: eh = guestfs_set_event_callback(g, message_callback, GUESTFS_EVENT_ALL, 0, dev); Shouldnt it capture and redirect messages like this to message_callback(): "libguestfs: error: lstat: /.Trash: No such file or directory" I still get them in stderr .. Thanks, Or
2019 Jun 27
0
[PATCH 2/9] Rust bindings: Add create / close functions
...ile + generate_header CStyle LGPLv2plus; + + pr " +#[allow(non_camel_case_types)] +enum guestfs_h {} + +extern \"C\" { + fn guestfs_create() -> *mut guestfs_h; + fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; + fn guestfs_close(g: *mut guestfs_h); + static GUESTFS_CREATE_NO_ENVIRONMENT: i64; + static GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64; +} + +pub struct Handle { + g: *mut guestfs_h, +} + +impl Drop for Handle { + fn drop(&mut self) { + unsafe { guestfs_close(self.g) } + } +} + +pub struct CreateFlags { + create_no_environment_flag: bool, + create_no_...
2013 Jul 17
0
Re: Redirecting libguestfs error messages
...ight. Error messages are handled by a separate path from log/trace/debug messages. It's possible to capture error messages and send them somewhere else (or nowhere). Here's how to do it from C: (1) Replace guestfs_create with guestfs_create_flags: guestfs_h *g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT); if (!g) { /* guestfs_create_flags with the flag GUESTFS_CREATE_NO_ENVIRONMENT * never prints anything on stderr. If it fails, it sets the * global errno. So something like this should be used: */ fprintf (logfp, "error: %s\n", strerror (errno)); exit (EXIT...
2013 Jul 17
1
Re: Redirecting libguestfs error messages
...a separate path from > log/trace/debug messages. > > It's possible to capture error messages and send them somewhere else > (or nowhere). Here's how to do it from C: > > (1) Replace guestfs_create with guestfs_create_flags: > > guestfs_h *g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT); > if (!g) { > /* guestfs_create_flags with the flag GUESTFS_CREATE_NO_ENVIRONMENT > * never prints anything on stderr. If it fails, it sets the > * global errno. So something like this should be used: > */ > fprintf (logfp, "error: %s\n", str...
2019 Jun 27
2
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...e_types)] > enum guestfs_h {} > > +#[link(name = \"guestfs\")] > extern \"C\" { > fn guestfs_create() -> *mut guestfs_h; > fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; > fn guestfs_close(g: *mut guestfs_h); > - static GUESTFS_CREATE_NO_ENVIRONMENT: i64; > - static GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64; > } > > +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; > +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; > + > pub struct Handle { > g: *mut guestfs_h, > } > @@ -61,13 +63,17 @@ pub struct CreateFlags...
2019 Jun 27
1
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...ink(name = \"guestfs\")] > > > extern \"C\" { > > > fn guestfs_create() -> *mut guestfs_h; > > > fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; > > > fn guestfs_close(g: *mut guestfs_h); > > > - static GUESTFS_CREATE_NO_ENVIRONMENT: i64; > > > - static GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64; > > > } > > > > > > +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; > > > +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; > > > + > > > pub struct Handle { > > >...
2019 Jun 27
0
[PATCH 3/9] Rust bindings: Add 4 bindings tests
...enerate_rust () = #[allow(non_camel_case_types)] enum guestfs_h {} +#[link(name = \"guestfs\")] extern \"C\" { fn guestfs_create() -> *mut guestfs_h; fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; fn guestfs_close(g: *mut guestfs_h); - static GUESTFS_CREATE_NO_ENVIRONMENT: i64; - static GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64; } +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; + pub struct Handle { g: *mut guestfs_h, } @@ -61,13 +63,17 @@ pub struct CreateFlags { } impl CreateFlags { - pub fn new() -&gt...
2019 Jun 27
0
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...> > > > +#[link(name = \"guestfs\")] > > extern \"C\" { > > fn guestfs_create() -> *mut guestfs_h; > > fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; > > fn guestfs_close(g: *mut guestfs_h); > > - static GUESTFS_CREATE_NO_ENVIRONMENT: i64; > > - static GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64; > > } > > > > +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; > > +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; > > + > > pub struct Handle { > > g: *mut guestfs_h, > > } >...
2019 Aug 05
0
[PATCH 1/2] Rust bindings: Add Event structs, Clarify Handle lifetime
...rust/src/base.rs index 02ad33535..c17607cb3 100644 --- a/rust/src/base.rs +++ b/rust/src/base.rs @@ -17,6 +17,9 @@ */ use crate::error; +use crate::event; +use crate::guestfs; +use std::collections; #[allow(non_camel_case_types)] #[repr(C)] @@ -34,31 +37,37 @@ extern "C" { const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; -pub struct Handle { +pub struct Handle<'a> { pub(crate) g: *mut guestfs_h, + pub(crate) callbacks: collections::HashMap< + event::EventHandle, + Box<Box<dyn Fn(guestfs::Event, event::EventHandle,...
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com> --- Makefile.am | 4 ++++ configure.ac | 3 +++ generator/Makefile.am | 3 +++ generator/bindtests.ml | 3 +++ generator/bindtests.mli | 1 + generator/main.ml | 5 +++++ generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++ generator/rust.mli | 19 +++++++++++++++++++
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...\" { fn guestfs_create() -> *mut guestfs_h; fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; fn guestfs_close(g: *mut guestfs_h); + fn guestfs_last_error(g: *mut guestfs_h) -> *const c_char; + fn guestfs_last_errno(g: *mut guestfs_h) -> c_int; } const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; @@ -132,6 +135,29 @@ impl CreateFlags { } } +struct NullTerminatedIter<T: Copy + Clone> { + p: *const T +} + +impl<T: Copy + Clone> NullTerminatedIter<T> { + fn new(p: *const T) -> NullTerminatedIter<T> { + NullTerminatedIter{ p } + } +}...
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...{ + volatile VALUE optargsv; unsigned flags = 0; volatile VALUE v; + + optargsv = argc == 1 ? argv[0] : rb_hash_new (); + Check_Type (optargsv, T_HASH); + v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"environment\"))); if (v != Qnil && !RTEST (v)) flags |= GUESTFS_CREATE_NO_ENVIRONMENT; @@ -164,6 +170,56 @@ ruby_guestfs_create (int argc, VALUE *argv, VALUE m) if (v != Qnil && !RTEST (v)) flags |= GUESTFS_CREATE_NO_CLOSE_ON_EXIT; + return flags; +} + +/* + * call-seq: + * Guestfs::Guestfs.new([{:environment => false, :close_on_exit => false}]) -> Gues...
2019 Jul 02
16
[PATCH] Add Rust bindings
I fixed the patch I submitted before based on comments, and there are some commits which are merged or divided. So, I will re-send all the patches. Regards, Hiroyuki Katsura
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...// opaque struct +enum guestfs_h {} // opaque struct #[link(name = \"guestfs\")] extern \"C\" { @@ -79,6 +81,11 @@ extern \"C\" { fn guestfs_last_errno(g: *mut guestfs_h) -> c_int; } +extern \"C\" { + fn free(buf: *const c_void); +} + + const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; @@ -136,77 +143,136 @@ impl CreateFlags { } struct NullTerminatedIter<T: Copy + Clone> { - p: *const T + p: *const *const T, } impl<T: Copy + Clone> NullTerminatedIter<T> { - fn new(p: *const T) -> NullT...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...)] +#[repr(C)] +pub(crate) struct guestfs_h { + _unused: [u32; 0], +} + +#[link(name = "guestfs")] +extern "C" { + fn guestfs_create() -> *mut guestfs_h; + fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; + fn guestfs_close(g: *mut guestfs_h); +} + +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; + +pub struct Handle { + pub(crate) g: *mut guestfs_h, +} + +impl Handle { + pub fn create() -> Result<Handle, &'static str> { + let g = unsafe { guestfs_create() }; + if g.is_null() { + Err(&...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
..._unused: [u32; 0], > +} > + > +#[link(name = "guestfs")] > +extern "C" { > + fn guestfs_create() -> *mut guestfs_h; > + fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; > + fn guestfs_close(g: *mut guestfs_h); > +} > + > +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; > +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; > + > +pub struct Handle { > + pub(crate) g: *mut guestfs_h, > +} > + > +impl Handle { > + pub fn create() -> Result<Handle, &'static str> { > + let g = unsafe { guestfs_create() };...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...)] +#[repr(C)] +pub(crate) struct guestfs_h { + _unused: [u32; 0], +} + +#[link(name = "guestfs")] +extern "C" { + fn guestfs_create() -> *mut guestfs_h; + fn guestfs_create_flags(flags: i64) -> *mut guestfs_h; + fn guestfs_close(g: *mut guestfs_h); +} + +const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1; +const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2; + +pub struct Handle { + pub(crate) g: *mut guestfs_h, +} + +impl Handle { + pub fn create() -> Result<Handle, error::Error> { + let g = unsafe { guestfs_create() }; + if g.is_null() { + Err(error::Er...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
I fixed based on comments. I'll send these two patches to this mailing list. - Fix Handle -> Handle<'a> - Add events Regards, Hiroyuki 2019年8月1日(木) 0:01 Pino Toscano <ptoscano@redhat.com>: > Hi Hiroyuki, > > On Tuesday, 30 July 2019 07:51:37 CEST Hiroyuki Katsura wrote: > > This patch includes: > > > > - Event callback handlers > > -
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
> Is this just trying if the guestfs can be linked with? Yes. In OCaml bindings, there is the corresponding test( https://github.com/libguestfs/libguestfs/blob/master/ocaml/t/guestfs_010_load.ml). I just mimicked it. If it is not required, I will remove it. divided the generated files and handmade files in rust/src/ directory. I'll send this fixed patch to this mailing list. I'm not