search for: guestfs_create_flags

Displaying 20 results from an estimated 50 matches for "guestfs_create_flags".

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
2015 Oct 02
1
[PATCH] ruby: improve rdoc markup
...a/generator/ruby.ml b/generator/ruby.ml index cd6678d..87bb34a 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -178,7 +178,7 @@ parse_flags (int argc, VALUE *argv) * Guestfs::Guestfs.new([{:environment => false, :close_on_exit => false}]) -> Guestfs::Guestfs * * Call - * +guestfs_create_flags+[http://libguestfs.org/guestfs.3.html#guestfs_create_flags] + * {guestfs_create_flags}[http://libguestfs.org/guestfs.3.html#guestfs_create_flags] * to create a new libguestfs handle. The handle is represented in * Ruby as an instance of the Guestfs::Guestfs class. */ @@ -235,7 +235,7 @@ ruby...
2020 Feb 05
1
[PATCH] properly initialize error_data_lock_list before use
...le: initialize error_data_list_lock when a handle is allocated, the error_data_list_lock must be initialized --- lib/handle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/handle.c b/lib/handle.c index f61fdbcd3..99a8b8848 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -88,6 +88,7 @@ guestfs_create_flags (unsigned flags, ...) if (!g) return NULL; gl_recursive_lock_init (g->lock); + gl_lock_init (g->error_data_list_lock); g->state = CONFIG; @@ -176,6 +177,7 @@ guestfs_create_flags (unsigned flags, ...) free (g->append); guestfs_int_free_error_data_list (g); gl_tls_k...
2013 Jul 17
0
Re: Redirecting libguestfs error messages
...or directory" > > I still get them in stderr .. Right. 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: */ fpr...
2013 Jul 17
1
Re: Redirecting libguestfs error messages
...get them in stderr .. > > Right. 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 sh...
2019 Jun 27
0
[PATCH 2/9] Rust bindings: Add create / close functions
...,86 @@ open Events let generate_rust () = - generate_header CStyle LGPLv2plus; \ No newline at end of file + 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...
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...stfs_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}]) -> Guestfs::Guestfs + * + * Call + * +guestfs_create_flags+[http://libguestfs.org/guestfs.3.html#guestfs_create_flags] + * to create a new libguestfs handle. The handle is represented in + * Ruby as an instance of the Guestfs::Guestfs class. + */ +static VALUE +ruby_guestfs_initialize (int argc, VALUE *argv, VALUE m) +{ + guestfs_h *g; + unsigned flags;...
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...cached_feature *features; size_t nr_features; + + /* Used by lib/info.c. -1 = not tested or error; else 0 or 1. */ + int qemu_img_supports_U_option; }; /** diff --git a/lib/handle.c b/lib/handle.c index a47aaafab..297ff6d67 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -101,6 +101,8 @@ guestfs_create_flags (unsigned flags, ...) g->memsize = DEFAULT_MEMSIZE; + g->qemu_img_supports_U_option = -1; /* not tested, see lib/info.c */ + /* Start with large serial numbers so they are easy to spot * inside the protocol. */ diff --git a/lib/info.c b/lib/info.c index 2eadc1c11..74e4424b8...
2015 Jun 16
5
[PATCH threads v2 0/5] Add support for thread-safe handle.
Previous discussion here: https://www.redhat.com/archives/libguestfs/2015-June/thread.html#00048 v2: - Use a cleanup handler to release the lock. - Rebase to upstream. Note I have not fixed the problem(s) with error handling (patch 3).
2017 Jun 27
0
[PATCH v3 3/5] threads: Use thread-local storage for errors.
...00644 --- a/lib/handle.c +++ b/lib/handle.c @@ -32,6 +32,7 @@ #include <libxml/xmlversion.h> #include "glthread/lock.h" +#include "glthread/tls.h" #include "ignore-value.h" #include "c-ctype.h" #include "getprogname.h" @@ -92,7 +93,7 @@ guestfs_create_flags (unsigned flags, ...) g->conn = NULL; - guestfs_int_init_error_handler (g); + gl_tls_key_init (g->error_data, NULL); g->abort_cb = abort; g->recovery_proc = 1; @@ -171,6 +172,8 @@ guestfs_create_flags (unsigned flags, ...) free (g->path); free (g->hv); fr...
2015 Jun 06
0
[PATCH 3/5] threads: Use thread-local storage for errors.
.../handle.c index dfb8817..ba7928d 100644 --- a/src/handle.c +++ b/src/handle.c @@ -32,6 +32,7 @@ #include <libxml/xmlversion.h> #include "glthread/lock.h" +#include "glthread/tls.h" #include "ignore-value.h" #include "guestfs.h" @@ -90,7 +91,7 @@ guestfs_create_flags (unsigned flags, ...) g->conn = NULL; - guestfs_int_init_error_handler (g); + gl_tls_key_init (g->error_data, NULL); g->abort_cb = abort; g->recovery_proc = 1; @@ -169,6 +170,8 @@ guestfs_create_flags (unsigned flags, ...) free (g->path); free (g->hv); fr...
2013 Apr 03
1
RHashtable and the python bindings
I've discovered that libguestfs apis which return RHashtable are currently returned as a list of tuples in the python bindings rather than the obvious dict. I propose fixing this, whilst also maintaining API compatibility for a period of time. The following apis return RHashtable: inspect_get_mountpoints list_filesystems inspect_get_drive_mappings tune2fs_l mountpoints md_detail blkid
2018 Oct 02
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...; + > + /* Used by lib/info.c. -1 = not tested or error; else 0 or 1. */ > + int qemu_img_supports_U_option; > }; > > /** > diff --git a/lib/handle.c b/lib/handle.c > index a47aaafab..297ff6d67 100644 > --- a/lib/handle.c > +++ b/lib/handle.c > @@ -101,6 +101,8 @@ guestfs_create_flags (unsigned flags, ...) > > g->memsize = DEFAULT_MEMSIZE; > > + g->qemu_img_supports_U_option = -1; /* not tested, see lib/info.c */ > + > /* Start with large serial numbers so they are easy to spot > * inside the protocol. > */ > diff --git a/lib/info....
2017 Jun 27
9
[PATCH v3 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html I have rebased and tidied up the patches, fixing a few spelling mistakes, but they are broadly the same as before. I also ran all the tests, which pass. As with the previous versions, this makes a change to the API, where you
2015 May 26
6
[PATCH 0/6] Update the way that API versions are generated for the man page.
The existing mechanism was clunky, slow and used ~ 10 MB of local disk. Rich.
2015 Jun 06
7
[PATCH 0/5] Add support for thread-safe handle.
This patch isn't ready to go upstream. In fact, I think we might do a quick 1.30 release soon, and save this patch, and also the extensive changes proposed for the test suite[1], to after 1.30. Currently it is not safe to use the same handle from multiple threads, unless you implement your own mutexes. See: http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads These
2019 Jun 27
2
Re: [PATCH 3/9] Rust bindings: Add 4 bindings tests
...erator/rust.ml > +++ b/generator/rust.ml > @@ -37,14 +37,16 @@ let generate_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...
2019 Aug 05
0
[PATCH 1/2] Rust bindings: Add Event structs, Clarify Handle lifetime
...tions::HashMap::new(); + Ok(Handle { g, callbacks }) } } - pub fn create_flags(flags: CreateFlags) -> Result<Handle, error::Error> { + pub fn create_flags(flags: CreateFlags) -> Result<Handle<'a>, error::Error> { let g = unsafe { guestfs_create_flags(flags.to_libc_int()) }; if g.is_null() { Err(error::Error::Create) } else { - Ok(Handle { g }) + let callbacks = collections::HashMap::new(); + Ok(Handle { g, callbacks }) } } } -impl Drop for Handle { +impl<'a&...
2014 Jun 27
3
[PATCH WIP] Can't generate argv variant
Hi everyone, lately I've been getting familiar with library and working on slight re-layering of the library. It's about having locking layer in public API and tracing one layer below that (let's call it __t_ layer. I'm not very good at making up names, so this is temporary:) ). Then making sure that all generated public stuff call __t_ layer and all other internal stuff
2018 Jan 22
2
[PATCH] lua, perl: Use thread-safe strerror_r instead of strerror (RHBZ#1536763).
...s_h *g; struct userdata *u; unsigned flags = 0; + char err[128]; if (lua_gettop (L) == 1) { OPTARG_IF_SET (1, \"environment\", @@ -157,9 +160,10 @@ guestfs_int_lua_create (lua_State *L) return luaL_error (L, \"Guestfs.create: too many arguments\"); g = guestfs_create_flags (flags); - if (!g) - return luaL_error (L, \"Guestfs.create: cannot create handle: %%s\", - strerror (errno)); + if (!g) { + ignore_value (strerror_r (errno, err, sizeof err)); + return luaL_error (L, \"Guestfs.create: cannot create handle: %%s\"...