mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23: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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue