Displaying 20 results from an estimated 205 matches for "guestfs_create".
2016 Apr 04
0
[PATCH 2/2] Use 'error' function for fprintf followed by exit.
...an.c
+++ b/align/scan.c
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
+#include <error.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
@@ -130,10 +131,8 @@ main (int argc, char *argv[])
int r;
g = guestfs_create ();
- if (g == NULL) {
- fprintf (stderr, _("guestfs_create: failed to create handle\n"));
- exit (EXIT_FAILURE);
- }
+ if (g == NULL)
+ error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &optio...
2016 Apr 04
1
Re: [PATCH 2/2] Use 'error' function for fprintf followed by exit.
...t;
> Candidates for replacement were found using:
>
> pcregrep --buffer-size 10M -M '\bfprintf\b.*\n.*\bexit\b' `git ls-files`
> ---
Really nice improvement -- just a couple of notes.
> @@ -130,10 +131,8 @@ main (int argc, char *argv[])
> int r;
>
> g = guestfs_create ();
> - if (g == NULL) {
> - fprintf (stderr, _("guestfs_create: failed to create handle\n"));
> - exit (EXIT_FAILURE);
> - }
> + if (g == NULL)
> + error (EXIT_FAILURE, errno, "guestfs_create");
What about
error (EXIT_FAILURE, errno, _("fa...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...@@ -86,16 +88,12 @@ main (int argc, char *argv[])
exit (77);
}
- if (access ("/dev/fuse", W_OK) == -1) {
- perror ("/dev/fuse");
- exit (77);
- }
+ if (access ("/dev/fuse", W_OK) == -1)
+ error (77, errno, "access: /dev/fuse");
g = guestfs_create ();
- if (g == NULL) {
- perror ("guestfs_create");
- exit (EXIT_FAILURE);
- }
+ if (g == NULL)
+ error (EXIT_FAILURE, errno, "guestfs_create");
if (guestfs_add_drive_scratch (g, SIZE, -1) == -1)
exit (EXIT_FAILURE);
@@ -126,10 +124,8 @@ main (int argc, cha...
2012 Oct 10
0
NOTE: Relaunching handles (don't do it!)
It's possible through the API to do a sequence of calls like this:
g = guestfs_create ();
guestfs_add_drive (g, "foo");
guestfs_launch (g);
guestfs_shutdown (g);
guestfs_launch (g); # relaunch the handle
The question is, what should be the state of the handle at the second
launch? Would the verbose flag still be set if it had been set
earlier? (I think fairly...
2016 Feb 12
0
[PATCH] php: restructure and expand tests
...ff --git a/php/extension/tests/guestfs_020_create.phpt b/php/extension/tests/guestfs_020_create.phpt
new file mode 100644
index 0000000..013ebb5
--- /dev/null
+++ b/php/extension/tests/guestfs_020_create.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Load the module and create a handle.
+--FILE--
+<?php
+$g = guestfs_create ();
+if ($g == false) {
+ echo ("Failed to create guestfs_php handle.\n");
+ exit;
+}
+echo ("Created guestfs_php handle.\n");
+?>
+--EXPECT--
+Created guestfs_php handle.
diff --git a/php/extension/tests/guestfs_070_optargs.phpt b/php/extension/tests/guestfs_070_optargs.ph...
2014 Mar 18
2
[PATCH 1/2] php: make the test suite failures fatal
So far the failure of some test would have not reported a non-zero
return value by run-tests.php. Since now all the PHP tests pass, we can
ask for failures to be fatal, by exporting REPORT_EXIT_STATUS=1 for
run-tests.php.
---
php/run-php-tests.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/php/run-php-tests.sh b/php/run-php-tests.sh
index 6f9ae10..e498987 100755
---
2016 Jun 01
2
[PATCH v2] rescue: add --autosysroot option RHBZ#1183493
--autosysroot option uses suggestions to user on how to mount filesystems
and change root suggested by --suggest option in virt-rescue.
Commands are passed on kernel command line in format
guestfs_command=command;. Command ends with a semicolon and there can be
multiple commands specified. These are executed just before bash starts.
On successfull run user is presented directly with bash in
2016 Jun 01
0
[PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...0, 'V' },
{ 0, 0, 0, 0 }
};
- struct drv *drvs = NULL;
- struct drv *drv;
- const char *format = NULL;
- bool format_consumed = true;
- int c;
- int option_index;
- int network = 0;
- const char *append = NULL;
- int memsize = 0;
- int smp = 0;
- int suggest = 0;
- g = guestfs_create ();
- if (g == NULL)
- error (EXIT_FAILURE, errno, "guestfs_create");
+ option_index = 0;
+ optind = 0;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
@@ -150,7 +152,9 @@ main (int argc, char *argv[])
if...
2016 Jun 09
2
Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...rvs = NULL;
> - struct drv *drv;
> - const char *format = NULL;
> - bool format_consumed = true;
> - int c;
> - int option_index;
> - int network = 0;
> - const char *append = NULL;
> - int memsize = 0;
> - int smp = 0;
> - int suggest = 0;
>
> - g = guestfs_create ();
> - if (g == NULL)
> - error (EXIT_FAILURE, errno, "guestfs_create");
>
> + option_index = 0;
> + optind = 0;
> for (;;) {
> c = getopt_long (argc, argv, options, long_options, &option_index);
> if (c == -1) break;
> @@ -150,7 +152,9...
2016 May 24
1
[PATCH] rescue: add --autosysroot option RHBZ#1183493
--autosysroot option uses suggestions to user on how to mount filesystems
and change root suggested by --suggest option in virt-rescue.
Commands are passed on kernel command line in format
guestfs_command=command;. Command ends with a semicolon and there can be
multiple commands specified. These are executed just before bash starts.
On successfull run user is presented directly with bash in
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
2013 Dec 23
2
[PATCH] tests/mountable: skip if btrfs is not available
...ble.c
+++ b/tests/mountable/test-internal-parse-mountable.c
@@ -33,6 +33,7 @@ main (int argc, char *argv[])
guestfs_h *g;
struct guestfs_internal_mountable *mountable;
const char *devices[] = { "/dev/VG/LV", NULL };
+ const char *feature[] = { "btrfs", NULL };
g = guestfs_create ();
if (g == NULL) {
@@ -48,6 +49,12 @@ main (int argc, char *argv[])
if (guestfs_launch (g) == -1) goto error;
+ if (!guestfs_feature_available (g, (char **) feature)) {
+ printf ("skipping test because btrfs is not available\n");
+ guestfs_close (g);
+ exit (77);
+...
2016 Jun 16
0
Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...- const char *format = NULL;
>> - bool format_consumed = true;
>> - int c;
>> - int option_index;
>> - int network = 0;
>> - const char *append = NULL;
>> - int memsize = 0;
>> - int smp = 0;
>> - int suggest = 0;
>>
>> - g = guestfs_create ();
>> - if (g == NULL)
>> - error (EXIT_FAILURE, errno, "guestfs_create");
>>
>> + option_index = 0;
>> + optind = 0;
>> for (;;) {
>> c = getopt_long (argc, argv, options, long_options, &option_index);
>> if (c...
2012 Dec 14
3
inspect_os error with Win7 image
The error message:
hivex_close: do_hivex_close: you must call 'hivex-open' first to
initialize the hivex handle
This is the process flow:
g = guestfs_create ();
guestfs_add_drive_opts (g, diskFile,GUESTFS_ADD_DRIVE_OPTS_FORMAT,
"raw",-1);
guestfs_launch (g)
char **roots = guestfs_inspect_os (g);
guestfs_inspect_os returns NULL, guestfs_last_error(g) returns message above.
And guestfs_last_errno(g) returns 0.
However this same co...
2012 Aug 06
1
[PATCH V2] virt-diff: add new virt-diff tool
...long_options[] = {
+ {"seed", 1, 0, 's'},
+ {"domain", 1, 0, 'd'},
+ {"help", 0, 0, HELP_OPTION},
+ {0, 0, 0, 0}
+ };
+
+ struct drv *sdrv = NULL;
+ struct drv *ddrv = NULL;
+ int c, nr;
+ int option_index;
+ int spid, dpid;
+
+ sg = guestfs_create ();
+ if (sg == NULL) {
+ fprintf (stderr, _("guestfs_create: failed to create seed handle\n"));
+ exit (EXIT_FAILURE);
+ }
+
+ dg = guestfs_create ();
+ if (dg == NULL) {
+ fprintf (stderr, _("guestfs_create: failed to create comparison handle\n"));
+ exit (EXIT...
2019 Jun 27
0
[PATCH 2/9] Rust bindings: Add create / close functions
...or/rust.ml
+++ b/generator/rust.ml
@@ -31,4 +31,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 Ha...
2012 Mar 08
1
[PATCH] Fix the default value of "pgroup".
...on (SIGQUIT, &sa, NULL);
- guestfs_set_pgroup (g, 1);
+ guestfs_set_pgroup (g, 0);
}
/* Old-style -i syntax? Since -a/-d/-N and -i was disallowed
diff --git a/src/guestfs.c b/src/guestfs.c
index 3493d79..2ff506b 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -143,6 +143,9 @@ guestfs_create (void)
*/
g->msg_next_serial = 0x00123400;
+ /* Default is 'false' to allow users to interrupt the subprocess. */
+ g->pgroup = 0;
+
/* Default is uniprocessor appliance. */
g->smp = 1;
--
1.7.7.6
2013 Jan 02
1
[PATCH] ruby: add -DGUESTFS_PRIVATE_FUNCTIONS=1 to CFLAGS
...2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in
index 15259ea..808ff9e 100644
--- a/ruby/ext/guestfs/extconf.rb.in
+++ b/ruby/ext/guestfs/extconf.rb.in
@@ -30,7 +30,7 @@ unless have_library("guestfs", "guestfs_create", "guestfs.h")
end
$CFLAGS =
- "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 " <<
+ "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 -DGUESTFS_PRIVATE_FUNCTIONS=1" <<
"@WARN_CFLAGS@ @WERROR_CFLAGS@"
create_header
--
1.8.0....
2013 Jan 24
0
Libguestfs with Perl 6 :-)
...erface was like compared to the
horrific mess that is Perl5 XS. The answer is that it is a thing of
beauty !
Here is the libguestfs hello world example in Perl6
$ dd if=/dev/zero of=guest.img bs=1M count=100
$ mke2fs guest.img
$ cat guestfs.p6
use NativeCall;
say "Defining stubs";
sub guestfs_create() returns OpaquePointer is native('libguestfs') {}
sub guestfs_add_drive(OpaquePointer $handle, Str $path) returns Int is native('libguestfs') {}
sub guestfs_launch(OpaquePointer $handle) returns Int is native('libguestfs') {}
sub guestfs_mount(OpaquePointer $handle, Str $pa...
2013 Jul 17
0
Re: Redirecting libguestfs error messages
...Trash: No such file 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 shoul...