[libvirt] [PATCH 04/10] util: error: Export virErrorMsg for use in testsuite

Peter Krempa pkrempa at redhat.com
Wed Dec 5 16:47:45 UTC 2018


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/Makefile.am          |  1 +
 src/libvirt_private.syms |  1 +
 src/util/Makefile.inc.am |  1 +
 src/util/virerror.c      |  5 ++++-
 src/util/virerrorpriv.h  | 28 ++++++++++++++++++++++++++++
 5 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 src/util/virerrorpriv.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 33ff280d78..0bb3ff8fc8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -951,6 +951,7 @@ libvirt_nss_la_SOURCES = \
 		util/vircommand.h \
 		util/virerror.c \
 		util/virerror.h \
+		util/virerrorpriv.h \
 		util/virfile.c \
 		util/virfile.h \
 		util/virhash.c \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fd63c9ca61..6184030d59 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1752,6 +1752,7 @@ ebtablesRemoveForwardAllowIn;
 virDispatchError;
 virErrorCopyNew;
 virErrorInitialize;
+virErrorMsg;
 virErrorPreserveLast;
 virErrorRestore;
 virErrorSetErrnoFromLastError;
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index cffbb357bc..4295babac3 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -50,6 +50,7 @@ UTIL_SOURCES = \
 	util/virendian.h \
 	util/virerror.c \
 	util/virerror.h \
+	util/virerrorpriv.h \
 	util/virevent.c \
 	util/virevent.h \
 	util/vireventpoll.c \
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 64be00dc75..be23712a60 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -31,6 +31,9 @@
 #include "virutil.h"
 #include "virstring.h"

+#define __VIR_ERROR_ALLOW_INCLUDE_PRIV_H__
+#include "virerrorpriv.h"
+
 VIR_LOG_INIT("util.error");

 virThreadLocal virLastErr;
@@ -910,7 +913,7 @@ void virRaiseErrorObject(const char *filename,
  *
  * Returns the constant string associated to @error
  */
-static const char *
+const char *
 virErrorMsg(virErrorNumber error, const char *info)
 {
     const char *errmsg = NULL;
diff --git a/src/util/virerrorpriv.h b/src/util/virerrorpriv.h
new file mode 100644
index 0000000000..bc214393e6
--- /dev/null
+++ b/src/util/virerrorpriv.h
@@ -0,0 +1,28 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VIR_ERROR_ALLOW_INCLUDE_PRIV_H__
+# error "virerrorpriv.h may only be included by virerror.c or its test suite"
+#endif
+
+#ifndef __VIR_ERROR_PRIV_H__
+# define __VIR_ERROR_PRIV_H__
+
+const char *
+virErrorMsg(virErrorNumber error,
+            const char *info);
+
+#endif /* __VIR_ERROR_PRIV_H__ */
-- 
2.19.2




More information about the libvir-list mailing list