Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/Makefile.inc.am | 1 +
src/util/virerror.c | 6 +++++-
src/util/virerrorpriv.h | 28 ++++++++++++++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 src/util/virerrorpriv.h
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 eed65e8f6a..1e7c8bdb90 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -31,6 +31,10 @@
#include "virutil.h"
#include "virstring.h"
+#define __VIR_ERROR_ALLOW_INCLUDE_PRIV_H__
+#include "virerrorpriv.h"
+#undef __VIR_ERROR_ALLOW_INCLUDE_PRIV_H__
+
VIR_LOG_INIT("util.error");
virThreadLocal virLastErr;
@@ -910,7 +914,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