From 8bcb038bc6ebb7d048d228f121220120cf290314 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Mon, 5 Mar 2012 18:00:29 -0300 Subject: [RHEL6 qemu-kvm PATCH] guest agent: remove unsupported guest agent commands (guest-file-*) RH-Author: Jeffrey Cody Message-id: Patchwork-id: 38091 O-Subject: [RHEL6.3 qemu-kvm PATCH] guest agent: remove unsupported guest agent commands (guest-file-*) Bugzilla: 632771 RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek RH-Acked-by: Luiz Capitulino The file operations for the guest agent are unsupported for 6.3, and so are removed from the available guest agent commands. These are removed in the similar way that the file operations are unsupported upstream in the win32 agent - they return QERR_UNSUPPORTED. This removes the following commands: - guest-file-open - guest-file-close - guest-file-read - guest-file-write - guest-file-seek - guest-file-flush Signed-off-by: Jeff Cody NOTE: This is a RHEL/RHEV only patch. Also, this patch is dependent upon the series: "[RHEL6.3 qemu-kvm PATCH 0/5] S3/S4 support for posix guest agent" BZ 632771 Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=4117244 (note, brew build not yet completed, it is still ongoing) --- qga/commands-posix.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) Signed-off-by: Eduardo Habkost --- qga/commands-posix.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index ccbcdc4..642f3ae 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -30,6 +30,10 @@ #include "qerror.h" #include "qemu-queue.h" +/* file-* commands are compile-time disabled for RHEL/RHEV. + * To enable, set to '1' */ +#define QGA_FILE_OPS 0 + static GAState *ga_state; static void reopen_fd_to_null(int fd) @@ -95,6 +99,7 @@ static struct { QTAILQ_HEAD(, GuestFileHandle) filehandles; } guest_file_state; +#if (QGA_FILE_OPS) static void guest_file_handle_add(FILE *fh) { GuestFileHandle *gfh; @@ -118,9 +123,11 @@ static GuestFileHandle *guest_file_handle_find(int64_t id) return NULL; } +#endif int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err) { +#if (QGA_FILE_OPS) FILE *fh; int fd; int64_t ret = -1; @@ -150,10 +157,15 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E guest_file_handle_add(fh); slog("guest-file-open, handle: %d", fd); return fd; +#else + error_set(err, QERR_UNSUPPORTED); + return 0; +#endif } void qmp_guest_file_close(int64_t handle, Error **err) { +#if (QGA_FILE_OPS) GuestFileHandle *gfh = guest_file_handle_find(handle); int ret; @@ -171,11 +183,15 @@ void qmp_guest_file_close(int64_t handle, Error **err) QTAILQ_REMOVE(&guest_file_state.filehandles, gfh, next); qemu_free(gfh); +#else + error_set(err, QERR_UNSUPPORTED); +#endif } struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **err) { +#if (QGA_FILE_OPS) GuestFileHandle *gfh = guest_file_handle_find(handle); GuestFileRead *read_data = NULL; guchar *buf; @@ -213,11 +229,16 @@ struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, clearerr(fh); return read_data; +#else + error_set(err, QERR_UNSUPPORTED); + return 0; +#endif } GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **err) { +#if (QGA_FILE_OPS) GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; @@ -254,11 +275,16 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, clearerr(fh); return write_data; +#else + error_set(err, QERR_UNSUPPORTED); + return 0; +#endif } struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset, int64_t whence, Error **err) { +#if (QGA_FILE_OPS) GuestFileHandle *gfh = guest_file_handle_find(handle); GuestFileSeek *seek_data = NULL; FILE *fh; @@ -281,10 +307,15 @@ struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset, clearerr(fh); return seek_data; +#else + error_set(err, QERR_UNSUPPORTED); + return 0; +#endif } void qmp_guest_file_flush(int64_t handle, Error **err) { +#if (QGA_FILE_OPS) GuestFileHandle *gfh = guest_file_handle_find(handle); FILE *fh; int ret; @@ -299,6 +330,9 @@ void qmp_guest_file_flush(int64_t handle, Error **err) if (ret == EOF) { error_set(err, QERR_QGA_COMMAND_FAILED, strerror(errno)); } +#else + error_set(err, QERR_UNSUPPORTED); +#endif } static void guest_file_init(void) -- 1.7.3.2