[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/12] qemu-ga: guest_file_handle_find(): take an Er
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 01/12] qemu-ga: guest_file_handle_find(): take an Error argument |
Date: |
Tue, 8 Jan 2013 16:59:58 -0600 |
From: Luiz Capitulino <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
*Fixed missing space character in error message
Signed-off-by: Michael Roth <address@hidden>
---
qga/commands-posix.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index a657201..bbef66d 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -111,7 +111,7 @@ static void guest_file_handle_add(FILE *fh)
QTAILQ_INSERT_TAIL(&guest_file_state.filehandles, gfh, next);
}
-static GuestFileHandle *guest_file_handle_find(int64_t id)
+static GuestFileHandle *guest_file_handle_find(int64_t id, Error **err)
{
GuestFileHandle *gfh;
@@ -122,6 +122,7 @@ static GuestFileHandle *guest_file_handle_find(int64_t id)
}
}
+ error_setg(err, "handle '%" PRId64 "' has not been found", id);
return NULL;
}
@@ -160,12 +161,11 @@ int64_t qmp_guest_file_open(const char *path, bool
has_mode, const char *mode, E
void qmp_guest_file_close(int64_t handle, Error **err)
{
- GuestFileHandle *gfh = guest_file_handle_find(handle);
+ GuestFileHandle *gfh = guest_file_handle_find(handle, err);
int ret;
slog("guest-file-close called, handle: %ld", handle);
if (!gfh) {
- error_set(err, QERR_FD_NOT_FOUND, "handle");
return;
}
@@ -182,14 +182,13 @@ void qmp_guest_file_close(int64_t handle, Error **err)
struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
int64_t count, Error **err)
{
- GuestFileHandle *gfh = guest_file_handle_find(handle);
+ GuestFileHandle *gfh = guest_file_handle_find(handle, err);
GuestFileRead *read_data = NULL;
guchar *buf;
FILE *fh;
size_t read_count;
if (!gfh) {
- error_set(err, QERR_FD_NOT_FOUND, "handle");
return NULL;
}
@@ -228,11 +227,10 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle,
const char *buf_b64,
guchar *buf;
gsize buf_len;
int write_count;
- GuestFileHandle *gfh = guest_file_handle_find(handle);
+ GuestFileHandle *gfh = guest_file_handle_find(handle, err);
FILE *fh;
if (!gfh) {
- error_set(err, QERR_FD_NOT_FOUND, "handle");
return NULL;
}
@@ -265,13 +263,12 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle,
const char *buf_b64,
struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,
int64_t whence, Error **err)
{
- GuestFileHandle *gfh = guest_file_handle_find(handle);
+ GuestFileHandle *gfh = guest_file_handle_find(handle, err);
GuestFileSeek *seek_data = NULL;
FILE *fh;
int ret;
if (!gfh) {
- error_set(err, QERR_FD_NOT_FOUND, "handle");
return NULL;
}
@@ -291,12 +288,11 @@ struct GuestFileSeek *qmp_guest_file_seek(int64_t handle,
int64_t offset,
void qmp_guest_file_flush(int64_t handle, Error **err)
{
- GuestFileHandle *gfh = guest_file_handle_find(handle);
+ GuestFileHandle *gfh = guest_file_handle_find(handle, err);
FILE *fh;
int ret;
if (!gfh) {
- error_set(err, QERR_FD_NOT_FOUND, "handle");
return;
}
--
1.7.9.5
- [Qemu-devel] [PULL 0/12] qemu-ga: error handling improvements and fsfreeze hooks, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 01/12] qemu-ga: guest_file_handle_find(): take an Error argument,
Michael Roth <=
- [Qemu-devel] [PATCH 02/12] qemu-ga: qmp_guest_file_close(): fix fclose() error check, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 03/12] qemu-ga: qmp_guest_file_*: improve error reporting, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 04/12] qemu-ga: qmp_guest_shutdown(): improve error reporting, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 05/12] qemu-ga: build_fs_mount_list(): take an Error argument, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 06/12] qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set(), Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 08/12] qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set(), Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 09/12] qemu-ga: bios_supports_mode(): improve error reporting, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 07/12] qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set(), Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 10/12] qemu-ga: guest_suspend(): improve error reporting, Michael Roth, 2013/01/08
- [Qemu-devel] [PATCH 11/12] qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw, Michael Roth, 2013/01/08