summaryrefslogtreecommitdiffstats
path: root/qga/commands.c
diff options
context:
space:
mode:
authorPeter Maydell2016-02-25 18:33:19 +0100
committerPeter Maydell2016-02-25 18:33:19 +0100
commit67ef811ed1452efe9d60c4baa20c8ef6ea0cfe87 (patch)
treecf93350db027542b1a64756f8bb0b683d5837173 /qga/commands.c
parentbuild: [bsd-user] Rename "syscall.h" to "target_syscall.h" in target directories (diff)
parentqga: fix w32 breakage due to missing osdep.h includes (diff)
downloadqemu-67ef811ed1452efe9d60c4baa20c8ef6ea0cfe87.tar.gz
qemu-67ef811ed1452efe9d60c4baa20c8ef6ea0cfe87.tar.xz
qemu-67ef811ed1452efe9d60c4baa20c8ef6ea0cfe87.zip
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2016-02-25-tag' into staging
qemu-ga patch queue for 2.6 * fix w32 build breakage when VSS enabled * fix up wchar handling in guest-set-user-password * fix re-install handling for w32 MSI installer * add w32 support for guest-get-vcpus * add support for enums in guest-file-seek SEEK params instead of relying on platform-specific integer values # gpg: Signature made Thu 25 Feb 2016 16:59:13 GMT using RSA key ID F108B584 # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" # gpg: aka "Michael Roth <mdroth@utexas.edu>" # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" * remotes/mdroth/tags/qga-pull-2016-02-25-tag: qga: fix w32 breakage due to missing osdep.h includes qga: check utf8-to-utf16 conversion qga: fix off-by-one length check qga: use wide-chars constants for wchar_t comparisons qga: use size_t for wcslen() return value qga: use more idiomatic qemu-style eol operators qga: implement the guest-get-vcpus for windows qemu-ga: Fixed minor version switch issue qga: Support enum names in guest-file-seek Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qga/commands.c')
-rw-r--r--qga/commands.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/qga/commands.c b/qga/commands.c
index 5b56786ef6..e091ee1af1 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -473,3 +473,24 @@ done:
return ge;
}
+
+/* Convert GuestFileWhence (either a raw integer or an enum value) into
+ * the guest's SEEK_ constants. */
+int ga_parse_whence(GuestFileWhence *whence, Error **errp)
+{
+ /* Exploit the fact that we picked values to match QGA_SEEK_*. */
+ if (whence->type == QTYPE_QSTRING) {
+ whence->type = QTYPE_QINT;
+ whence->u.value = whence->u.name;
+ }
+ switch (whence->u.value) {
+ case QGA_SEEK_SET:
+ return SEEK_SET;
+ case QGA_SEEK_CUR:
+ return SEEK_CUR;
+ case QGA_SEEK_END:
+ return SEEK_END;
+ }
+ error_setg(errp, "invalid whence code %"PRId64, whence->u.value);
+ return -1;
+}