mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
774ae4254d
commit
0b4b49387c
6 changed files with 70 additions and 40 deletions
|
@ -6,7 +6,6 @@
|
|||
#include <sys/un.h>
|
||||
|
||||
#include "libqtest.h"
|
||||
#include "qga/guest-agent-core.h"
|
||||
|
||||
typedef struct {
|
||||
char *test_dir;
|
||||
|
@ -450,8 +449,8 @@ static void test_qga_file_ops(gconstpointer fix)
|
|||
/* seek */
|
||||
cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
|
||||
" 'arguments': { 'handle': %" PRId64 ", "
|
||||
" 'offset': %d, 'whence': %d } }",
|
||||
id, 6, QGA_SEEK_SET);
|
||||
" 'offset': %d, 'whence': '%s' } }",
|
||||
id, 6, "set");
|
||||
ret = qmp_fd(fixture->fd, cmd);
|
||||
qmp_assert_no_error(ret);
|
||||
val = qdict_get_qdict(ret, "return");
|
||||
|
@ -543,8 +542,8 @@ static void test_qga_file_write_read(gconstpointer fix)
|
|||
/* seek to 0 */
|
||||
cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
|
||||
" 'arguments': { 'handle': %" PRId64 ", "
|
||||
" 'offset': %d, 'whence': %d } }",
|
||||
id, 0, QGA_SEEK_SET);
|
||||
" 'offset': %d, 'whence': '%s' } }",
|
||||
id, 0, "set");
|
||||
ret = qmp_fd(fixture->fd, cmd);
|
||||
qmp_assert_no_error(ret);
|
||||
val = qdict_get_qdict(ret, "return");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue