git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implemented autosync, make it the default for guestfish.
[libguestfs.git]
/
src
/
guestfs.c
diff --git
a/src/guestfs.c
b/src/guestfs.c
index
0c0a37f
..
747aae5
100644
(file)
--- a/
src/guestfs.c
+++ b/
src/guestfs.c
@@
-116,6
+116,7
@@
struct guestfs_h
int cmdline_size;
int verbose;
int cmdline_size;
int verbose;
+ int autosync;
/* Callbacks. */
guestfs_abort_cb abort_cb;
/* Callbacks. */
guestfs_abort_cb abort_cb;
@@
-216,6
+217,10
@@
guestfs_close (guestfs_h *g)
if (g->verbose)
fprintf (stderr, "closing guestfs handle %p (state %d)\n", g, g->state);
if (g->verbose)
fprintf (stderr, "closing guestfs handle %p (state %d)\n", g, g->state);
+ /* Try to sync if autosync flag is set. */
+ if (g->autosync && g->state == READY)
+ guestfs_sync (g);
+
/* Remove any handlers that might be called back before we kill the
* subprocess.
*/
/* Remove any handlers that might be called back before we kill the
* subprocess.
*/
@@
-378,6
+383,18
@@
guestfs_get_verbose (guestfs_h *g)
return g->verbose;
}
return g->verbose;
}
+void
+guestfs_set_autosync (guestfs_h *g, int a)
+{
+ g->autosync = a;
+}
+
+int
+guestfs_get_autosync (guestfs_h *g)
+{
+ return g->autosync;
+}
+
/* Add a string to the current command line. */
static void
incr_cmdline_size (guestfs_h *g)
/* Add a string to the current command line. */
static void
incr_cmdline_size (guestfs_h *g)