From 9aaeb5d944ef67eb3aaf8cbd50c1307933a06cb2 Mon Sep 17 00:00:00 2001 Message-Id: <9aaeb5d944ef67eb3aaf8cbd50c1307933a06cb2.1367947969.git.minovotn@redhat.com> In-Reply-To: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> References: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> From: Michal Novotny Date: Tue, 7 May 2013 18:37:55 +0200 Subject: [PATCH 041/114] Revert "qemu-ga: build_fs_mount_list(): take an Error argument" This reverts commit 97c098440e1eb5ce501270787a80da5194978a73. Reverting as asked by Laszlo in message <51892739.2030807@redhat.com> because of the ordering issue (most likely) related to supersed testing. Signed-off-by: Michal Novotny --- qga/commands-posix.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index b03d596..18bd801 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -368,7 +368,7 @@ static void free_fs_mount_list(FsMountList *mounts) /* * Walk the mount table and build a list of local file systems */ -static void build_fs_mount_list(FsMountList *mounts, Error **err) +static int build_fs_mount_list(FsMountList *mounts) { struct mntent *ment; FsMount *mount; @@ -377,8 +377,8 @@ static void build_fs_mount_list(FsMountList *mounts, Error **err) fp = setmntent(mtab, "r"); if (!fp) { - error_setg(err, "failed to open mtab file: '%s'", mtab); - return; + g_warning("fsfreeze: unable to read mtab"); + return -1; } while ((ment = getmntent(fp))) { @@ -402,6 +402,8 @@ static void build_fs_mount_list(FsMountList *mounts, Error **err) } endmntent(fp); + + return 0; } #endif @@ -428,17 +430,15 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) int ret = 0, i = 0; FsMountList mounts; struct FsMount *mount; - Error *local_err = NULL; int fd; char err_msg[512]; slog("guest-fsfreeze called"); QTAILQ_INIT(&mounts); - build_fs_mount_list(&mounts, &local_err); - if (error_is_set(&local_err)) { - error_propagate(err, local_err); - return -1; + ret = build_fs_mount_list(&mounts); + if (ret < 0) { + return ret; } /* cannot risk guest agent blocking itself on a write in this state */ @@ -495,12 +495,12 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err) FsMountList mounts; FsMount *mount; int fd, i = 0, logged; - Error *local_err = NULL; QTAILQ_INIT(&mounts); - build_fs_mount_list(&mounts, &local_err); - if (error_is_set(&local_err)) { - error_propagate(err, local_err); + ret = build_fs_mount_list(&mounts); + if (ret) { + error_set(err, QERR_QGA_COMMAND_FAILED, + "failed to enumerate filesystems"); return 0; } @@ -565,7 +565,6 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) FsMountList mounts; struct FsMount *mount; int fd; - Error *local_err = NULL; char err_msg[512]; struct fstrim_range r = { .start = 0, @@ -576,9 +575,8 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) slog("guest-fstrim called"); QTAILQ_INIT(&mounts); - build_fs_mount_list(&mounts, &local_err); - if (error_is_set(&local_err)) { - error_propagate(err, local_err); + ret = build_fs_mount_list(&mounts); + if (ret < 0) { return; } -- 1.7.11.7