summary refs log tree commit diff stats
path: root/qga/guest-agent-core.h
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-02-09 14:27:16 -0700
committerMichael Roth <mdroth@linux.vnet.ibm.com>2016-02-25 09:48:50 -0600
commit0b4b49387cce8358783a493004b77c1603b34b5c (patch)
treedebae516d511132c0a7155aa62148c26615666af /qga/guest-agent-core.h
parent774ae4254d3910f1c94ad6ed44d14cbea0e6a2f2 (diff)
downloadfocaccia-qemu-0b4b49387cce8358783a493004b77c1603b34b5c.tar.gz
focaccia-qemu-0b4b49387cce8358783a493004b77c1603b34b5c.zip
qga: Support enum names in guest-file-seek
Magic constants are a pain to use, especially when we run the
risk that our choice of '1' for QGA_SEEK_CUR might differ from
the host or guest's choice of SEEK_CUR.  Better is to use an
enum value, via a qapi alternate type for back-compatibility.

With this,
 {"command":"guest-file-seek", "arguments":{"handle":1,
  "offset":0, "whence":"cur"}}
becomes a synonym for the older
 {"command":"guest-file-seek", "arguments":{"handle":1,
  "offset":0, "whence":1}}

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/guest-agent-core.h')
-rw-r--r--qga/guest-agent-core.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index 238dc6b08d..0a49516045 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -12,16 +12,10 @@
  */
 #include "qapi/qmp/dispatch.h"
 #include "qemu-common.h"
+#include "qga-qmp-commands.h"
 
 #define QGA_READ_COUNT_DEFAULT 4096
 
-/* Mapping of whence codes used by guest-file-seek. */
-enum {
-    QGA_SEEK_SET = 0,
-    QGA_SEEK_CUR = 1,
-    QGA_SEEK_END = 2,
-};
-
 typedef struct GAState GAState;
 typedef struct GACommandState GACommandState;
 extern GAState *ga_state;
@@ -44,6 +38,7 @@ void ga_set_frozen(GAState *s);
 void ga_unset_frozen(GAState *s);
 const char *ga_fsfreeze_hook(GAState *s);
 int64_t ga_get_fd_handle(GAState *s, Error **errp);
+int ga_parse_whence(GuestFileWhence *whence, Error **errp);
 
 #ifndef _WIN32
 void reopen_fd_to_null(int fd);