From 1265c14a6676be3cbc003c219326a60813dc29d5 Mon Sep 17 00:00:00 2001
Message-Id: <1265c14a6676be3cbc003c219326a60813dc29d5.1343041017.git.minovotn@redhat.com>
From: Jeffrey Cody <jcody@redhat.com>
Date: Wed, 9 May 2012 14:06:53 +0200
Subject: [PATCH 1/9] Revert "guest agent: remove unsupported guest agent
 commands (guest-file-*)"

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <6078e7433f70a3c75c3ff2c874064d2bbd501d4a.1336570396.git.jcody@redhat.com>
Patchwork-id: 39668
O-Subject: [RHEL6.3 qemu-kvm PATCH v2 1/2] Revert "guest agent: remove unsupported guest agent commands (guest-file-*)"
Bugzilla: 819900
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

This reverts commit 8bcb038bc6ebb7d048d228f121220120cf290314.

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 qga/commands-posix.c |   34 ----------------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qga/commands-posix.c |   34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d825c2c..249e1d4 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -44,10 +44,6 @@ extern char **environ;
 #endif
 #endif
 
-/* file-* commands are compile-time disabled for RHEL/RHEV.
- * To enable, set to '1' */
-#define QGA_FILE_OPS 0
-
 void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
 {
     const char *shutdown_flag;
@@ -103,7 +99,6 @@ static struct {
     QTAILQ_HEAD(, GuestFileHandle) filehandles;
 } guest_file_state;
 
-#if (QGA_FILE_OPS)
 static void guest_file_handle_add(FILE *fh)
 {
     GuestFileHandle *gfh;
@@ -127,11 +122,9 @@ 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;
@@ -161,15 +154,10 @@ 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;
 
@@ -187,15 +175,11 @@ 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;
@@ -233,16 +217,11 @@ 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;
@@ -279,16 +258,11 @@ 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;
@@ -311,15 +285,10 @@ 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;
@@ -334,9 +303,6 @@ 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.10.4

