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 0dc95810ca..db1bfcfbd8 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -29,6 +29,10 @@ #include "virutil.h" #include "virstring.h" +#define LIBVIRT_VIRERRORPRIV_H_ALLOW +#include "virerrorpriv.h" +#undef LIBVIRT_VIRERRORPRIV_H_ALLOW + VIR_LOG_INIT("util.error"); virThreadLocal virLastErr; @@ -908,7 +912,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..8e482f2e40 --- /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 + * . + */ + +#ifndef LIBVIRT_VIRERRORPRIV_H_ALLOW +# error "virerrorpriv.h may only be included by virerror.c or its test suite" +#endif /* LIBVIRT_VIRERRORPRIV_H_ALLOW */ + +#ifndef LIBVIRT_VIRERRORPRIV_H +# define LIBVIRT_VIRERRORPRIV_H + +const char * +virErrorMsg(virErrorNumber error, + const char *info); + +#endif /* LIBVIRT_VIRERRORPRIV_H */