218e99
From ab4cb1fa308e6352003b16ef3227e6bcacd2ba08 Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Mon, 14 Oct 2013 13:35:13 +0200
218e99
Subject: [PATCH 06/18] error: add error_setg_file_open() helper
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1381757723-23134-6-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 54853
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 05/15] error: add error_setg_file_open() helper
218e99
Bugzilla: 922010
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
From: Luiz Capitulino <lcapitulino@redhat.com>
218e99
218e99
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 54028d7542cffe97c4685994baac66988c4b7db9)
218e99
---
218e99
 include/qapi/error.h | 5 +++++
218e99
 util/error.c         | 5 +++++
218e99
 2 files changed, 10 insertions(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 include/qapi/error.h |    5 +++++
218e99
 util/error.c         |    5 +++++
218e99
 2 files changed, 10 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/include/qapi/error.h b/include/qapi/error.h
218e99
index 5cd2f0c..ffd1cea 100644
218e99
--- a/include/qapi/error.h
218e99
+++ b/include/qapi/error.h
218e99
@@ -45,6 +45,11 @@ void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char
218e99
     error_set_errno(err, os_error, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__)
218e99
 
218e99
 /**
218e99
+ * Helper for open() errors
218e99
+ */
218e99
+void error_setg_file_open(Error **errp, int os_errno, const char *filename);
218e99
+
218e99
+/**
218e99
  * Returns true if an indirect pointer to an error is pointing to a valid
218e99
  * error object.
218e99
  */
218e99
diff --git a/util/error.c b/util/error.c
218e99
index 519f6b6..53b0435 100644
218e99
--- a/util/error.c
218e99
+++ b/util/error.c
218e99
@@ -71,6 +71,11 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
218e99
     *errp = err;
218e99
 }
218e99
 
218e99
+void error_setg_file_open(Error **errp, int os_errno, const char *filename)
218e99
+{
218e99
+    error_setg_errno(errp, os_errno, "Could not open '%s'", filename);
218e99
+}
218e99
+
218e99
 Error *error_copy(const Error *err)
218e99
 {
218e99
     Error *err_new;
218e99
-- 
218e99
1.7.1
218e99