diff options
author | Matthew Booth <mbooth@redhat.com> | 2011-10-17 15:28:47 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-10-19 16:26:42 +0100 |
commit | f1041e912b72116d66274d2f15e50ce34a9531fd (patch) | |
tree | 8b7d72acd49f65b37e9906dd3d602135d05fa8ee /src/guestfs-internal.h | |
parent | 472f02d08b077a5c1ee233d9dcef92ac9b09d4ae (diff) | |
download | libguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.tar.gz libguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.tar.xz libguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.zip |
launch: Store drive information in guestfs_h
This is a NFC on its own, but provides a place-holder for drive metadata which
can be used after launch.
Fixes by RWMJ:
- Fix the tests: this requires a new internal function 'debug-drives'
that dumps out the g->drives information so it can be checked in
two of the tests. Previously these tests used 'debug-cmdline'.
- Test file existence / use_cache_off in the add_drive_opts function,
not when launching qemu in the child process.
- Call free along error paths.
- Add comments.
Diffstat (limited to 'src/guestfs-internal.h')
-rw-r--r-- | src/guestfs-internal.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index cd732e16..7bdb4e44 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -149,6 +149,18 @@ struct event { void *opaque2; }; +/* Linked list of drives added to the handle. */ +struct drive { + struct drive *next; + + char *path; + + int readonly; + char *format; + char *iface; + int use_cache_off; +}; + struct guestfs_h { struct guestfs_h *next; /* Linked list of open handles. */ @@ -156,6 +168,8 @@ struct guestfs_h /* State: see the state machine diagram in the man page guestfs(3). */ enum state state; + struct drive *drives; /* Drives added by add-drive* APIs. */ + int fd[2]; /* Stdin/stdout of qemu. */ int sock; /* Daemon communications socket. */ pid_t pid; /* Qemu PID. */ @@ -359,6 +373,7 @@ extern void guestfs___trace (guestfs_h *g, const char *fs, ...) extern const char *guestfs___persistent_tmpdir (void); extern void guestfs___print_timestamped_message (guestfs_h *g, const char *fs, ...); extern void guestfs___free_inspect_info (guestfs_h *g); +extern void guestfs___free_drives (struct drive **drives); extern int guestfs___set_busy (guestfs_h *g); extern int guestfs___end_busy (guestfs_h *g); extern int guestfs___send (guestfs_h *g, int proc_nr, uint64_t progress_hint, uint64_t optargs_bitmask, xdrproc_t xdrp, char *args); @@ -380,8 +395,8 @@ extern int guestfs___match2 (guestfs_h *g, const char *str, const pcre *re, char extern int guestfs___match3 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3); extern int guestfs___feature_available (guestfs_h *g, const char *feature); extern void guestfs___free_string_list (char **); -extern size_t guestfs___checkpoint_cmdline (guestfs_h *g); -extern void guestfs___rollback_cmdline (guestfs_h *g, size_t pos); +extern struct drive ** guestfs___checkpoint_drives (guestfs_h *g); +extern void guestfs___rollback_drives (guestfs_h *g, struct drive **i); extern void guestfs___call_callbacks_void (guestfs_h *g, uint64_t event); extern void guestfs___call_callbacks_message (guestfs_h *g, uint64_t event, const char *buf, size_t buf_len); extern void guestfs___call_callbacks_array (guestfs_h *g, uint64_t event, const uint64_t *array, size_t array_len); |